Skip to content

Commit

Permalink
Fixing list_schemas so that we stop trying to create schemas that exi…
Browse files Browse the repository at this point in the history
…st (#529)
  • Loading branch information
benc-db authored Dec 8, 2023
2 parents 004ca00 + e67f78d commit bb4abb4
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions dbt/adapters/databricks/connections.py
Original file line number Diff line number Diff line change
Expand Up @@ -1179,12 +1179,19 @@ def _execute_cursor(
cursor.close()

def list_schemas(self, database: str, schema: Optional[str] = None) -> Table:
database = database.strip("`")
if schema:
schema = schema.strip("`")
return self._execute_cursor(
f"GetSchemas(database={database}, schema={schema})",
lambda cursor: cursor.schemas(catalog_name=database, schema_name=schema),
)

def list_tables(self, database: str, schema: str, identifier: Optional[str] = None) -> Table:
database = database.strip("`")
schema = schema.strip("`")
if identifier:
identifier = identifier.strip("`")
return self._execute_cursor(
f"GetTables(database={database}, schema={schema}, identifier={identifier})",
lambda cursor: cursor.tables(
Expand Down

0 comments on commit bb4abb4

Please sign in to comment.