Pārlūkot izejas kodu

Fix error in if statement

ogert 3 gadi atpakaļ
vecāks
revīzija
a1134dbf74
1 mainītis faili ar 11 papildinājumiem un 11 dzēšanām
  1. 11 11
      cdplib/db_handlers/SQLHandler.py

+ 11 - 11
cdplib/db_handlers/SQLHandler.py

@@ -66,17 +66,7 @@ class SQLHandler:
             from libraries.configuration import default as cfg
 
             if cfg["SQL"]["DRIVER"]:
-                # TODO : See if this still connect to Mariadb, also try to change to sqlalchemy.engine.url.URL.create
-                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 = sqlalchemy.engine.url.URL.create(
+                                db_uri = sqlalchemy.engine.url.URL.create(
                                 cfg["SQL"]["SQL_DIALECT"],
                                 username=cfg["SQL"]["SQL_USER"],
                                 password=cfg["SQL"]["SQL_PASSWORD"],
@@ -85,6 +75,16 @@ class SQLHandler:
                                 database=cfg["SQL"]["SQL_DATABASE_NAME"],
                                 query=dict(driver=cfg["SQL"]["DRIVER"])
                                 )
+            else:
+                # TODO : See if this still connect to Mariadb, also try to change to sqlalchemy.engine.url.URL.create
+                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"])
+
 
         # assert(isinstance(db_uri, str)),\
         #     "Parameter 'db_uri' must be of type str"