Skip to content

feat: add SQLiteLookup for lookup joins with SQLite database #900

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

Merged
merged 7 commits into from
May 29, 2025

Conversation

ovv
Copy link
Contributor

@ovv ovv commented May 27, 2025

No description provided.

@ovv ovv changed the base branch from main to quent/lookup_joins May 27, 2025 14:34
@ovv ovv requested a review from Copilot May 27, 2025 14:35
Copy link
Contributor

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull Request Overview

Adds a new SQLiteLookup implementation to enable lookup joins against a SQLite database, complete with caching, custom query support, and identifier validation.

  • Introduces SQLiteLookup, SQLiteLookupField, and SQLiteLookupQueryField in sqlite.py
  • Provides a comprehensive test suite in tests/test_quixstreams/test_dataframe/test_lookup_sqlite.py
  • Updates type hints for lookup joins to use Mapping[str, F] and exposes new lookup classes in __init__.py

Reviewed Changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 2 comments.

Show a summary per file
File Description
tests/test_quixstreams/test_dataframe/test_lookup_sqlite.py Adds end-to-end tests covering basic lookups, TTL, ordering, defaults, errors, and query fields
quixstreams/dataframe/joins/lookups/sqlite.py Implements SQLite-backed lookup join, field definitions, caching, and result extraction
quixstreams/dataframe/joins/lookups/quix_configuration_service/lookup.py Updates type hint for fields parameter to Mapping[str, Field]
quixstreams/dataframe/joins/lookups/base.py Updates abstract join signature to accept Mapping[str, F]
quixstreams/dataframe/joins/lookups/init.py Exposes the new SQLite lookup classes in the package API
Comments suppressed due to low confidence (2)

quixstreams/dataframe/joins/lookups/sqlite.py:48

  • There's no test covering the first_match_only=False path for SQLiteLookupField, which should return multiple rows; consider adding a test to verify that behavior.
class SQLiteLookupField(BaseSQLiteLookupField):

quixstreams/dataframe/joins/lookups/sqlite.py:96

  • [nitpick] The parameter name 'on' is ambiguous and could be misread; consider renaming it to something more descriptive like 'key_column' or 'lookup_column'.
on: str

ovv and others added 7 commits May 29, 2025 18:05
- Introduce SQLiteLookup, SQLiteLookupField, and SQLiteLookupQueryField for enriching streaming data using SQLite.
- Support safe table/column name validation and parameterized queries to prevent SQL injection.
- Implement per-field caching with configurable TTL.
- Add support for both simple and advanced SQL queries in lookup joins.
- Update __init__.py to export new SQLite lookup classes.
SQLite only returns basic data type. We don't need to deepcopy them

Co-authored-by: Copilot <[email protected]>
This creates problem when a parent dataclass has parameters with default values
and a child dataclass wants attributes without default.
@daniil-quix daniil-quix force-pushed the quent/lookup_joins_sqlite branch from 280e51f to df059ce Compare May 29, 2025 16:07
@daniil-quix daniil-quix marked this pull request as ready for review May 29, 2025 16:07
@daniil-quix daniil-quix merged commit 6b12ecf into quent/lookup_joins May 29, 2025
4 checks passed
@daniil-quix daniil-quix deleted the quent/lookup_joins_sqlite branch May 29, 2025 16:35
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