Browse Source

Enable to specify driver

ogert 3 years ago
parent
commit
0cb59ef8e5
1 changed files with 11 additions and 1 deletions
  1. 11 1
      cdplib/db_handlers/SQLHandler.py

+ 11 - 1
cdplib/db_handlers/SQLHandler.py

@@ -65,7 +65,17 @@ class SQLHandler:
 
             from libraries.configuration import default as cfg
 
-            db_uri = "{0}://{1}:{2}@{3}:{4}/{5}?charset=utf8&local_infile=1"\
+            if cfg["SQL"]["DRIVER"]:
+                db_uri = "{0}://{1}:{2}@{3}:{4}/{5}?driver={}&charset=utf8&local_infile=1"\
+                     .format(cfg["SQL"]["SQL_DIALECT"],
+                             cfg["SQL"]["SQL_USER"],
+                             cfg["SQL"]["SQL_PASSWORD"],
+                             cfg["SQL"]["SQL_HOST"],
+                             cfg["SQL"]["SQL_PORT"],
+                             cfg["SQL"]["SQL_DATABASE_NAME"],
+                             cfg["SQL"]["DRIVER"])
+            else:
+                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"],