@@ -319,19 +319,12 @@ def get_check_constraints(self, connection, table_name, schema, **kw):
319
319
320
320
@reflection .cache
321
321
def _get_table_primary_keys (self , connection , schema , table_name , ** kw ):
322
- if table_name in SnowflakeIdentifierPreparer .reserved_words :
323
- fully_qualified_path = self ._denormalize_quote_join (schema , table_name )
324
- result = connection .execute (
325
- text (
326
- f"SHOW /* sqlalchemy:_get_table_primary_keys */ PRIMARY KEYS IN TABLE { fully_qualified_path } "
327
- )
328
- )
329
- else :
330
- result = connection .execute (
331
- text (
332
- f"SHOW /* sqlalchemy:_get_table_primary_keys */ PRIMARY KEYS IN TABLE { schema } .{ table_name } "
333
- )
322
+ fully_qualified_path = self ._denormalize_quote_join (schema , self .denormalize_name (table_name ))
323
+ result = connection .execute (
324
+ text (
325
+ f"SHOW /* sqlalchemy:_get_table_primary_keys */ PRIMARY KEYS IN TABLE { fully_qualified_path } "
334
326
)
327
+ )
335
328
ans = {}
336
329
for row in result :
337
330
table_name = self .normalize_name (row ._mapping ["table_name" ])
@@ -388,19 +381,12 @@ def get_pk_constraint(self, connection, table_name, schema=None, **kw):
388
381
389
382
@reflection .cache
390
383
def _get_table_unique_constraints (self , connection , schema , table_name , ** kw ):
391
- if table_name in SnowflakeIdentifierPreparer .reserved_words :
392
- fully_qualified_path = self ._denormalize_quote_join (schema , table_name )
393
- result = connection .execute (
394
- text (
395
- f"SHOW /* sqlalchemy:_get_table_unique_constraints */ UNIQUE KEYS IN TABLE { fully_qualified_path } "
396
- )
397
- )
398
- else :
399
- result = connection .execute (
400
- text (
401
- f"SHOW /* sqlalchemy:_get_table_unique_constraints */ UNIQUE KEYS IN TABLE { schema } .{ table_name } "
402
- )
384
+ fully_qualified_path = self ._denormalize_quote_join (schema , table_name )
385
+ result = connection .execute (
386
+ text (
387
+ f"SHOW /* sqlalchemy:_get_table_unique_constraints */ UNIQUE KEYS IN TABLE { fully_qualified_path } "
403
388
)
389
+ )
404
390
unique_constraints = {}
405
391
for row in result :
406
392
name = self .normalize_name (row ._mapping ["constraint_name" ])
@@ -471,19 +457,12 @@ def get_unique_constraints(self, connection, table_name, schema, **kw):
471
457
@reflection .cache
472
458
def _get_table_foreign_keys (self , connection , schema , table_name , ** kw ):
473
459
_ , current_schema = self ._current_database_schema (connection , ** kw )
474
- if table_name in SnowflakeIdentifierPreparer .reserved_words :
475
- fully_qualified_path = self ._denormalize_quote_join (schema , table_name )
476
- result = connection .execute (
477
- text (
478
- f"SHOW /* sqlalchemy:_get_table_foreign_keys */ IMPORTED KEYS IN TABLE { fully_qualified_path } "
479
- )
480
- )
481
- else :
482
- result = connection .execute (
483
- text (
484
- f"SHOW /* sqlalchemy:_get_table_foreign_keys */ IMPORTED KEYS IN TABLE { schema } .{ table_name } "
485
- )
460
+ fully_qualified_path = self ._denormalize_quote_join (schema , self .denormalize_name (table_name ))
461
+ result = connection .execute (
462
+ text (
463
+ f"SHOW /* sqlalchemy:_get_table_foreign_keys */ IMPORTED KEYS IN TABLE { fully_qualified_path } "
486
464
)
465
+ )
487
466
foreign_key_map = {}
488
467
for row in result :
489
468
name = self .normalize_name (row ._mapping ["fk_name" ])
0 commit comments