google-bigquery

BigQuery displaying wrong results - Duplicating data from Cloud Function?

对着背影说爱祢 提交于 2021-02-11 12:48:53
问题 I am a junior developer and I was in charge of implementing the Facebook API to an existing project. However, the business team figured out that the Google Analytics results displayed on BigQuery are wrong. They asked me to fix it. This is the architecture: What I have done is: On BigQuery, checking how close/far are the results from Google Analytics. I found there is a pattern, the results I am getting on BigQuery are always either 1, 2 or 3 times the original value of GA. I checked if there

Access Denied: User does not have bigquery.jobs.create permission

◇◆丶佛笑我妖孽 提交于 2021-02-11 12:32:09
问题 Since a few days ago, I've been getting the following error when running any query on the GHTorrent and SOTorrent datasets on BigQuery: Access Denied: Project ghtorrent-bq: User does not have bigquery.jobs.create permission in project ghtorrent-bq. The error shows up even for the simplest queries, such as SELECT * FROM 'ghtorrent-bq.ght.issues' LIMIT 1000 . The same query worked without any problems until a few days ago, and I have no idea what might cause this new behaviour. 回答1: The *

Access Denied: User does not have bigquery.jobs.create permission

纵饮孤独 提交于 2021-02-11 12:31:00
问题 Since a few days ago, I've been getting the following error when running any query on the GHTorrent and SOTorrent datasets on BigQuery: Access Denied: Project ghtorrent-bq: User does not have bigquery.jobs.create permission in project ghtorrent-bq. The error shows up even for the simplest queries, such as SELECT * FROM 'ghtorrent-bq.ght.issues' LIMIT 1000 . The same query worked without any problems until a few days ago, and I have no idea what might cause this new behaviour. 回答1: The *

How to Delete rows from Structure in bigquery

≡放荡痞女 提交于 2021-02-11 12:28:50
问题 Can you please help me with my question, i am new to Bigquery. I have a table with multiple "record" type fields. I need to delete a row from one of the record. Consider below example as: id date subid.id subid.flag 1234 1/4/2020 1234-1 1 1234-2 1 1234-3 1 1234-4 -1 5678 1/5/2020 5678-1 1 5678-2 1 My requirement from the above is to delete the row from the structure subid with flag -1. What is the best way to do this ? Please help. sample data 回答1: Below is for BigQuery Standard SQL

Convert BigQuery data from key-value to columns

旧城冷巷雨未停 提交于 2021-02-11 12:09:51
问题 Given some data in BigQuery in the following format: | id | r.key | r.value | +----+-------+---------+ | 1 | k1 | v11 | | +-------+---------+ | | k2 | v12 | | +-------+---------+ | | k3 | v13 | +----+-------+---------+ | 2 | k1 | v21 | | +-------+---------+ | | k2 | v22 | | +-------+---------+ | | k3 | v23 | how can I convert this data to something like: | id | k1 | k2 | k3 | +----+-----+-----+-----+ | 1 | v11 | v12 | v13 | +----+-----+-----+-----+ | 2 | v21 | v22 | v23 | ? 回答1: Try below

How does BigQuery's FARM_FINGERPRINT represent a 64-bit *unsigned* int?

痴心易碎 提交于 2021-02-11 12:03:25
问题 BigQuery conveniently includes the FARM_FINGERPRINT function. Here's an excerpt of the documentation for this function: Description Computes the fingerprint of the STRING or BYTES input using the Fingerprint64 function from the open-source FarmHash library. The output of this function for a particular input will never change. Return type INT64 Note that the return type is an INT64, which in bigquery is a 64-bit signed int. However, if we look at the actual implementation of Fingerprint64, we

How does BigQuery's FARM_FINGERPRINT represent a 64-bit *unsigned* int?

六眼飞鱼酱① 提交于 2021-02-11 11:59:56
问题 BigQuery conveniently includes the FARM_FINGERPRINT function. Here's an excerpt of the documentation for this function: Description Computes the fingerprint of the STRING or BYTES input using the Fingerprint64 function from the open-source FarmHash library. The output of this function for a particular input will never change. Return type INT64 Note that the return type is an INT64, which in bigquery is a 64-bit signed int. However, if we look at the actual implementation of Fingerprint64, we

GA BigQuery: Calculating pageviews with a custom dimension

99封情书 提交于 2021-02-11 10:05:21
问题 Using GA BigQuery data, I am trying to calculate the total pageviews across 3 dimensions: date, device category, and a custom dimension (called "type" here). So the desired output is: So the total pageviews should be listed for each date, device, and type combination. I used the following query to get this result. I need to unnest the "type" dimension because it is a custom dimension. #standardsql SELECT date, device, cd6_type, SUM(pvs) AS pageviews FROM( SELECT date, fullvisitorID, visitID,

Parsing Nested JSON into STRUCT type BQ table

断了今生、忘了曾经 提交于 2021-02-10 23:17:04
问题 I am trying to load following data into BQ to create STRUCT type table. I am uploading the file using Upload option with Auto detect schema on BigQuery web UI. {"property": [ { "NAME": "65874aca2143", "VALUE": [ { "NAME": "time", "VALUE": [ { "NAME": "$date", "VALUE": "2020-06-16T09:42:49.449Z" } ] }, { "NAME": "type", "VALUE": "ACTION" }, { "NAME": "id", "VALUE": "1234" } ] } ]} But it is giving me below error. Error while reading data, error message: Failed to parse JSON: No active field

Parsing Nested JSON into STRUCT type BQ table

谁说我不能喝 提交于 2021-02-10 23:16:05
问题 I am trying to load following data into BQ to create STRUCT type table. I am uploading the file using Upload option with Auto detect schema on BigQuery web UI. {"property": [ { "NAME": "65874aca2143", "VALUE": [ { "NAME": "time", "VALUE": [ { "NAME": "$date", "VALUE": "2020-06-16T09:42:49.449Z" } ] }, { "NAME": "type", "VALUE": "ACTION" }, { "NAME": "id", "VALUE": "1234" } ] } ]} But it is giving me below error. Error while reading data, error message: Failed to parse JSON: No active field