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

does gorm sharding support JOIN ? #126

Open
nankingrider opened this issue Aug 23, 2023 · 5 comments
Open

does gorm sharding support JOIN ? #126

nankingrider opened this issue Aug 23, 2023 · 5 comments
Assignees

Comments

@nankingrider
Copy link

Your Question

in project when i use gorm sharding and my SQL contains JOIN, like A.col1, B.col2
the query will fail. the query trys to find the main table instead of sub table

The document you expected this should be explained

Expected answer

any help ? thanks

@nankingrider
Copy link
Author

image use a.col in sql in select section not from section , found that table name not replaces by sub table name

@nankingrider
Copy link
Author

image in join sql , here stmt.fromItems's type is func (*JoinClause) source(), not func (*TableName) source()

so currently , no join sql can be processed correctly

@jiekun
Copy link

jiekun commented Oct 10, 2023

We've done it couple years ago. check it here: #15
This repo aims to support both PG and MySQL. So it cannot be merged.

@steve-hb
Copy link

steve-hb commented Nov 8, 2023

I just looked at the before mentioned PR and started looking for alternatives to sqlparser, but I can't find one actively maintained. Also I just looked into gorm and found gorm to build everything itself. Do I miss/not find something?

@jiekun
Copy link

jiekun commented Nov 8, 2023

I just looked at the before mentioned PR and started looking for alternatives to sqlparser, but I can't find one actively maintained. Also I just looked into gorm and found gorm to build everything itself. Do I miss/not find something?

Just try https://github.com/pingcap/parser . BTW I think a SQL parser doesn't need to be updated frequently. It should just remain as stable as possible.

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

No branches or pull requests

4 participants