Skip to content

Commit

Permalink
Improve table_exists() in example_merlion.py
Browse files Browse the repository at this point in the history
  • Loading branch information
amotl committed Sep 18, 2023
1 parent 80f9d6f commit e589f44
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions examples/tracking_merlion.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,15 +47,15 @@ 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.
"""
conn = connect_database()
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
Expand Down

0 comments on commit e589f44

Please sign in to comment.