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

FINAL modifier #384

Open
jmerchantmetrics opened this issue Aug 10, 2024 · 4 comments
Open

FINAL modifier #384

jmerchantmetrics opened this issue Aug 10, 2024 · 4 comments
Labels
enhancement New feature or request

Comments

@jmerchantmetrics
Copy link

Is your feature request related to a problem? Please describe.
When using replacingMergeTree and some other tables in clickhouse, you need to use the FINAL modifier to dedupe the results that hasn't been garbage collected yet. (ex. SELECT * FROM tbl FINAL WHERE id = 1) is there any way to do this without creating a custom dataset or view?

@jmerchantmetrics jmerchantmetrics added the enhancement New feature or request label Aug 10, 2024
@genzgd
Copy link
Collaborator

genzgd commented Aug 10, 2024

I assume you're talking about within Superset? The main client query methods in clickhouse-connect accept whatever SQL query (including a FINAL modifier) you specify. Note that we don't recommend using the minimal clickhouse-connect SQLAlchemy dialect outside of Superset.

Within Superset I could see setting a flag somehow to always specify a FINAL modifier for ReplacingMergeTree queries. We'll look into that as time and resources permit. And of course, community contributions to either the SQLAlchemy dialect in clickhouse-connect or the Superset ClickHouse Engine Spec are more than welcome.

@jmerchantmetrics
Copy link
Author

I assume you're talking about within Superset? The main client query methods in clickhouse-connect accept whatever SQL query (including a FINAL modifier) you specify. Note that we don't recommend using the minimal clickhouse-connect SQLAlchemy dialect outside of Superset.

Within Superset I could see setting a flag somehow to always specify a FINAL modifier for ReplacingMergeTree queries. We'll look into that as time and resources permit. And of course, community contributions to either the SQLAlchemy dialect in clickhouse-connect or the Superset ClickHouse Engine Spec are more than welcome.

Do you know how i could manually code in the FINAL modifier in to superset, i am using clickhouse-connect in superset and cant seem to figure out how to do it.

@genzgd
Copy link
Collaborator

genzgd commented Aug 11, 2024

Unfortunately I'm not aware of any way to pass such a modifier with the current versions of Superset and clickhouse-connect (or with clickhouse-driver and clickhouse-sqlalchemy, for that matter). Others more familiar with Superset might have an idea.

As I mentioned above, we'll look into the necessary code changes to support this in the future, although I can't give any time estimate.

@franz101
Copy link

Is your feature request related to a problem? Please describe. When using replacingMergeTree and some other tables in clickhouse, you need to use the FINAL modifier to dedupe the results that hasn't been garbage collected yet. (ex. SELECT * FROM tbl FINAL WHERE id = 1) is there any way to do this without creating a custom dataset or view?

SETTINGS final=1
for sqlalchemy
or execution_options(settings=dict(final=1))

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

No branches or pull requests

3 participants