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 attribute use_field_ids to orm.Model.Meta #355

Merged
merged 16 commits into from
Mar 28, 2024
Merged

Conversation

BAPCon
Copy link
Contributor

@BAPCon BAPCon commented Mar 20, 2024

Resolves #351
Resolves #187

Adds wrapper @modify_kwargs that handles kwarg sanitization for:

  • Model.all()
  • Model.first()

cell_format and return_fields_by_field_id are removed.

If Model.Meta.use_field_ids=True, adds return_fields_by_field_id=True to above function calls.

I figure adding a dedicated wrapper is easier to read and is easier to manage if more sanitization is needed in the future.

Copy link

codecov bot commented Mar 20, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 100.00%. Comparing base (eef7b6f) to head (64f9341).
Report is 7 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff            @@
##              main      #355   +/-   ##
=========================================
  Coverage   100.00%   100.00%           
=========================================
  Files           25        25           
  Lines         2313      2320    +7     
=========================================
+ Hits          2313      2320    +7     

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

Copy link
Collaborator

@mesozoic mesozoic left a comment

Choose a reason for hiding this comment

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

Thanks for contributing a fix! I like this idea and I think it'll make the ORM more useful. I have a few suggestions below but otherwise I'm looking forward to adding this.

pyairtable/orm/model.py Outdated Show resolved Hide resolved
pyairtable/orm/model.py Outdated Show resolved Hide resolved
pyairtable/orm/model.py Outdated Show resolved Hide resolved
pyairtable/orm/model.py Outdated Show resolved Hide resolved
tests/test_orm_model.py Outdated Show resolved Hide resolved
@BAPCon BAPCon requested a review from mesozoic March 24, 2024 06:13
Copy link
Collaborator

@mesozoic mesozoic left a comment

Choose a reason for hiding this comment

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

This is looking good! The test seems to satisfy all the conditions we need to test, and it looks like we've maintained 100% coverage. A couple more pieces of feedback here, but nothing major.

pyairtable/orm/model.py Outdated Show resolved Hide resolved
pyairtable/orm/model.py Outdated Show resolved Hide resolved
pyairtable/orm/model.py Outdated Show resolved Hide resolved
pyairtable/orm/model.py Outdated Show resolved Hide resolved
pyairtable/testing.py Outdated Show resolved Hide resolved
tests/test_orm_model.py Outdated Show resolved Hide resolved
@BAPCon BAPCon requested a review from mesozoic March 26, 2024 05:05
Copy link
Collaborator

@mesozoic mesozoic left a comment

Choose a reason for hiding this comment

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

Looks great! Thank you for contributing a new feature!

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.

ORM table kwargs wrapping ORM specify fields as id, not as name
2 participants