Repository navigation
Conversation
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 0cc1b0db99
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if isinstance(value, decimal.Decimal): | ||
| return float(value) | ||
| if np is not None and isinstance(value, (np.integer, np.floating)): | ||
| if np is not None and isinstance(value, (np.integer, np.floating, np.bool_)): |
There was a problem hiding this comment.
Normalize NumPy booleans in lookup predicates too
For a lookup table pre-created with an enabled column typed as bool, calling table.lookup({'enabled': np.bool_(True)}) twice now raises IntegrityError on the second call instead of returning the existing ID. This conversion stores integer 1, but Table.lookup() still forwards the original scalar to rows_where(), where SQLite binds it as a BLOB. The query therefore misses the row and attempts an insertion that violates the unique index. Previously both operations used the BLOB representation and the lookup succeeded. Normalize lookup predicate values with the same conversion to preserve idempotency.
Useful? React with 👍 / 👎.
Fixes #974.
NumPy boolean scalars now follow Python booleans for both column type inference and SQLite parameter binding. Inferred columns containing NumPy booleans, including when mixed with Python booleans, use
INTEGERaffinity. An explicitnp.bool_schema type also maps toINTEGER.The regression cases cover newly inferred columns, mixed values, and explicit Python and NumPy boolean schema types. All four failed on
mainand pass with this change. A separate SQL check confirmed thatWHERE enabled = 1now matches the stored true value.Verification
uv run --no-sync pytest -q -rsreturned 1,633 passed and 17 skips for platform or optional dependencies.pytest tests/test_create.py tests/test_utils.py -qreturned 236 passed and 6 skips.📚 Documentation preview 📚: https://sqlite-utils--975.org.readthedocs.build/en/975/