diff options
author | Michaël Ball <michael.ball@gmail.com> | 2019-06-30 11:12:05 +0100 |
---|---|---|
committer | Michaël Ball <michael.ball@gmail.com> | 2019-06-30 11:12:05 +0100 |
commit | a87517a0b385f1a68dd80e7dabf7843955c95ab9 (patch) | |
tree | 696f1e2a45ab7c0db57ce562517790cb73247b53 /db | |
parent | 1acbc1e85d6a0af47c236c48b8c5a1b504871d96 (diff) |
Style fixesfeature/pluggable-viewsdevelop
Diffstat (limited to 'db')
-rw-r--r-- | db/db_manager.py | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/db/db_manager.py b/db/db_manager.py index 9c2dd53..2684fb3 100644 --- a/db/db_manager.py +++ b/db/db_manager.py @@ -8,9 +8,9 @@ import sqlite3 import six - _LOGGER = logging.getLogger(__name__) + class DbManager(object): """DBManager makes interacting with sqlite databases easier.""" @@ -72,16 +72,17 @@ class DbManager(object): yield six.u("{0};").format(sql) table_name_ident = table_name.replace("\"", "\"\"") - res = cursor.execute("PRAGMA table_info(\"{0}\")".format( - table_name_ident)) + res = cursor.execute( + "PRAGMA table_info(\"{0}\")".format(table_name_ident)) column_names = [ - str(table_info[1]) for table_info in res.fetchall()] + str(table_info[1]) for table_info in res.fetchall() + ] query = """ SELECT 'INSERT INTO "{0}" VALUES({1})' FROM "{0}"; - """.format(table_name_ident, ",".join( - """'||quote("{0}")||'""".format( - col.replace( - "\"", "\"\"")) for col in column_names)) + """.format( + table_name_ident, ",".join( + """'||quote("{0}")||'""".format(col.replace("\"", "\"\"")) + for col in column_names)) query_res = cursor.execute(query) for row in query_res: yield six.u("{0};").format(row[0]) |