Skip to content

Commit

Permalink
fix: list schema = flink list database
Browse files Browse the repository at this point in the history
  • Loading branch information
zqWu committed Mar 14, 2023
1 parent e3550f9 commit a69e843
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion dbt/adapters/flink/impl.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ def get_relation(self, database: str, schema: str, identifier: str) -> Optional[
return rel

def list_schemas(self, database: str) -> List[str]:
return self.connections.show_catalogs()
return self.connections._show_databases(database)

@classmethod
def quote(cls, identifier: str) -> str:
Expand Down
6 changes: 4 additions & 2 deletions flink/sqlgateway/schema_operations.py
Original file line number Diff line number Diff line change
Expand Up @@ -97,8 +97,10 @@ def show_databases(session: SqlGatewaySession, catalog: str) -> List[str]:
need_switch_catalog = True

if need_switch_catalog:
if SchemaOperation.use_catalog_database(session, catalog):
raise RuntimeError(f"fail query database in {catalog}, please check catalog {catalog} exists")
try:
SchemaOperation.use_catalog_database(session, catalog)
except Exception as e:
raise RuntimeError(f"fail list database in {catalog}, please check {catalog} exists in this session")
dbs = SchemaOperation.show_xxx(session, sql_show_databases)

# switch back database if necessary
Expand Down

0 comments on commit a69e843

Please sign in to comment.