move-coop / parsons

A python library of connectors for the progressive community.
https://www.parsonsproject.org/
Other
260 stars 131 forks source link

Airtable get_records does not return columns when all values are null #758

Open ghost opened 1 year ago

ghost commented 1 year ago

The get_records method only returns a parsons table with columns that are not null for all records. When pulling a view with just a few records, I am not getting certain columns that happen to be blank. I imagine that’s just how the api returns the data but kind of annoying.

Detailed Description

If you create a view with some records and all of them are missing a value for column "status", then status will not appear in the Parsons Table that is returned.

To Reproduce

Call the get_records method on a table/view with a certain column that have all null values.

Your Environment

Additional Context

Add any other context about the problem here.

Priority

low

codygordon commented 2 months ago

It looks like the developer intends this behavior, or at least doesn't mind it. https://github.com/gtalarico/pyairtable/issues/229#issuecomment-1529161449

I kind of see their point but I do agree default behavior should be that the get_records method always returns all columns in the table/selected view, even if they are empty like you'd get from a select * query result.

To achieve this on our end would require fetching the table schema to get all field names and and explicitly appending the fields on the call every time, if specific fields hadn't already been defined for the call.

@shaunagm or @austinweisgrau how do you feel about implementing this "opinionated override" that adds some complexity to the method and tests?

shaunagm commented 2 months ago

I'm for it, if you think it'll make parsons easier to use. To clarify, this would be an optional parameter to get_records that users could pass in to get this behavior?