airtable can not interpret Collections.OrderedDict
bgriffen opened this issue · 5 comments
If you obtain a record with say attachments which are returned in an ordered dictionary, you have to convert them into a dictionary for them to be updated via at.update() for example. Why not just put the objects in a dictionary in the first place so they are update compatible? When you query airtable for records, there is no ordering mechanism and records are jumbled anyway so I'm not sure for the need of Collections.OrderedDict. It basically just means you have to do some preprocessing as found here to convert the nested ordered dict to a normal dict. Thanks!
I second this. It's a hassle to deal with OrderedDicts.
The library tries to keep as much info as possible from the API answer, including the order of the fields.
I'll provide an easy way to return dicts (and nested dicts) instead of an OrderedDicts.
Note that I'm not sure whether the order of the fields in a view are actually returned in their right order in the API but that could be important to be kept.
How about to offer config option to use dictionaries only?
It it really pain to convert nested OrderedDicts.
Aha, that option is there. :-)
Init it like this:
airtable.Airtable(
environ.get("AIRTABLE_BASE"),
environ.get("AIRTABLE_API_KEY"),
dict_class=dict
)