|
@@ -42,7 +42,7 @@ class SQLHandler:
|
|
with different dabase connectors.
|
|
with different dabase connectors.
|
|
Remark:in each method we force new opening and
|
|
Remark:in each method we force new opening and
|
|
closing of a database connection,
|
|
closing of a database connection,
|
|
- this avoids errors when parallelizing with multiprocessing.
|
|
|
|
|
|
+ this avoids errors when parallelizing with multiprocessing.
|
|
'''
|
|
'''
|
|
pass
|
|
pass
|
|
def __init__(self, db_uri: str = None,
|
|
def __init__(self, db_uri: str = None,
|
|
@@ -55,6 +55,7 @@ class SQLHandler:
|
|
sqlalchemy dialects:
|
|
sqlalchemy dialects:
|
|
for mysql : mysql+pymysql
|
|
for mysql : mysql+pymysql
|
|
for db2: ibm_db_sa
|
|
for db2: ibm_db_sa
|
|
|
|
+ for mssql: mssql+pyodbc
|
|
'''
|
|
'''
|
|
from sqlalchemy_utils import database_exists, create_database
|
|
from sqlalchemy_utils import database_exists, create_database
|
|
|
|
|
|
@@ -64,8 +65,9 @@ class SQLHandler:
|
|
|
|
|
|
from libraries.configuration import default as cfg
|
|
from libraries.configuration import default as cfg
|
|
|
|
|
|
- db_uri = "mysql+pymysql://{0}:{1}@{2}:{3}/{4}?charset=utf8&local_infile=1"\
|
|
|
|
- .format(cfg["SQL"]["SQL_USER"],
|
|
|
|
|
|
+ db_uri = "{0}://{1}:{2}@{3}:{4}/{5}?charset=utf8&local_infile=1"\
|
|
|
|
+ .format(cfg["SQL"]["SQL_DIALECT"],
|
|
|
|
+ cfg["SQL"]["SQL_USER"],
|
|
cfg["SQL"]["SQL_PASSWORD"],
|
|
cfg["SQL"]["SQL_PASSWORD"],
|
|
cfg["SQL"]["SQL_HOST"],
|
|
cfg["SQL"]["SQL_HOST"],
|
|
cfg["SQL"]["SQL_PORT"],
|
|
cfg["SQL"]["SQL_PORT"],
|