From 945bbb1288fa6b5f9b2f00e52d70ba1aa067adeb Mon Sep 17 00:00:00 2001 From: fordhoka Date: Mon, 27 Nov 2023 15:34:50 -0700 Subject: [PATCH] Fix reflection bug for case-sensitive schemas see https://github.com/snowflakedb/snowflake-sqlalchemy/issues/458 --- src/snowflake/sqlalchemy/snowdialect.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/snowflake/sqlalchemy/snowdialect.py b/src/snowflake/sqlalchemy/snowdialect.py index d6f1056c..b99f9c9b 100644 --- a/src/snowflake/sqlalchemy/snowdialect.py +++ b/src/snowflake/sqlalchemy/snowdialect.py @@ -833,7 +833,7 @@ def get_schema_names(self, connection, **kw): @reflection.cache def get_sequence_names(self, connection, schema=None, **kw): sql_command = "SHOW SEQUENCES {}".format( - f"IN SCHEMA {self.normalize_name(schema)}" if schema else "" + f" IN SCHEMA \"{self.denormalize_name(schema)}\"" if schema else "", ) try: cursor = connection.execute(text(sql_command)) @@ -851,7 +851,7 @@ def _get_table_comment(self, connection, table_name, schema=None, **kw): "SHOW /* sqlalchemy:_get_table_comment */ " "TABLES LIKE '{}'{}".format( table_name, - f" IN SCHEMA {self.normalize_name(schema)}" if schema else "", + f" IN SCHEMA \"{self.denormalize_name(schema)}\"" if schema else "", ) ) cursor = connection.execute(text(sql_command)) @@ -865,7 +865,7 @@ def _get_view_comment(self, connection, table_name, schema=None, **kw): "SHOW /* sqlalchemy:_get_view_comment */ " "VIEWS LIKE '{}'{}".format( table_name, - f" IN SCHEMA {self.normalize_name(schema)}" if schema else "", + f" IN SCHEMA \"{self.denormalize_name(schema)}\"" if schema else "", ) ) cursor = connection.execute(text(sql_command))