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

Set column options codec #46

Open
encodedrose opened this issue Nov 4, 2023 · 0 comments
Open

Set column options codec #46

encodedrose opened this issue Nov 4, 2023 · 0 comments

Comments

@encodedrose
Copy link

encodedrose commented Nov 4, 2023

Problem: Creating a column with a codec type throws an error.

Migration Repro:

    ClickHouse.connection.create_table('visits', engine: 'MergeTree ORDER BY date') do |t|
      t.Date     :date, compression_codec: 'CODEC(DoubleDelta, ZSTD(1))'
    end

Error:

Caused by:
NoMethodError: undefined method `compression_codec=' for #<ClickHouse::Definition::Column:0x0000000105b5abe8 @type="Date", @name=:date, @extensions=[{:compression_codec=>"CODEC(DoubleDelta, ZSTD(1))"}]> (NoMethodError)

        params.each { |k, v| public_send("#{k}=", v) }
                             ^^^^^^^^^^^

In addition to compression_codec, trying to use: compression:, codec:, and codec_expression: all failed.

I was able to work around the issue by using raw SQL.

    ClickHouse.connection.create_table('visits', engine: 'MergeTree ORDER BY date') do |t|
      t << "date Date CODEC(DoubleDelta, ZSTD(1))"
    end

It'd be great feature to have this as supported for DSL statements.

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

1 participant