move-coop / parsons

A python library of connectors for the progressive community.
Other
255 stars 125 forks source link

[Bug] BigQuery connector returns None rather than empty Table on query with no rows returned #971

Closed austinweisgrau closed 3 months ago

austinweisgrau commented 5 months ago

The Redshift connector, on running a query that returns no rows, will return a parsons Table with no rows but with all of the columns defined. The BigQuery connector instead returns None.

I like the Redshift connector behavior better - it's more useful to still have the columns named even if there are no rows, and makes using the output from the connector the same whether or not rows are returned, making downstream use easier without conditionals.

Detailed Description

To Reproduce

redshift_tbl = Redshift().query('select current_user limit 0')
type(redshift_tbl)
>> parsons.etl.table.Table
redshift_tbl.columns
>> ['current_user']

bigquery_tbl = BigQuery().query('select session_user() limit 0')
type(bigquery_tbl)
>> NoneType

Your Environment

Additional Context

Add any other context about the problem here.

Priority

Please indicate whether fixing this bug is high, medium, or low priority for you. If the issue is time-sensitive for you, please let us know when you need it addressed by. medium