Skip to content
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 more STRICT table support #604

Merged
merged 5 commits into from Dec 8, 2023
Merged

Add more STRICT table support #604

merged 5 commits into from Dec 8, 2023

Conversation

tkhattra
Copy link
Contributor

@tkhattra tkhattra commented Nov 19, 2023

Make table.transform() preserve STRICT mode.


📚 Documentation preview 📚: https://sqlite-utils--604.org.readthedocs.build/en/604/

Make table.transform() preserve STRICT mode.
@simonw simonw changed the title Add more STRICT table support per https://github.com/simonw/sqlite-ut… Add more STRICT table support Dec 6, 2023
Copy link

codecov bot commented Dec 6, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (9286c1b) 95.77% compared to head (1698a9d) 95.72%.
Report is 1 commits behind head on main.

❗ Current head 1698a9d differs from pull request most recent head 61c6e26. Consider uploading reports for the commit 61c6e26 to get more accurate results

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #604      +/-   ##
==========================================
- Coverage   95.77%   95.72%   -0.06%     
==========================================
  Files           8        8              
  Lines        2842     2852      +10     
==========================================
+ Hits         2722     2730       +8     
- Misses        120      122       +2     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@simonw
Copy link
Owner

simonw commented Dec 6, 2023

This looks really great on first glance - design is good, implementation is solid, tests and documentation look great.

Looks like a couple of mypy failures in the tests at the moment:

  mypy sqlite_utils tests

sqlite_utils/db.py:543: error: Incompatible types in assignment (expression has type "type[Table]", variable has type "type[View]")  [assignment]
tests/test_lookup.py:156: error: Name "test_lookup_new_table" already defined on line 5  [no-redef]
Found 2 errors in 2 files (checked 54 source files)
Error: Process completed with exit code 1.

@tkhattra
Copy link
Contributor Author

tkhattra commented Dec 7, 2023

Apologies - I pushed a fix that addresses the mypy failures.

@simonw simonw merged commit 1500c19 into simonw:main Dec 8, 2023
38 of 39 checks passed
@simonw
Copy link
Owner

simonw commented Dec 8, 2023

Also tested this manually like so:

sqlite-utils create-table strict.db strictint id integer size integer --strict
sqlite-utils create-table strict.db notstrictint id integer size integer         
sqlite-utils install sqlite-utils-shell
sqlite-utils shell strict.db                                             
Attached to strict.db
Type 'exit' to exit.
sqlite-utils> insert into strictint (size) values (4);
1 row affected
sqlite-utils> insert into strictint (size) values ('four');
An error occurred: cannot store TEXT value in INTEGER column strictint.size
sqlite-utils> insert into notstrictint (size) values ('four');
1 row affected
sqlite-utils> commit;
Done

simonw added a commit that referenced this pull request Dec 8, 2023
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.

None yet

2 participants