Skip to content

Commit a7f76b0

Browse files
sfc-gh-kteradasfc-gh-aling
authored andcommitted
Update snowdialect.py
an alternative approach to referencing RESERVED_WORDS
1 parent ca762b9 commit a7f76b0

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

src/snowflake/sqlalchemy/snowdialect.py

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@
4646
SnowflakeExecutionContext,
4747
SnowflakeIdentifierPreparer,
4848
SnowflakeTypeCompiler,
49-
RESERVED_WORDS,
5049
)
5150
from .custom_types import (
5251
_CUSTOM_DECIMAL,
@@ -320,7 +319,7 @@ def get_check_constraints(self, connection, table_name, schema, **kw):
320319

321320
@reflection.cache
322321
def _get_table_primary_keys(self, connection, schema, table_name, **kw):
323-
if table_name.upper() in RESERVED_WORDS:
322+
if table_name in SnowflakeIdentifierPreparer.reserved_words:
324323
fully_qualified_path = self._denormalize_quote_join(schema, table_name)
325324
result = connection.execute(
326325
text(
@@ -389,7 +388,7 @@ def get_pk_constraint(self, connection, table_name, schema=None, **kw):
389388

390389
@reflection.cache
391390
def _get_table_unique_constraints(self, connection, schema, table_name, **kw):
392-
if table_name.upper() in RESERVED_WORDS:
391+
if table_name in SnowflakeIdentifierPreparer.reserved_words:
393392
fully_qualified_path = self._denormalize_quote_join(schema, table_name)
394393
result = connection.execute(
395394
text(
@@ -472,7 +471,7 @@ def get_unique_constraints(self, connection, table_name, schema, **kw):
472471
@reflection.cache
473472
def _get_table_foreign_keys(self, connection, schema, table_name, **kw):
474473
_, current_schema = self._current_database_schema(connection, **kw)
475-
if table_name.upper() in RESERVED_WORDS:
474+
if table_name in SnowflakeIdentifierPreparer.reserved_words:
476475
fully_qualified_path = self._denormalize_quote_join(schema, table_name)
477476
result = connection.execute(
478477
text(

0 commit comments

Comments
 (0)