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

Can we specify some specific database operations without parsing through the shardingsphere framework #4953

Closed
phoema opened this issue Mar 26, 2020 · 6 comments

Comments

@phoema
Copy link

phoema commented Mar 26, 2020

Question

We used shardingsphere v5.0.0

There may be some instability now. We want to go around

When we use shardingsphere framework for sub database

Can we specify some specific database operations without parsing through the shardingsphere framework?

Some places are uncontrollable. We hope to directly perform DB operations through mybatis instead of shardingsphere,

@kimmking
Copy link
Member

Question

We used shardingsphere v5.0.0

There may be some instability now. We want to go around

When we use shardingsphere framework for sub database

Can we specify some specific database operations without parsing through the shardingsphere framework?

Some places are uncontrollable. We hope to directly perform DB operations through mybatis instead of shardingsphere,

I misunderstand Some places are uncontrollable.
Can you show a certain case?

@phoema
Copy link
Author

phoema commented Mar 26, 2020

example:
we have some complex sqls like
many join tables and with functions
but now shardingsphere Support not well, so we want to go around
only excute the sql with out shardingsphere parse。
is have any way to do this?
func_inc_var_session is our customer function
select func_inc_var_session(t.procinsid,t.task_def_key,0) AS rownum,....
from ((((act_hi_taskinst a left join act_hi_procinst on((a.PROC_INST_ID_ = act_hi_procinst.ID_))) left join flow_extend on((act_hi_procinst.BUSINESS_KEY_ = flow_extend.id))) left join case_info on((flow_extend.case_id = case_info.id))) left join flow_define on((flow_extend.flow_def_id = flow_define.id))) where (a.ASSIGNEE_ is not null) order by a.PROC_INST_ID_,a.TASK_DEF_KEY_,a.START_TIME_ desc) t join (select func_inc_var_session(NULL,NULL,1) AS func_inc_var_session(null,null,1)) b)

@phoema
Copy link
Author

phoema commented Mar 26, 2020

when we excute this sql
shardingsphere can not know which database can excute
so it excute with default database
but we want to excute a special tenant

@terrymanu
Copy link
Member

terrymanu commented Mar 26, 2020

No. SQL parser is the basic workflow with ShardingSphere. It is unnecessary to use ShardingSphere if user do not need SQL parser. It is the production design with ShardingSphere.
So user may do not use ShardingSphere if the requirement without SQL parser.
ShardingSphere is not the only way to process business logic in the middle layer.

Even the SQL parser is not perfect for now, we still need to do the SQL parse.
The project is still in dev mode, so we need to continue to improve the SQL parser engine.

@kimmking
Copy link
Member

Configure two DataSource, one is ShardingDataSource of ShardingSphere, one is a native DataSource of Hikari or Druid.

Inject the first one when you want to sharding databases&tables.
Inject the following one when you want to directly pass through native sql.

@phoema
Copy link
Author

phoema commented Mar 26, 2020

Configure two DataSource, one is ShardingDataSource of ShardingSphere, one is a native DataSource of Hikari or Druid.

Inject the first one when you want to sharding databases&tables.
Inject the following one when you want to directly pass through native sql.

I will try it.
thanks!

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

3 participants