gtalarico / pyairtable

Python Api Client for Airtable
https://pyairtable.readthedocs.io
MIT License
765 stars 138 forks source link

Pass arguments to Table function as a dictionary #205

Closed ripgith closed 1 year ago

ripgith commented 1 year ago

I have several tables that I am reading at the beginning of a process. Each one can have different arguments ("sort", "view", etc.). It would be nice to have the option of passing these arguments in a dictionary for each table.

Perhaps this could be done by some partial apply function but I'm not smart enough to make it work..

gtalarico commented 1 year ago

We could support some sort of "default params" but I am not sure I want to take this on. In the meantime this shouldn't be too bad:

default_options = { "sort": "X", "view": "view"}

table.get("recordId", **default_options)
table.all(**default_options)
ripgith commented 1 year ago

Thank you - this would work perfectly for my needs. I guess I never quite grokked the unpacking functions (*, **).