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

How to insert comment or fragment in sql? #244

Open
canuran opened this issue May 31, 2023 · 3 comments
Open

How to insert comment or fragment in sql? #244

canuran opened this issue May 31, 2023 · 3 comments

Comments

@canuran
Copy link

canuran commented May 31, 2023

Such as select name from user /* shard_id=1 */ where name like 'can%', the shard_id comment is to tell the database proxy how to route to the sharded database.

Suggest: SELECT(User.Name).FROM(User).FRAG(FRAG("/* shard_id=1 */").BeforeWhere()).WHERE(...)

@go-jet
Copy link
Owner

go-jet commented Jun 3, 2023

Hi @canuran
Can you use optimizer hints instead?

@canuran
Copy link
Author

canuran commented Jun 7, 2023

Hi @canuran Can you use optimizer hints instead?

It seems impossible, optimizer_hints can only be used for mysql and the format is fixed, not suitable for prompting db proxy.

@houten11
Copy link

What database proxy are you using? Does a comment have to appear at a specific position inside the statement?

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