Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
MaxHalford committed Oct 31, 2023
1 parent 7385ba0 commit 36d50a6
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
2 changes: 1 addition & 1 deletion lea/app/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ def run(
console_log(f"{len(whitelist):,d} view(s) selected")

# Remove orphan views
for key in client.list_existing_view_names():
for key, (schema, table) in client.list_existing_view_names().items():
if key in dag:
continue
if not dry:
Expand Down
9 changes: 6 additions & 3 deletions lea/clients/duckdb.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,13 @@ def list_existing_view_names(self) -> list[tuple[str, str]]:
if self.is_motherduck:
database = self.path.split(":")[1]
query += f"\nWHERE table_catalog = '{database}'"
return [
(r["table_schema"], *r["table_name"].split(lea._SEP))
return {
(r["table_schema"], *r["table_name"].split(lea._SEP)): (
r["table_schema"],
r["table_name"],
)
for r in self.con.sql(query).df().to_dict(orient="records")
]
}

def get_tables(self):
query = """
Expand Down

0 comments on commit 36d50a6

Please sign in to comment.