I get csv files where string null value expressed as "",
when I load the file to BigQuery the value of the field is empty string
and not Null.
Is there a way to set BigQuery to see "" as Null value?
Adding this for those who might still need it. There is a NULLIF function that can do this easily.
NULLIF(column_name,'')
What this does is if column_name is an empty string i.e. '', it puts NULL, if not, it puts the column_name value.
It seems to me that it might be easiest to simply remove all instances of "" from the original file. (Through find and replace.)
Otherwise, once you have loaded the table into BigQuery, you could select all columns, apply case when column_name = '' then null else column_name end to the relevant column, and save the results as a new table.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With