Skip to content

Archer.li/feature/issue 365#366

Open
csrgxtu wants to merge 1 commit intoflike:masterfrom
csrgxtu:archer.li/feature/issue-365
Open

Archer.li/feature/issue 365#366
csrgxtu wants to merge 1 commit intoflike:masterfrom
csrgxtu:archer.li/feature/issue-365

Conversation

@csrgxtu
Copy link
Copy Markdown

@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
Copy Markdown
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