Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #177 #183 #198

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
16 changes: 4 additions & 12 deletions pipelines/whale/engine/sql_alchemy_engine.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,15 +24,8 @@ def init(self, conf: ConfigTree):

:param conf: configuration file.
"""
connect_args = {
k: v
for k, v in conf.get_config(
SQLAlchemyEngine.CONNECT_ARGS, default=ConfigTree()
).items()
}

self.conn_string = conf.get_string(SQLAlchemyEngine.CONN_STRING_KEY)
self.connect_args = connect_args
self.connect_args = HOCONConverter.to_json(conf.get_config(SQLAlchemyEngine.CONNECT_ARGS))
self.credentials_path = conf.get(SQLAlchemyEngine.CREDENTIALS_PATH_KEY, None)
self.connection = self._get_connection()

Expand All @@ -48,14 +41,13 @@ def _get_connection(self):
"""
if self.credentials_path:
engine = create_engine(
self.conn_string,
credentials_path=self.credentials_path,
connect_args=self.connect_args
self.conn_string, credentials_path=self.credentials_path,
connect_args=literal_eval(self.connect_args)
)
else:
engine = create_engine(
self.conn_string,
connect_args=self.connect_args
connect_args=literal_eval(self.connect_args)
)
conn = engine.connect()
return conn
Expand Down
2 changes: 1 addition & 1 deletion pipelines/whale/models/connection_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def __init__(
metadata_source: str,
dialect: Optional[str] = None,
uri: Optional[str] = None,
connect_args: Optional[dict] = {},
connect_args: Optional[dict] = None,
port: Optional[int] = None,
username: Optional[str] = None,
password: Optional[str] = None,
Expand Down