-
Notifications
You must be signed in to change notification settings - Fork 4
Closed
Description
has_table
method does not works for tables/schemas with characters that need escaping e.g. test-schema
, test-table
Current code uses EXISTS TABLE schema.name, this doesn't appear to work if table name needs escaping.
Suggest use of information_schema like e.g. get_columns
def has_table(self, connection, table_name, schema=None, **kw):
full_table = table_name
query = """
select 1
from information_schema.columns
where table_name = '{table_name}'
""".format(
table_name=table_name
)
query = "{query} and table_schema = '{schema}'".format(
query=query, schema=schema
)
result = connection.execute(text(query))
return bool(result.first())
Metadata
Metadata
Assignees
Labels
No labels