@@ -112,20 +112,33 @@ def _catalog_filter_table(
112112 return super ()._catalog_filter_table (lowered , used_schemas )
113113
114114 def _make_match_kwargs (self , database , schema , identifier ):
115+ # if any path part is already quoted then consider same casing but without quotes
115116 quoting = self .config .quoting
116- if identifier is not None and quoting ["identifier" ] is False :
117+ if SnowflakeAdapter ._is_quoted (identifier ):
118+ identifier = identifier .strip (SnowflakeRelation .quote_character )
119+ elif identifier is not None and quoting ["identifier" ] is False :
117120 identifier = identifier .upper ()
118121
119- if schema is not None and quoting ["schema" ] is False :
122+ if SnowflakeAdapter ._is_quoted (schema ):
123+ schema = schema .strip (SnowflakeRelation .quote_character )
124+ elif schema is not None and quoting ["schema" ] is False :
120125 schema = schema .upper ()
121126
122- if database is not None and quoting ["database" ] is False :
127+ if SnowflakeAdapter ._is_quoted (database ):
128+ database = database .strip (SnowflakeRelation .quote_character )
129+ elif database is not None and quoting ["database" ] is False :
123130 database = database .upper ()
124131
125132 return filter_null_values (
126133 {"identifier" : identifier , "schema" : schema , "database" : database }
127134 )
128135
136+ @classmethod
137+ def _is_quoted (cls , identifier : str ) -> bool :
138+ return (identifier is not None
139+ and identifier .startswith (SnowflakeRelation .quote_character )
140+ and identifier .endswith (SnowflakeRelation .quote_character ))
141+
129142 def _get_warehouse (self ) -> str :
130143 _ , table = self .execute ("select current_warehouse() as warehouse" , fetch = True )
131144 if len (table ) == 0 or len (table [0 ]) == 0 :
0 commit comments