Convert pyarrow timestamp in ms to BigQuery timestamp

Viewed 27

I have my timestamp in pyarrow in ms with this value: '2010-01-30 00:00:00.000000000'. I'm trying to convert it into a format that BigQuery will accept. I've tried:

  • SELECT PARSE_TIMESTAMP("%F %H:%M:%E*S %Ez", "2010-01-30 00:00:00.000000000") AS parsed;
  • SELECT PARSE_TIMESTAMP("%c", "2010-01-30 00:00:00.000000000") AS parsed;

but get the same error:

Failed to parse input string

I tried:

SELECT TIMESTAMP("2010-01-30 00:00:00.000000000");

got:

Invalid timestamp: '2010-01-30 00:00:00.000000000'

Tried:

SELECT FORMAT_TIMESTAMP("%c", TIMESTAMP "2010-01-30 00:00:00.000000000", "UTC") AS formatted;

Got:

Invalid TIMESTAMP literal
1 Answers

This query worked for me:

SELECT PARSE_TIMESTAMP("%F %H:%M:%E*S", "2010-01-30 00:00:00.000000000") AS parsed;

Output:

enter image description here

Related