Cloud Data Fusion: Numeric datatype into BigQuery

213 Views Asked by At

I'm running a Data Fusion pipeline with Wrangler transformations and I want to store a value as Numeric in BigQuery for some precise arithmetic calculations, but Wrangler doesn't let me transform a FLOAT value to NUMERIC.

I've tried with implicit conversion trying to write a FLOAT value into a NUMERIC column inside BQ but that didn't work.

Is there a workaround for this?

Thanks!

2

There are 2 best solutions below

0
On BEST ANSWER

You can convert the value to a decimal datatype which maps to the bigquery NUMERIC datatype. Documentation here.

1
On

You can use CAST() function for explicit conversion as it always converts any numeric type to another numeric type.

CAST(expression AS NUMERIC)

You can refer to this documentation for conversion rules and comparison chart.