databendlabs / databend-jdbc

jdbc implementation for databend cloud
Apache License 2.0
11 stars 10 forks source link

Add view list for metadata getTables method #262

Closed cdmikechen closed 2 weeks ago

cdmikechen commented 2 months ago

Linked issue: https://github.com/datafuselabs/databend-jdbc/issues/261

rad-pat commented 2 months ago

I think views will be listed with latest Databend, they were incorrectly excluded from the information_schema.tables at one point: https://github.com/datafuselabs/databend/issues/16039

hantmac commented 2 months ago

I think views will be listed with latest Databend, they were incorrectly excluded from the information_schema.tables at one point: datafuselabs/databend#16039

@rad-pat Aha,thanks for reminding. This pr https://github.com/datafuselabs/databend/pull/16058 has made table and view both in information_scham.tables.

cdmikechen commented 2 months ago

@hantmac I use databend v1.2.538-nightly. Does it mean I need to update databend to lastest version?

hantmac commented 2 months ago

@hantmac I use databend v1.2.538-nightly. Does it mean I need to update databend to lastest version?

@hantmac I use databend v1.2.538-nightly. Does it mean I need to update databend to lastest version?

@cdmikechen Maybe we can use table as default type and merge this pr. It will back capability. Some users do not want to upgrade databend. What do you think ?

rad-pat commented 2 months ago

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

hantmac commented 2 months ago

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 type == view the SQL will return from view query.

cdmikechen commented 2 months ago

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 type == view the SQL will return from view query.

I'll be reworking the codes this week to make it as compatible and adaptable as possible with different versions of databend.

hantmac commented 1 month ago

@cdmikechen Hi bro , what's the pr progressing?

cdmikechen commented 1 month ago

@hantmac I'm sorry things have been a little busy lately. I will try to take care of this pr when I have time recently.