Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion db/db.py
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ class DB(object):
def __init__(self, username=None, password=None, hostname="localhost",
port=None, filename=None, dbname=None, dbtype=None, schemas=None,
profile="default", exclude_system_tables=True, limit=1000,
keys_per_column=None, driver=None, cache=False):
keys_per_column=None, driver=None, cache=False, extensions=[]):

if port is None:
if dbtype=="postgres":
Expand Down Expand Up @@ -173,6 +173,7 @@ def __init__(self, username=None, password=None, hostname="localhost",
self.limit = limit
self.keys_per_column = keys_per_column
self.driver = driver
self.extensions = extensions

if self.dbtype is None:
raise Exception("Database type not specified! Must select one of: postgres, sqlite, mysql, mssql, or redshift")
Expand All @@ -189,6 +190,10 @@ def __init__(self, username=None, password=None, hostname="localhost",
if not HAS_SQLITE:
raise Exception("Couldn't find sqlite library. Please ensure it is installed")
self.con = sqlite.connect(self.filename)
if self.extensions:
self.con.enable_load_extension(True)
for ext in self.extensions:
self.con.load_extension(ext)
self.cur = self.con.cursor()
self._create_sqlite_metatable()
elif self.dbtype=="mysql":
Expand Down
12 changes: 6 additions & 6 deletions db/queries/mssql.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@
},
"system": {
"schema_no_system": """
select
table_name
select table_schema
, table_name
, column_name
, data_type
from
Expand All @@ -25,16 +25,16 @@
table_schema not in ('information_schema', 'sys')
""",
"schema_with_system": """
select
table_name
select table_schema
, table_name
, column_name
, data_type
from
information_schema.columns;
""",
"schema_specified": """
select
table_name
select table_schema
, table_name
, column_name
, data_type
from
Expand Down