Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(get_view_names): Use proper schema #1082

Merged
merged 7 commits into from
Sep 4, 2024
Merged

Conversation

philipuvarov
Copy link
Contributor

@philipuvarov philipuvarov commented Aug 17, 2024

Hey @Mause ! Thanks for this lib :)

When working with it to wire DuckDB to Superset I have noticed that Superset does not display views created in the DuckDB.

The problem was that get_view_names was using raw table_schema in the WHERE clause, which in case of Superset includes database name, so it becomes something like foodb.barschema. Which means that the WHERE clause in the function to get the view names never succeeds, as it tries to compare table_name to a string that includes database name.

get_table_names uses _build_query_where function that splits database and schema name, so to fix the bug I have used the same approach that _build_query_where function uses to split the schema and db name. We can't really _build_query_where function itself because of how the naming difference(in information_schema.tables schema field is named table_schema and not schema_name as it is named in the duckdb_tables() or duckdb_views()).

I also initially tried using duckdb_views() but that one returns all system views as well, which we don't really need

Copy link

🤖 I detect that the PR title and the commit message differ and there's only one commit. To use the PR title for the commit history, you can use Github's automerge feature with squashing, or use automerge label. Good luck human!

-- conventional-commit-lint bot
https://conventionalcommits.org/

@philipuvarov philipuvarov marked this pull request as ready for review August 24, 2024 13:35
@philipuvarov
Copy link
Contributor Author

@Mause I am not sure I understand CI failures here 🤔 could you take a look?

@philipuvarov
Copy link
Contributor Author

@Mause bump

@Mause Mause enabled auto-merge (squash) September 4, 2024 10:36
@Mause Mause disabled auto-merge September 4, 2024 10:36
@Mause Mause merged commit d5319c8 into Mause:main Sep 4, 2024
8 of 9 checks passed
@Mause
Copy link
Owner

Mause commented Sep 4, 2024

Thanks! This has now been released in 0.13.2

Also sorry for the delay 😬

@philipuvarov
Copy link
Contributor Author

@Mause no worries! Again, thanks a lot for the lib :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants