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

support INSERT INTO with SETTINGS #149

Open
senid231 opened this issue Jul 26, 2024 · 1 comment
Open

support INSERT INTO with SETTINGS #149

senid231 opened this issue Jul 26, 2024 · 1 comment

Comments

@senid231
Copy link

Version: 0.6.2

clickhouse guidelines suggests to use async_insert when inserting data 1 by 1, see https://clickhouse.com/docs/en/optimize/asynchronous-inserts

we need the possibility to send requests like

INSERT INTO YourTable SETTINGS async_insert=1, wait_for_async_insert=1 VALUES (...)

I've tried to prepend insert wth .settings(...) but it being ignored

>> ClickhouseActiverecord::VERSION
=> "0.6.2"
>> Clickhouse::SomeTable.settings(async_insert: 1, wait_for_async_insert: 1).create!(some_data: 123, timestamp: Time.current)
  Clickhouse Clickhouse::SomeTable Create (3.1ms)  INSERT INTO some_table (some_data, timestamp) VALUES (123, '2024-07-26 10:10:34')
=> #<Clickhouse::SomeTable:0x00007f36eecb3348 some_data: 123, timestamp: Fri, 26 Jul 2024 10:10:34.000000000 UTC +00:00>

as a workaround I've currently define these settings for ROLE but we should support such behaviour as well

@woodhull
Copy link

We're running a fork of the gem -- I'm not currently planning to turn this into a PR but we add a settings thread local for this:

daisychainapp@8baf903

Sharing in case that idea is useful for anyone else.

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

No branches or pull requests

2 participants