oneslideicywater opened a new issue #13937:
URL: https://github.com/apache/shardingsphere/issues/13937


   ## Question
   
   Notice in the 
[example](https://github.com/apache/shardingsphere/blob/master/examples/shardingsphere-proxy-example/shardingsphere-proxy-boot-mybatis-example/src/main/resources/conf/config-sharding.yaml)
 that multiple table can have it's table-spliting inline algor, but share a 
common database-spliting inline algor.
   
   the drawback is that, if I use a default database strategy such as:
   
   ```yaml
     defaultDatabaseStrategy:
       standard:
         shardingColumn: user_id
         shardingAlgorithmName: database_inline
   
   ```
   
   then every logical table is this sharding-proxy instance should have a 
column `user_id`. otherwise,you'll encounter 
   errors when insert row into it. 
   
   ยท```bash
   sharding_db=> insert into 
t_employee(id,name,age,address,salary,deposit,birthday) 
values(479375,'WsfnVet6',33,'tSI8e1y5',841775.9513489738,723867.6766348411,'2012-05-28');
   ERROR:  Insert statement does not support sharding table routing to multiple 
data nodes.
   ```
   
   this error complains that I don't have a column `user_id` in table ` 
t_employee`,so sharding-proxy can't apply default database-spliting rules . but 
how can I explicitly set tables database-spliting rules? e.g. like that:
   
   ```yaml
   rules:
   - !SHARDING
     tables:
       t_order:
         actualDataNodes: ds_${0..1}.t_order_${0..3}
         tableStrategy:
           standard:
             shardingColumn: order_id
             shardingAlgorithmName: t_order_inline
         keyGenerateStrategy:
             column: order_id
             keyGeneratorName: snowflake
       t_employee:
         actualDataNodes: ds_${0..1}.t_employee_${0..3}
         tableStrategy:
           standard:
             shardingColumn: id
             shardingAlgorithmName: t_employee_inline
         defaultDatabaseStrategy:
           standard:
             shardingColumn: id
             shardingAlgorithmName: database_inline_employee
   ````
   
   
   
   


-- 
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]


Reply via email to