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

Archer.li/feature/issue 365 #366

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

csrgxtu
Copy link

@csrgxtu csrgxtu commented Aug 22, 2017

What

Let kingshard support following table name format:

table_name_xxxxxxxx
table_name_%0nd # n can be any int number

Why

Now kingshard only supports following table name format:

table_name_%04d
table_name_0000

but in some case, we have following table name format:

table_name_%0nd
table_name_00000001

How

when kingshard tries to rewrite the sql statements, default is using %04d, here i use %0nd, n is the value configured in ks.yaml, here is a sample config:

# schema defines sharding rules, the db is the sharding table database.
schema :
    nodes: [node1]
    default: node1
    shard:
    -
        db : db
        table: tbl
        key: userid
        nodes: [node1]
        type: hash
        locations: [1000]
        table_name_post_fix_length: 8 # if you dont set here, will use default 4, i.e tbl_name_0000

set default table_name_postfix

refactor
@csrgxtu
Copy link
Author

csrgxtu commented Aug 22, 2017

will travis run a test on the code? hummmm, seems awesome and convinient.

@csrgxtu csrgxtu mentioned this pull request Aug 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant