Skip to content

feat(lookup): add JSON dynamic key support for lookups#35

Merged
Einswilli merged 8 commits intoAllDotPy:masterfrom
Einswilli:refractor.cli
Apr 7, 2026
Merged

feat(lookup): add JSON dynamic key support for lookups#35
Einswilli merged 8 commits intoAllDotPy:masterfrom
Einswilli:refractor.cli

Conversation

@Einswilli
Copy link
Copy Markdown
Contributor

  • 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

Einswilli and others added 8 commits April 7, 2026 14:50
- 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
@Einswilli Einswilli merged commit 6ddb9aa into AllDotPy:master Apr 7, 2026
3 of 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