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 2020/04/19 06:20:45 UTC
[GitHub] [shardingsphere] fengyunhe opened a new issue #5231: How to use the columns of the parent table to configure the child table fragments ?
fengyunhe opened a new issue #5231: How to use the columns of the parent table to configure the child table fragments ?
URL: https://github.com/apache/shardingsphere/issues/5231
## Question
If there is no user_id column in my order_item table, but there is a user_id column in the corresponding order table, and order_id in order_item corresponds to the id in order, how can I configure the user_id column to fragment the order_item table?
```yaml
shardingRule:
tables:
category:
actualDataNodes: ds${4..6}.category
user:
actualDataNodes: ds${4..6}.user
databaseStrategy:
inline:
shardingColumn: id
algorithmExpression: ds${id%3+3}
order:
actualDataNodes: ds${4..6}.order${0..1}
databaseStrategy:
inline:
shardingColumn: user_id
algorithmExpression: ds${user_id%3+3}
tableStrategy:
inline:
shardingColumn: id
algorithmExpression: order${id%2}
keyGenerator:
type: SNOWFLAKE
column: id
order_item:
actualDataNodes: ds${4..6}.order_item${0..1}
databaseStrategy:
inline:
shardingColumn: user_id
algorithmExpression: ds${user_id%3+3}
tableStrategy:
inline:
shardingColumn: id
algorithmExpression: order_item${order_id%2}
bindingTables:
- user,order,order_item
broadcastTables:
- category
```
----------------------------------------------------------------
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
With regards,
Apache Git Services
[GitHub] [shardingsphere] kimmking commented on issue #5231: How to use the columns of the parent table to configure the child table fragments ?
Posted by GitBox <gi...@apache.org>.
kimmking commented on issue #5231: How to use the columns of the parent table to configure the child table fragments ?
URL: https://github.com/apache/shardingsphere/issues/5231#issuecomment-616129407
It must be a 'sharding key column' in a sharding table.
----------------------------------------------------------------
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
With regards,
Apache Git Services