summaryrefslogtreecommitdiff
path: root/db/db_manager.py
diff options
context:
space:
mode:
Diffstat (limited to 'db/db_manager.py')
-rw-r--r--db/db_manager.py17
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])