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

Update sql strings with sea_query sql statements #3959

Merged
merged 1 commit into from
Oct 28, 2023

Conversation

kamalesh0406
Copy link
Contributor

Description

This PR is a draft version to kickstart #3758. I used sea_query to update one sql query and I want to get the initial comments from @guilload on whether this is fine. If the sea_query implementation seems good, then I will continue with converting the remaining sql strings into the sea query orm syntax. Otherwise, I will try to reach other options.

How was this PR tested?

This PR was tested using cargo test --features=postgres.

@guilload
Copy link
Member

Thanks for working on this. Starting small with an example was the way to go. Good call!

It looks good, but I wonder if it's more readable at the end of the day. Can you try to use sea_query in the write_sql_filter and build_query_filter functions where the ugliness lives and SQL injections can happen? We could migrate those exclusively, WDYT?

@kamalesh0406
Copy link
Contributor Author

Yup that sounds good to me. I will start working on updating them.

@kamalesh0406
Copy link
Contributor Author

kamalesh0406 commented Oct 21, 2023

@guilload I have completed about 95% of the updates for the write_sql_filter and build_query_filter. I need to add one more expression and fix the code in the unit tests. Can you give me a review if the current modifications are what you are looking for and if you are fine with proceeding further?

@guilload
Copy link
Member

Looking very good so far. You can keep going. Thank you!

@kamalesh0406
Copy link
Contributor Author

@guilload I have completed the migration for the two functions. Please do check the unit tests because I had to modify the strings due to some quirks in seaquery.

Copy link
Member

@guilload guilload left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looking good. The 'tag' = ANY(tags) might be a deal breaker :/ Let's see what they say.

For testing:

make docker-compose-up DOCKER_SERVICES='postgres'
QW_TEST_DATABASE_URL=postgres://quickwit-dev:quickwit-dev@localhost:5432/quickwit-metastore-dev cargo test --manifest-path quickwit/Cargo.toml -p quickwit-metastore --lib --all-features -- --nocapture postgres

@guilload
Copy link
Member

We can merge this once the conflict is solved.

@guilload guilload enabled auto-merge (squash) October 28, 2023 13:52
@guilload guilload merged commit 96f5504 into quickwit-oss:main Oct 28, 2023
4 checks passed
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.

2 participants