Skip to content

Commit

Permalink
Remove caching unnecessary functions and use default_schema
Browse files Browse the repository at this point in the history
  • Loading branch information
sfc-gh-jvasquezrojas committed Dec 9, 2024
1 parent ad326dc commit a05a87c
Showing 1 changed file with 3 additions and 10 deletions.
13 changes: 3 additions & 10 deletions src/snowflake/sqlalchemy/snowdialect.py
Original file line number Diff line number Diff line change
Expand Up @@ -685,12 +685,10 @@ def get_prefixes_from_data(self, n2i, row, **kw):
@reflection.cache
def _get_schema_tables_info(self, connection, schema=None, **kw):
"""
Gets all table names.
Retrieves information about all tables in the specified schema.
"""

schema = schema or self.default_schema_name
_, default_schema = self._current_database_schema(connection, **kw)
schema = schema or default_schema
result = connection.execute(
text(
f"SHOW /* sqlalchemy:get_schema_tables_info */ TABLES IN SCHEMA {self._denormalize_quote_join(schema)}"
Expand All @@ -706,7 +704,6 @@ def _get_schema_tables_info(self, connection, schema=None, **kw):

return tables

@reflection.cache
def get_table_names(self, connection, schema=None, **kw):
"""
Gets all table names.
Expand Down Expand Up @@ -766,9 +763,7 @@ def get_view_definition(self, connection, view_name, schema=None, **kw):
return None

def get_temp_table_names(self, connection, schema=None, **kw):
_, default_schema = self._current_database_schema(connection, **kw)

schema = schema or default_schema
schema = schema or self.default_schema_name
cursor = connection.execute(
text(
f"SHOW /* sqlalchemy:get_temp_table_names */ TABLES \
Expand Down Expand Up @@ -855,7 +850,6 @@ def get_table_comment(self, connection, table_name, schema=None, **kw):
)
}

@reflection.cache
def get_table_names_with_prefix(
self,
connection,
Expand All @@ -882,8 +876,7 @@ def get_multi_indexes(
"""
Gets the indexes definition
"""
_, default_schema = self._current_database_schema(connection, **kw)
schema = schema or default_schema
schema = schema or self.default_schema_name
hybrid_table_names = self.get_table_names_with_prefix(
connection,
schema=schema,
Expand Down

0 comments on commit a05a87c

Please sign in to comment.