sivaraman-27 commented on issue #28733: URL: https://github.com/apache/shardingsphere/issues/28733#issuecomment-1761308769
_Thank you for your example. I think you can use SQL Hint for sharding. For orders, order_details, order_ratings, **you can specify shard_no** in the way of SQL comments when querying, and include order_id in the sql condition. SQL Hint completes the routing of the table, and order_id filters the data. You can refer this doc - https://shardingsphere.apache.org/document/current/en/user-manual/common-config/sql-hint/ to use sql hint._ ___ Hi @strongduanmu, I have a doubt, if I use 'SQL Hint', then is 'shard_no' (see highlighted text above sent by you) the corresponding datasource name specified in the 'yaml.file'? **Example:** I want to know the amount for order_id = 1, then I do the below query ```html /* SHARDINGSPHERE_HINT: SHARDING_DATABASE_VALUE="datasource_1" */ select amount from orders where order_id = 1; ``` Then I specify **datasource_1 as below in 'yaml.config'** file (Or use Java for dynamic updations) ```python dataSources : ds 0: dataSourceC1assName: com.zaxxer.hikari.HikariDataSource driverC1assName: com.mysql.jdbc.Driver jdbcUr1: ***************** I specify hostname of shard_no = 1 ***************************************** server Timezone=UTC&useSSL=fa1se&useUnicode=true&characterEncoding=UTF-8 username: -- password : -- ``` -- 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]
