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

Getting table or view doesnt exists exception #34456

Open
rsingh0015 opened this issue Jan 23, 2025 · 2 comments
Open

Getting table or view doesnt exists exception #34456

rsingh0015 opened this issue Jan 23, 2025 · 2 comments

Comments

@rsingh0015
Copy link

rsingh0015 commented Jan 23, 2025

Question

ShardingSphere-jdbc: 5.5.2
YAML

`dataSources:
ds0:
dataSourceClassName: com.zaxxer.hikari.HikariDataSource
driverClassName: org.postgresql.Driver
jdbcUrl: jdbc:postgresql://postgres:5432/rug?currentSchema=test_schema
username: test
password: password
maxPoolSize: 2
minPoolSize: 2
ds1:
dataSourceClassName: com.zaxxer.hikari.HikariDataSource
driverClassName: org.postgresql.Driver
jdbcUrl: jdbc:postgresql://postgres:5432/rug?currentSchema=test_schema
username: test
password: password
maxPoolSize: 2
minPoolSize: 2

rules:

  • !SHARDING
    tables:
    table_one:
    actualDataNodes: ds${0..1}.table_one
    table_one:
    actualDataNodes: ds${0..1}.table_twp
    defaultDatabaseStrategy:
    standard:
    shardingColumn: cycle_code
    shardingAlgorithmName: database_inline
    defaultTableStrategy:
    none:
    shardingAlgorithms:
    database_inline:
    type: INLINE
    props:
    algorithm-expression: ds${ if (cycle_code as Integer >= 1 && cycle_code as Integer < 58) {return 1} else {return 0}}
    props:
    sql-show: true`

Exception
Caused by: org.apache.shardingsphere.infra.exception.kernel.metadata.TableNotFoundException: Table or view 'table_one' does not exist. 2025-01-23 12:21:01 at org.apache.shardingsphere.infra.binder.engine.segment.dml.from.type.SimpleTableSegmentBinder.lambda$checkTableExists$12(SimpleTableSegmentBinder.java:178) 2025-01-23 12:21:01 at org.apache.shardingsphere.infra.exception.core.ShardingSpherePreconditions.checkState(ShardingSpherePreconditions.java:44) 2025-01-23 12:21:01 at org.apache.shardingsphere.infra.binder.engine.segment.dml.from.type.SimpleTableSegmentBinder.checkTableExists(SimpleTableSegmentBinder.java:178) 2025-01-23 12:21:01 at org.apache.shardingsphere.infra.binder.engine.segment.dml.from.type.SimpleTableSegmentBinder.bind(SimpleTableSegmentBinder.java:90) 2025-01-23 12:21:01 at org.apache.shardingsphere.infra.binder.engine.segment.dml.from.TableSegmentBinder.bind(TableSegmentBinder.java:57) 2025-01-23 12:21:01 at org.apache.shardingsphere.infra.binder.engine.statement.dml.SelectStatementBinder.lambda$bind$1(SelectStatementBinder.java:64) 2025-01-23 12:21:01 at java.base/java.util.Optional.map(Optional.java:260) 2025-01-23 12:21:01 at org.apache.shardingsphere.infra.binder.engine.statement.dml.SelectStatementBinder.bind(SelectStatementBinder.java:64) 2025-01-23 12:21:01 at org.apache.shardingsphere.infra.binder.engine.type.DMLStatementBindEngine.bind(DMLStatementBindEngine.java:61) 2025-01-23 12:21:01 at org.apache.shardingsphere.infra.binder.engine.SQLBindEngine.bindSQLStatement(SQLBindEngine.java:68) 2025-01-23 12:21:01 at org.apache.shardingsphere.infra.binder.engine.SQLBindEngine.bind(SQLBindEngine.java:58) 2025-01-23 12:21:01 at org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement.<init>(ShardingSpherePreparedStatement.java:143) 2025-01-23 12:21:01 at org.apache.shardingsphere.driver.jdbc.core.statement.ShardingSpherePreparedStatement.<init>(ShardingSpherePreparedStatement.java:115) 2025-01-23 12:21:01 at org.apache.shardingsphere.driver.jdbc.core.connection.ShardingSphereConnection.prepareStatement(ShardingSphereConnection.java:108) 2025-01-23 12:21:01 at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$5.doPrepare(StatementPreparerImpl.java:153) 2025-01-23 12:21:01 at org.hibernate.engine.jdbc.internal.StatementPreparerImpl$StatementPreparationTemplate.prepareStatement(StatementPreparerImpl.java:183)

@rsingh0015 rsingh0015 changed the title Getting table or view doesnt exists exception during select Getting table or view doesnt exists exception Jan 23, 2025
@rsingh0015
Copy link
Author

I have same tables in both databases and want to do only db sharding

@terrymanu
Copy link
Member

How to reproduce it?

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