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

[Bug]: Function 'table_exists()' returning false when the table does exist in database #1167

Closed
BuzzCutNorman opened this issue Nov 10, 2022 · 0 comments · Fixed by #1168
Closed
Labels
kind/Bug Something isn't working valuestream/SDK

Comments

@BuzzCutNorman
Copy link
Contributor

Singer SDK Version

0.13.1

Python Version

3.9

Bug scope

Targets (data type handling, batching, SQL object generation, etc.)

Operating System

Windows

Description

When an SDK target checks to see if a table exists with table_exists() it always come back as false if the full_table_name is in schema.table format or database.schema.table format. That is happening because the function sqlalchemy.engine.reflection.Inspector.has_table is not able to deal with two part of three part table names.

image
image
image
image

Code

def table_exists(self, full_table_name: str) -> bool:
        """Determine if the target table already exists.

        Args:
            full_table_name: the target table name.

        Returns:
            True if table exists, False if not, None if unsure or undetectable.
        """
        return cast(
            bool,
            sqlalchemy.inspect(self._engine).has_table(full_table_name),
        )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/Bug Something isn't working valuestream/SDK
Projects
None yet
1 participant