Skip to content
Advertisement

Tag: google-bigquery

Bigquery – How to filter records with certain condition

I’m trying to write SQL (in BigQuery) the following in order to get a result that satisfies the following conditions. for ex: my table contains the following data I want to filter out records where it contains only value as “p” from the table. The expected result would be I have tried with the following query but it returns other

Efficient syntax to update 5K rows in BQ table

I’m trying to update ~5K rows in bq using python client. Here is my current try: and How can I map the account id list to a string as follows which seems more efficient(?) UPDATE mytable SET somefield=( CASE WHEN (id=100) THEN ‘some value removed’ WHEN (id=101) THEN ‘some value removed’ END ) WHERE id IN (100,101); I’ve tried: Plus

Query table with multiple “duplicates”, getting the most recent

I have a table which stores predictions from a machine learning model. This is a model that each hour (“predicted_at”) predicts a value for the next 24 hours(“predicted_for”). This means that the table have many different values for each “id” and “predicted_for”. Example of how the the table looks like for one ID and one predicted_for timestamp: value id predicted_at

Advertisement