-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
chore(python): upgrade pydantic and datamodel-code-generator #17477
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
thmsobrmlr
commented
Sep 16, 2023
@@ -1446,7 +1446,7 @@ def test_hogql_query_filters(self): | |||
) | |||
query = "SELECT event, distinct_id from events WHERE distinct_id={distinct_id} and {filters}" | |||
filters = HogQLFilters( | |||
properties=[EventPropertyFilter(key="index", operator="exact", value=4, type="event")] | |||
properties=[EventPropertyFilter(key="index", operator="exact", value="4", type="event")] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This was erroring with a ClickHouse exception, due to different behaviour in Pydantic v1 and v2.
ClickHouse Error
DB::Exception: There is no supertype for types String, Float64 because some of them are String/FixedString and some of them are not: while executing 'FUNCTION equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(properties, 'index'), ''), 'null'), '^"|"$', '') : 17, 4. : 10) -> equals(replaceRegexpAll(nullIf(nullIf(JSONExtractRaw(properties, 'index'), ''), 'null'), '^"|"$', ''), 4.) Nullable(UInt8) : 18'. Stack trace:9
Pydantic
See the populated value property (right at the end).
Pydantic v1
EventPropertyFilter(key="index", operator="exact", value=4, type="event")
> EventPropertyFilter(key='index', label=None, operator=<PropertyOperator.exact: 'exact'>, type='event', value='4')
Pydantic v2
EventPropertyFilter(key="index", operator="exact", value=4, type="event")
> EventPropertyFilter(key='index', label=None, operator=<PropertyOperator.exact: 'exact'>, type='event', value=4.0)
thmsobrmlr
changed the title
wip: extend query schema
chore(python): upgrade pydantic and datamodel-code-generator
Sep 16, 2023
# Conflicts: # frontend/__snapshots__/scenes-app-recordings--recordings-play-list-no-pinned-recordings.png
mariusandra
approved these changes
Sep 18, 2023
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Problem
pydantic
anddatamodel-code-generator
are outdated.Changes
This PR upgrades them, so we start on the current version with our port of insights to HogQL. Pydantic v2 brings a couple of useful changes for us, including improved performance and more options for serializing (important for a somewhat stable cache key).
How did you test this code?
CI run
The “Validate Django migrations” step is failing, because the migrations are run with requirement files from
master
, and Django can't boot up with these. This should only be a CI problem, so I'd like to force-merge this.It would be possible to split up this PR in two (a. upgrade dependencies b. update schema to pydantic v2) to resolve the CI problem as well.