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

Add support for ON CLUSTER in Clickhouse while creating table #7349

Open
shrinidhi111 opened this issue Jan 21, 2025 · 0 comments
Open

Add support for ON CLUSTER in Clickhouse while creating table #7349

shrinidhi111 opened this issue Jan 21, 2025 · 0 comments
Assignees
Labels
type:feature_request feature request

Comments

@shrinidhi111
Copy link

Describe the feature

Right now, gorm support AutoMigrate for clickhouse along with creating a table if it does not currently exists. But it cannot create cluster tables

Motivation

Although it is not an issue for development environments, while deploying to production most tables would be replicated.

The gorm:table_options appends values to the create table command. But in clickhouse the ON CLUSTER should be along with the create table command before the attributes and options are defined

What gorm does

CREATE TABLE `test_table`(`eventName` String,`datetime` DateTime64(3),`id` String) ON CLUSTER 'clustername'  ENGINE ReplicatedMergeTree ORDER BY datetime

What it is supposed to do

CREATE TABLE `test_table` ON CLUSTER 'clustername' (`eventName` String,`datetime` DateTime64(3),`id` String)  ENGINE ReplicatedMergeTree ORDER BY datetime

Code

ck.testTable.Set("gorm:table_options", "ON CLUSTER '"+clusterName+"' ENGINE ReplicatedMergeTree ORDER BY (datetime)").AutoMigrate(&TestStruct{})```

Related Issues

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

No branches or pull requests

2 participants