RaigorJiang opened a new issue #14830: URL: https://github.com/apache/shardingsphere/issues/14830
Hi community, Currently, the way to configure the `key generate strategy` in DistSQL is different from the Java API and YAML: - In the [Java API](https://shardingsphere.apache.org/document/current/en/user-manual/shardingsphere-jdbc/java-api/rules/sharding/#sharding-table-configuration), use `setKeyGenerateStrategy()`; - In [YAML](https://shardingsphere.apache.org/document/current/en/user-manual/shardingsphere-jdbc/yaml-config/rules/sharding/), use `keyGenerateStrategy`; - In [DistSQL](https://shardingsphere.apache.org/document/current/en/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/sharding/), `GENERATED_KEY` is used; The keyword `GENERATED_KEY` affects the uniformity of the configuration. \ So I recommend adjusting the keyword in the DistSQL syntax, to `KEY_GENERATE_STRATEGY`, just like `TABLE_STRATEGY`. #### Before ```sql CREATE SHARDING TABLE RULE t_order ( RESOURCES(resource_0,resource_1), SHARDING_COLUMN=order_id,TYPE(NAME=hash_mod,PROPERTIES("sharding-count"=4)), GENERATED_KEY(COLUMN=another_id,TYPE(NAME=snowflake,PROPERTIES("worker-id"=123))) ); ``` #### After ```sql CREATE SHARDING TABLE RULE t_order ( RESOURCES(resource_0,resource_1), SHARDING_COLUMN=order_id,TYPE(NAME=hash_mod,PROPERTIES("sharding-count"=4)), KEY_GENERATE_STRATEGY(COLUMN=another_id,TYPE(NAME=snowflake,PROPERTIES("worker-id"=123))) ); ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
