diff --git a/CHANGES.md b/CHANGES.md index f38cf44..e399be5 100644 --- a/CHANGES.md +++ b/CHANGES.md @@ -3,6 +3,7 @@ ## in progress - Update to MLflow 2.7.1 +- Improve `table_exists()` in `example_merlion.py` ## 2023-09-12 0.1.1 - Documentation: Improve "Container Usage" page diff --git a/examples/tracking_merlion.py b/examples/tracking_merlion.py index a1a00a6..cf796b0 100644 --- a/examples/tracking_merlion.py +++ b/examples/tracking_merlion.py @@ -47,7 +47,7 @@ def connect_database(): return client.connect(dburi) -def table_exists(table_name: str, schema_name: str = "doc") -> bool: +def table_exists(table_name: str) -> bool: """ Check if database table exists. """ @@ -55,7 +55,7 @@ def table_exists(table_name: str, schema_name: str = "doc") -> bool: cursor = conn.cursor() sql = ( f"SELECT table_name FROM information_schema.tables " # noqa: S608 - f"WHERE table_name = '{table_name}' AND table_schema = '{schema_name}'" + f"WHERE table_name = '{table_name}' AND table_schema = CURRENT_SCHEMA" ) cursor.execute(sql) rowcount = cursor.rowcount