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

Multi-table query left join lookup table #32648

Closed
wangjianxin323 opened this issue Aug 23, 2024 · 2 comments
Closed

Multi-table query left join lookup table #32648

wangjianxin323 opened this issue Aug 23, 2024 · 2 comments

Comments

@wangjianxin323
Copy link

this is my config:
dataSources:
ds0:
driverClassName: com.mysql.jdbc.Driver
jdbcUrl: jdbc:mysql://127.0.0.1:3306/sdbilling2?useSSL=true&allowPublicKeyRetrieval=true&socketTimeout=60000&connectTimeout=60000&useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai&rewriteBatchedStatements=true&autoReconnect=true
username: root
password: '123123FFFfff'
dataSourceClassName: com.zaxxer.hikari.HikariDataSource
connectionTimeout: 60000
props:
sql-show: show
rules:

  • !SHARDING
    shardingAlgorithms:
    table-5:
    type: HASH_MOD
    props:
    sharding-count: 5
    table-10:
    type: HASH_MOD
    props:
    sharding-count: 10
    table-20:
    type: HASH_MOD
    props:
    sharding-count: 20
    defaultTableStrategy:
    none:
    autoTables:
    iotcard_proxy_card:
    actualDataSources: ds0
    shardingStrategy:
    standard:
    shardingAlgorithmName: table-10
    shardingColumn: user_id
    iotcard_user_rate:
    actualDataSources : ds0
    shardingStrategy:
    standard:
    shardingAlgorithmName: table-10
    shardingColumn: user_id
    iotcard_user_order:
    actualDataSources : ds0
    shardingStrategy:
    standard:
    shardingAlgorithmName: table-10
    shardingColumn: user_id
    iotcard_customer_consume:
    actualDataSources : ds0
    shardingStrategy:
    standard:
    shardingAlgorithmName: table-10
    shardingColumn: member_id
    iotcard_card_balance_log:
    actualDataSources : ds0
    shardingStrategy:
    standard:
    shardingAlgorithmName: table-10
    shardingColumn: card_id
    iotcard_flow_order_log:
    actualDataSources : ds0
    shardingStrategy:
    standard:
    shardingAlgorithmName: table-10
    shardingColumn: order_id
    iotcard_fund_change:
    actualDataSources : ds0
    shardingStrategy:
    standard:
    shardingAlgorithmName: table-10
    shardingColumn: agent_id
    iotcard_card_relation_user:
    actualDataSources : ds0
    shardingStrategy:
    standard:
    shardingAlgorithmName: table-10
    shardingColumn: present_user_id
    iotcard_card_flow:
    actualDataSources : ds0
    shardingStrategy:
    standard:
    shardingAlgorithmName: table-20
    shardingColumn: card_id
    iotcard_day_flow:
    actualDataSources : ds0
    shardingStrategy:
    standard:
    shardingAlgorithmName: table-20
    shardingColumn: card_id

and this is my sql:
SELECT COUNT(*) AS total FROM iotcard_user_rate a JOIN iotcard_package b ON a.package_id = b.id JOIN iotcard_package_group c ON b.pack_group_id = c.id WHERE 1 = 1 AND a.user_id = ? AND c.id = ? AND a.up_user_id = ?

Among them iotcard_user_rate I set the sharding,iotcard_package is a single table.

the error is
Cause: org.apache.shardingsphere.infra.exception.kernel.metadata.TableNotFoundException: Table or view 'iotcard_package' does not exist.
But this table exists in my database.

Can you help me find out what's causing it?
My version is 5.5.0

@terrymanu
Copy link
Member

Is iotcard_package a single table?

Copy link

github-actions bot commented Sep 8, 2024

There hasn't been any activity on this issue recently, and in order to prioritize active issues, it will be marked as stale.

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

2 participants