BigQuery - quoting strings produced unexpected results

0

I am running the following query:

select concat('{','"name"',':', chr(34), str,
              chr(34), ', ','"type"',':','"string"','},') jsonl
from (select 'part_number' as str)

which results in:

enter image description here

and this is the expected results.

But when I save the results to a csv file, the results look different.

The issue is with the extra double quotation mark that is surrounding each element.

enter image description here

Any idea what is causing this discrepancy.

btw, my local machine is running Windows 11.

google-bigquery
2021-11-24 06:50:01
1

0

This is a common escaping for quotes inside strings in csv files. Try opening this file in Excel or LibreOffice Calc. It should look as expected.

enter image description here

2021-11-24 07:09:36

I need the CSV to look correctly.
ronencozen

In other languages

This page is in other languages

Русский
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................