bigfunctions icon indicating copy to clipboard operation
bigfunctions copied to clipboard

[bug]: `upload_table_to_gsheet `: does not keep column ordered

Open armetiz opened this issue 2 years ago • 1 comments

Check the bug has not already been reported

Edit function_name and the short error description in title above

  • [X] I wrote the correct function name and a short error description in the title above

What happened and what did you expect?

Hi there,

I'm uploading a BQuery table to GSheet using upload_table_to_gsheet.

It does not But columns are ordered alphabetically.

armetiz avatar Dec 01 '23 20:12 armetiz

Hi @armetiz.

Thanks a lot for opening this issue.

I had a look and could reproduce what you described.

After investigation, this is because:

  • this procedure converts the table data into a json before sending it to upload_to_gsheet function.
  • BigQuery json conversion reorders the fields alpabetically as seen in the following screenshot.

image

Then the only other way would be to generate a json string without passing by json and change upload_to_gsheet function signature to accept string instead of json as data.

Or maybe you have another suggestion?

unytics avatar Dec 21 '23 00:12 unytics