-
Notifications
You must be signed in to change notification settings - Fork 10
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
Add view list for metadata getTables method #262
Conversation
@@ -889,6 +886,20 @@ public ResultSet getTables(String catalog, String schemaPattern, String tableNam | |||
buildFilters(sql, filters); | |||
sql.append("\nORDER BY table_type, table_catalog, table_schema, table_name"); | |||
|
|||
if (types == null || types.length == 0 || Arrays.stream(types).allMatch(t -> t.equalsIgnoreCase("VIEW"))) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
IMHO, using table
as the default table type is better and has much better compatibility。
I think views will be listed with latest Databend, they were incorrectly excluded from the information_schema.tables at one point: databendlabs/databend#16039 |
@rad-pat Aha,thanks for reminding. This pr databendlabs/databend#16058 has made |
@hantmac |
@cdmikechen Maybe we can use |
I think that on current, or older versions where the bug does not exist, the user will get 2 views returned, one from the table query and one from the view query. The test in this PR is not accurate, it only tests that at least one view is returned. In the SQLAlchemy library, I had to allow for the bug in certain versions: https://github.com/datafuselabs/databend-sqlalchemy/blob/3226f10e0f8b6aa85185208583977037b33ec99f/databend_sqlalchemy/databend_dialect.py#L819 |
There is a condition https://github.com/datafuselabs/databend-jdbc/pull/262/files#diff-edd43fca3337c0ab2e0fa92af785f7021454a5485f2aea20e11b73fc50ae51d4R889, only if the |
I'll be reworking the codes this week to make it as compatible and adaptable as possible with different versions of databend. |
@cdmikechen Hi bro , what's the pr progressing? |
@hantmac |
498a504
to
1f04cb7
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Linked issue: #261