Skip to content

Commit

Permalink
Use logger instead of print statement in sqlalchemy plugin (#1651)
Browse files Browse the repository at this point in the history
* use logging info instead of print

Signed-off-by: wirthual <[email protected]>

* isorted files

Signed-off-by: wirthual <[email protected]>

* import root logger from flytekit

Signed-off-by: wirthual <[email protected]>

---------

Signed-off-by: wirthual <[email protected]>
  • Loading branch information
wirthual authored May 22, 2023
1 parent 06fffc7 commit d7060cc
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
from flytekit.core.base_sql_task import SQLTask
from flytekit.core.python_customized_container_task import PythonCustomizedContainerTask
from flytekit.core.shim_task import ShimTaskExecutor
from flytekit.loggers import logger
from flytekit.models import task as task_models
from flytekit.models.security import Secret
from flytekit.types.schema import FlyteSchema
Expand Down Expand Up @@ -126,10 +127,10 @@ def execute_from_model(self, tt: task_models.TaskTemplate, **kwargs) -> typing.A
tt.custom["connect_args"][key] = value

engine = create_engine(tt.custom["uri"], connect_args=tt.custom["connect_args"], echo=False)
print(f"Connecting to db {tt.custom['uri']}")
logger.info(f"Connecting to db {tt.custom['uri']}")

interpolated_query = SQLAlchemyTask.interpolate_query(tt.custom["query_template"], **kwargs)
print(f"Interpolated query {interpolated_query}")
logger.info(f"Interpolated query {interpolated_query}")
with engine.begin() as connection:
df = None
if tt.interface.outputs:
Expand Down

0 comments on commit d7060cc

Please sign in to comment.