feat(lookup): add JSON dynamic key support for lookups#35
Merged
Einswilli merged 8 commits intoAllDotPy:masterfrom Apr 7, 2026
Merged
feat(lookup): add JSON dynamic key support for lookups#35Einswilli merged 8 commits intoAllDotPy:masterfrom
Einswilli merged 8 commits intoAllDotPy:masterfrom
Conversation
Contributor
Einswilli
commented
Apr 7, 2026
- Add json_key field to LookupContext for passing JSON key names
- Update apply_transform() to accept optional key parameter for JSON transforms
- Update resolve() to handle JSON key transforms when lookup_name has no '__'
- Add logic in compiler to detect JSON key from field (e.g., bio__key__priority)
- Add TestJSONDynamicKeyLookups tests for dynamic JSON key lookups
- Fix: use key_text transform for better SQLite JSON text comparison
- Add LookupContext.backend field for backend-specific SQL generation - Add date/time transforms: date, year, month, day, hour, minute, second, week, dow - Add new transforms: quarter, time, iso_week, iso_dow - Add JSON transforms: key, key_text, json - Add JSON lookups: has_key, has_keys, contains, contained_by - Add handle_sqlite_transform_lookup() for TEXT->INTEGER conversion - Add resolve() for chained lookups (e.g., date__gte) - Add apply_transform() for transform-only lookups (e.g., year=2024)
- Add Backend parameter to compile_filters, compile_single_filter - Add transform detection for field__transform patterns (e.g., created_at__year) - Add logic to handle chained lookups (month__gte) vs transform-only (year=2024) - Use lookup::resolve() for chained lookups, direct transform functions for simple transforms
- Add date/time and JSON transforms/lookups to known lookups set - Update _parse_lookup_key to handle chained lookups like key__icontains - Search from end to find the last known lookup in a chain - Fall back to 'exact' if no known lookup found
- Add TestDateTimeLookupsIntegration with tests for year, month, day, hour lookups - Add TestChainedDateTimeLookups for date__gte, date__lte patterns - Add TestDateTimeEdgeCases for NULL handling and edge cases - Add TestJSONFieldLookups for JSON key lookups - Add TestLookupsWithOrdering and TestLookupsWithExclude - Add unit tests in test_lookups.py
- Add Backend enum (PostgreSQL, MySQL, SQLite) for backend-specific SQL - Add detect_backend() function to parse URL and detect backend type - Add global BACKEND static to store backend after pool initialization - Add get_backend() function to retrieve current backend - Update QueryNode to include backend field - Update PyQueryBuilder to use backend from pool
- Add pytest_collection_modifyitems to auto-add setup_database to integration tests - Use temp directory for test database - Format test_crud.py for consistency
- Add json_key field to LookupContext for passing JSON key names - Update apply_transform() to accept optional key parameter for JSON transforms - Update resolve() to handle JSON key transforms when lookup_name has no '__' - Add logic in compiler to detect JSON key from field (e.g., bio__key__priority) - Add TestJSONDynamicKeyLookups tests for dynamic JSON key lookups - Fix: use key_text transform for better SQLite JSON text comparison
Wgoeh
approved these changes
Apr 7, 2026
This file contains hidden or 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
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.