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

feat: apply ModelTableExpr for SELECT query #975

Conversation

JunNishimura
Copy link
Contributor

Overview

This PR fixes #968.

The ModelTableExpr method in the existing implementation simply overwrites the table name in the FROM clause, but not the table name used as the column name prefix in the SELECT clause (such as SELECT users.name). Therefore, the Insert, Update, and Delete processes were fine, but the Select process was not working as expected.

What's changed

1. add Table Parser

Extract table names and aliases from queries passed as arguments to ModelTableExpr method.

2. Update columns builder of select query

Consider the table name specified in ModelTableExpr when constructing columns in the SELECT clause.

@vmihailenco
Copy link
Member

Some time ago we/I decided to not tackle this problem so we don't have to implement table parser.

While I appreciate the work, I still think that this library should not attempt to parse/manipulate SQL queries.

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

Successfully merging this pull request may close these issues.

inconsistent behavior for ModelTableExpr (select <--> create/insert/update/delete)
2 participants