Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

support for SQL route extension #2158

Closed
lalicw opened this issue Apr 4, 2019 · 3 comments
Closed

support for SQL route extension #2158

lalicw opened this issue Apr 4, 2019 · 3 comments

Comments

@lalicw
Copy link

lalicw commented Apr 4, 2019

Feature Request

we are using shardingsphere in our project, but we found there is no way to customize the sql route logic.

for example, there are only few tables using db sharding feature, so we don't want to parse the sql all the time, and we can set some thread local context to tell the sharding-jdbc layer current sql wish to use db sharding or not. so we suggest to add the ability to add extension for sql route logic that can use the context to decide which datasource to be used without parsing the sql.

Is your feature request related to a problem?

no

Describe the feature you would like.

sql route extension ability without parse the sql.

@wgy8283335
Copy link
Contributor

I'd like to take the issue. Which branch should I develop from, 4.0.0-RC1 ? @terrymanu

@wgy8283335
Copy link
Contributor

@lalicw. Hi, my friend. Could you make a example of setting context to use few tables?
Beacuse, we could set tables which to use sharding currently.
Parameters tables could configre only t_order and t_order_item will be sharded, as below:

dataSources:
  ds_0: !!org.apache.commons.dbcp.BasicDataSource
    driverClassName: com.mysql.jdbc.Driver
    url: jdbc:mysql://localhost:3306/demo_ds_0
    username: root
    password:
  ds_1: !!org.apache.commons.dbcp.BasicDataSource
    driverClassName: com.mysql.jdbc.Driver
    url: jdbc:mysql://localhost:3306/demo_ds_1
    username: root
    password:

shardingRule:  
  tables:
    t_order: 
      actualDataNodes: ds_${0..1}.t_order
      keyGeneratorColumnName: order_id
    t_order_item:
      actualDataNodes: ds_${0..1}.t_order_item
      keyGeneratorColumnName: order_item_id

@cherrylzhao
Copy link
Member

we can use hint-routing, please see hint-example

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants