From cf7f99f6f417bc110fa05551bacee3a979cc3372 Mon Sep 17 00:00:00 2001 From: niteshnicholas Date: Thu, 13 Jun 2019 00:46:33 +0530 Subject: [PATCH] Correcting the url by adding port --- optimus/io/jdbc.py | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/optimus/io/jdbc.py b/optimus/io/jdbc.py index dea9e0a45..6e28f10c1 100644 --- a/optimus/io/jdbc.py +++ b/optimus/io/jdbc.py @@ -21,13 +21,7 @@ def __init__(self, db_type, url, database, user, password, port=None): # RaiseIt.value_error(db_type, ["redshift", "postgres", "mysql", "sqlite"]) self.db_type = db_type - # Create string connection - if self.db_type is "sqlite": - url = "jdbc:" + db_type + ":" + url + "/" + database - else: - url = "jdbc:" + db_type + "://" + url + "/" + database - - # Handle the default port + # Handle the default port if port is None: if self.db_type is "redshift": self.port = 5439 @@ -38,6 +32,12 @@ def __init__(self, db_type, url, database, user, password, port=None): elif self.db_type is "mysql": self.port = 3306 + # Create string connection + if self.db_type is "sqlite": + url = "jdbc:" + db_type + ":" + url + "/" + database + else: + url = "jdbc:" + db_type + "://" + url + ":" + port + "/" + database + self.url = url self.database = database self.user = user