-
-
Notifications
You must be signed in to change notification settings - Fork 396
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
Add Postgres JSON filters #1789
Add Postgres JSON filters #1789
Conversation
Pull Request Test Coverage Report for Build 12016619424Details
💛 - Coveralls |
"gte": cast(Callable[..., Criterion], operator.ge), | ||
"gt": cast(Callable[..., Criterion], operator.gt), | ||
"lte": cast(Callable[..., Criterion], operator.le), | ||
"lt": cast(Callable[..., Criterion], operator.lt), | ||
"range": between_and, | ||
"contains": contains, | ||
"startswith": starts_with, | ||
"endswith": ends_with, | ||
"iexact": insensitive_exact, | ||
"icontains": insensitive_contains, | ||
"istartswith": insensitive_starts_with, | ||
"iendswith": insensitive_ends_with, | ||
"year": extract_year_equal, | ||
"quarter": extract_quarter_equal, | ||
"month": extract_month_equal, | ||
"week": extract_week_equal, | ||
"day": extract_day_equal, | ||
"hour": extract_hour_equal, | ||
"minute": extract_minute_equal, | ||
"second": extract_second_equal, | ||
"microsecond": extract_microsecond_equal, |
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.
Don't we need more test for all these new operators?
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.
@abondar there are tests in tests/contrib/postgres/test_json.py
for all of these. Can you suggest any particular test cases you want me to add?
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.
Sorry, I am in wrong here, for some reason I only saw file with generic test_json, and didn't notice file with postgres-specific test_json
Description
This PR:
filter
lookup types such asin
,not_in
,gt
,lt
, etc. This is based on changes from Additional Postgresql JSON Functions #1215TestJSONFields
which were disabled previously by mistake. Apparently if you stack@test.requireCapability(dialect="mysql")
and@test.requireCapability(dialect="postgres")
on top of each other, the test will not run for neither mysql or postgresModel.filter(data__filter={"names_0": "John"})
Motivation and Context
JSON and JSONB fields are very popular with people who use Postgres. It makes sense to support a range of JSON operations. Django offers similar functionality.
Related issues:
How Has This Been Tested?
Added more tests and enabled the existing ones.
Checklist: