Posts

Showing posts with the label google-bigquery

Reading BigQuery Numeric Data Type From Table

Reading BigQuery Numeric Data Type From Table While Reading Data from BQ table Numeric Data Type is Still Not Supported in Apache Beam But Using API i can Use Numeric data type in Bq. So while Reading Data from Bq with below Snippet: BigQueryIO.readTablerow().from(options.valueprovider); I got an Exception Numeric is Not Supported Yet. Is there any other way I can read Data from BQ if Numeric Field is Present Except RestAPI Call. I don't think it is possible right now. You can follow the relevant feature request for Beam, however. – Elliott Brossard May 30 at 20:09 Hi, @ElliottBrossard That request i have seen but there is no response on from Apache side till now. Any alternative So, I can test the behaviour of Numeric Datatype in Dataflow Instead of RestAPI Call. I trying to use user-defined Coder also if it...

Randomly generate True or False on BigQuery

Randomly generate True or False on BigQuery I am trying to randomly generate a boolean (true or false) for all the rows of one BQ table and insert into another table along with the boolean column. I am right now doing the following: #standardSQL select (case when rand() > 0.5 then True else False end) as A I am not sure how to generate this for every row: Table 1 Name XXX YYY ZZZ Now I want to generate True or False randomly for each name and insert it into Table 2 which looks like the following: Table 2 Name | True_or_False XXX | True YYY | True ZZZ | False Any pointers will be helpful. 2 Answers 2 Below is for BigQuery Standard SQL - assuming table2 already exists #standardSQL INSERT `project.dataset.table2` (Name, True_or_False) SELECT Name, RAND() > 0.5 True_or_False FROM `project.dataset.table1` Just add the logic to a select: select t.*, (rand() < 0.5) as flag from table1 t; ...