You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2021/01/11 03:43:35 UTC
[GitHub] [shardingsphere] tristaZero commented on issue #8935: support "show sharding rule "
tristaZero commented on issue #8935:
URL: https://github.com/apache/shardingsphere/issues/8935#issuecomment-757609012
```yaml
rules:
- !SHARDING
tables:
t_order:
actualDataNodes: ds_${0..1}.t_order_${0..1}
tableStrategy:
standard:
shardingColumn: order_id
shardingAlgorithmName: t_order_inline
keyGenerateStrategy:
column: order_id
keyGeneratorName: snowflake
t_order_item:
actualDataNodes: ds_${0..1}.t_order_item_${0..1}
tableStrategy:
standard:
shardingColumn: order_id
shardingAlgorithmName: t_order_item_inline
keyGenerateStrategy:
column: order_item_id
keyGeneratorName: snowflake
bindingTables:
- t_order,t_order_item
defaultDatabaseStrategy:
standard:
shardingColumn: user_id
shardingAlgorithmName: database_inline
defaultTableStrategy:
none:
shardingAlgorithms:
database_inline:
type: INLINE
props:
algorithm-expression: ds_${user_id % 2}
t_order_inline:
type: INLINE
props:
algorithm-expression: t_order_${order_id % 2}
t_order_item_inline:
type: INLINE
props:
algorithm-expression: t_order_item_${order_id % 2}
keyGenerators:
snowflake:
type: SNOWFLAKE
props:
worker-id: 123
```
**Convert to**
```sql
name t_order
actualDataNodes ds_${0..1}.t_order_${0..1}
tableStrategy shardingColumn=order_id t_order_inline(algorithm-expression=t_order_${order_id % 2})
databaseStrategy shardingColumn=user_id database_inline(algorithm-expression=ds_${user_id % 2}))
keyGenerateStrategy column=order_id snowflake(worker-id=123)
bindingTable t_order_item
----
name t_order_item
actualDataNodes ds_${0..1}.t_order_item_${0..1}
tableStrategy shardingColumn=order_id t_order_item_inline(algorithm-expression=t_order_item_${order_id % 2})
databaseStrategy shardingColumn=user_id database_inline(algorithm-expression=ds_${user_id % 2}))
keyGenerateStrategy column=order_item_id snowflake(worker-id=123)
bindingTable t_order
```
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org