From 80daef23cb5ef5bad4c73b1ef0df7cab06483cea Mon Sep 17 00:00:00 2001 From: Dan Norman Date: Fri, 11 Nov 2022 12:36:44 -0700 Subject: [PATCH] fix: `SQLConnector.table_exists()` to use separate `table_name` and `schema_name` instead of fully qualified name (#1168) Co-authored-by: Edgar R. M Fixes https://github.com/meltano/sdk/issues/1167 --- singer_sdk/connectors/sql.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/singer_sdk/connectors/sql.py b/singer_sdk/connectors/sql.py index 2bb102237..5aae327ab 100644 --- a/singer_sdk/connectors/sql.py +++ b/singer_sdk/connectors/sql.py @@ -477,9 +477,11 @@ def table_exists(self, full_table_name: str) -> bool: Returns: True if table exists, False if not, None if unsure or undetectable. """ + _, schema_name, table_name = self.parse_full_table_name(full_table_name) + return cast( bool, - sqlalchemy.inspect(self._engine).has_table(full_table_name), + sqlalchemy.inspect(self._engine).has_table(table_name, schema_name), ) def schema_exists(self, schema_name: str) -> bool: