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

Added a config parameter auto.create.tables.replicated #345

Closed

Conversation

IlyaTsoi
Copy link
Contributor

Solution for #62. Added a config parameter auto.create.tables.replicated that controls replicated tables creation.
In this logic I use a separate config parameter use.replacingmergetree.is_deleted.column as a flag to manage tables creation. If true - use is_deleted column if supported, otherwise use _sign.

…s replicated tables creation.

In this logic I use a separate config parameter `use.replacingmergetree.is_deleted.column` as a flag to manage tables creation. If `true` - use `is_deleted` column if supported, otherwise use `_sign`.
@@ -75,12 +90,42 @@ public java.lang.String createTableSyntax(ArrayList<String> primaryKey, String t
//createTableSyntax.deleteCharAt(createTableSyntax.lastIndexOf(","));

// Append sign and version columns
createTableSyntax.append("`").append(SIGN_COLUMN).append("` ").append(SIGN_COLUMN_DATA_TYPE).append(",");
String DeleteColumnNameFinal = this.userDefinedDeleteColumnName;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

please use camel case for variables.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DeleteColumnNameFinal is not a constant, and it should not start with upper case.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, my bad, sorry)

createTableSyntax.append(")");
createTableSyntax.append(" ");
createTableSyntax.append("ENGINE = ReplacingMergeTree(").append(VERSION_COLUMN).append(")");
createTableSyntax.append("ENGINE = ");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please update unit tests in ClickHouseAutoCreateTableTest.

Илья Захаров (ilia.zakharov) and others added 2 commits October 26, 2023 00:49
@IlyaTsoi
Copy link
Contributor Author

In my environment I use Replicated engine for a autocreated database if auto.create.tables.replicated is true. It's the easiest way to replicate DDL without adding ON CLUSTER clause in queries. I can add this feature by PR too. @subkanthi, what do you think about it?

@subkanthi
Copy link
Collaborator

This feature was implemented as part of other PRs , closing this for now.

@subkanthi subkanthi closed this Jul 31, 2024
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

Successfully merging this pull request may close these issues.

2 participants