gtalarico / pyairtable

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

One to many search difficulties #335

Closed Garito closed 9 months ago

Garito commented 9 months ago

Hi I have a table with master and another with the detail The detail records have the id of the master How can I search for details of a particular master? I'm using this match:

match({"Série": serie, "Sub-série": subserie})

without success Can you point me where am I failing? Thanks

mesozoic commented 9 months ago

You should be able to search the record link field using the value that you'd see in the primary field of the linked table. In your case, if Série is a record link field to a table called Series, you'd want the serie variable to contain whatever value appears in the primary field of the Series table.

Hope that helps! I'm closing this issue as it doesn't appear to be a problem with the library. If you think you've encountered a bug in pyAirtable, please post more details and an example of how to reproduce the bug.

Garito commented 9 months ago

It is not a bug in pyAirtable I've tried to look for a record in the many part and the primary key is stored as [value] Does it mean that my client has configured the field as a many-to-many relationship? If so, can this configuration be changed without loosing data? or How can I search it as a list of keys? I've tried match({"Série": [serie]}) but it raises an error

Thanks

mesozoic commented 9 months ago

That's true: Airtable will always return record link fields as a list of IDs, regardless of whether the UI is configured to allow multiple records.

I don't think it is possible to construct a formula that searches on the list of record IDs in a linked record field. You might have more luck finding workarounds on the Airtable Community forums.

Garito commented 9 months ago

So airtable is not a good solution then (nor a real relational database) Thanks, I will stop recommending it to my customers