google-bigquery

Dataflow can't read from BigQuery dataset in region “asia-northeast1”

谁说我不能喝 提交于 2020-01-15 09:41:40
问题 I have a BigQuery dataset located in the new "asia-northeast1" region. I'm trying to run a Dataflow templated pipeline (running in Australia region) to read a table from it. It chucks the following error, even though the dataset/table does indeed exist: Caused by: com.google.api.client.googleapis.json.GoogleJsonResponseException: 404 Not Found { "code" : 404, "errors" : [ { "domain" : "global", "message" : "Not found: Dataset grey-sort-challenge:Konnichiwa_Tokyo", "reason" : "notFound" } ],

Rename all column names for joining purpose in big query

两盒软妹~` 提交于 2020-01-15 09:37:34
问题 I need to join two tables with exactly the same column names. I will need to rename the columns before the joining step. Each table contains 100+ columns. I wonder if there's any way to add prefix or suffix to rename all the columns, rather than manually change them with AS . I'm using standard SQL on BigQuery. I put an example in below for illustration. I wonder if there's any function in BigQuery like: UPDATE inv SET CONCAT(column_name, '_inv') AS column_name ... example ... thank you in

Count number of events before and after a particular event in SQL?

可紊 提交于 2020-01-15 09:26:28
问题 I have a table containing date and events. There is event named 'A'. I want to find out how many events occurred before and after event 'A' in Sql Bigquery. for Example, User Date Events 123 2018-02-13 D 123 2018-02-12 B 123 2018-02-10 C 123 2018-02-11 A 123 2018-02-01 X The answer would be something like this. User Event Before After 123 A 2 2 I have tried many queries but its not working. Any Idea, how to solve this problem? 回答1: below is for BigQuery Standard SQL #standardSQL WITH `project

Count number of events before and after a particular event in SQL?

徘徊边缘 提交于 2020-01-15 09:23:06
问题 I have a table containing date and events. There is event named 'A'. I want to find out how many events occurred before and after event 'A' in Sql Bigquery. for Example, User Date Events 123 2018-02-13 D 123 2018-02-12 B 123 2018-02-10 C 123 2018-02-11 A 123 2018-02-01 X The answer would be something like this. User Event Before After 123 A 2 2 I have tried many queries but its not working. Any Idea, how to solve this problem? 回答1: below is for BigQuery Standard SQL #standardSQL WITH `project

How to join BQ tables on two or more keys with Cloud Dataflow?

痴心易碎 提交于 2020-01-15 09:14:30
问题 I have two tables A and B. Both of them have the fields session_id and cookie_id . How do i create a Joined table output joining A with B on session_id , cookie_id with the help of a Dataflow pipeline? CoGroupByKey method allows you to join on a single key. Couldn't find anything helpful in the documentation as well. 回答1: To expand on user9720010's answer. You can create a composite key by mapping the fields to a combination of session_id and cookie_id . This pattern is explained in the

How to join BQ tables on two or more keys with Cloud Dataflow?

元气小坏坏 提交于 2020-01-15 09:14:07
问题 I have two tables A and B. Both of them have the fields session_id and cookie_id . How do i create a Joined table output joining A with B on session_id , cookie_id with the help of a Dataflow pipeline? CoGroupByKey method allows you to join on a single key. Couldn't find anything helpful in the documentation as well. 回答1: To expand on user9720010's answer. You can create a composite key by mapping the fields to a combination of session_id and cookie_id . This pattern is explained in the

Bigquery event streaming and table creation

早过忘川 提交于 2020-01-15 08:31:06
问题 We are currently saving events to bigquery via uploading files to google cloud storage and then inserting these files into bigquery. We have a very active application running on cirka 300 nodes and saving around 1 billion events per day. We now plan to change this to use the "new" streaming API. My concern now is that our current solution creates the table if it does not exist which is not the case for the streaming API. (Our event tables are sharded on game + month to reduce the data that we

Write BigQuery query result directly to GCS - is it possible?

不羁的心 提交于 2020-01-15 05:05:29
问题 I tried the bq command line tool, but it there seems to be no way to write the results directly to GCS. The only way I can see is working is: query -> table -> export query -> console -> local CSV file -> upload to GCS I'm looking for a way to directly write the results to GCS. 回答1: You cannot write your query results directly to GCS. The easiest way, as you've already pointed out, is to: Write your query results to an output table Export your table to GCS You easily do this in the web UI.

Unable to save a query as a view table

喜欢而已 提交于 2020-01-15 03:33:12
问题 I have a query that runs and can see the results. But while trying to save the query as a view table, I get error message saying Failed to save view. No suitable credentials found to access Google Drive. Contact the table owner for assistance. I think the problem is caused by a table used in the query. The table is uploaded from a google sheet (with source URI), own by me. I have tried to enable Google Drive API from the project but no luck. Not sure how I can give BigQuery access to Google

How to get the Google Analytics definition of unique page views in Bigquery

岁酱吖の 提交于 2020-01-14 13:44:07
问题 https://support.google.com/analytics/answer/1257084?hl=en-GB#pageviews_vs_unique_views I'm trying to calculate the sum of unique page views per day which Google analytics has on its interface How do I get the equivalent using bigquery? 回答1: There are two ways how this is used: 1) One is as the original linked documentation says, to combine full visitor user id, and their different session id: visitId, and count those. SELECT EXACT_COUNT_DISTINCT(combinedVisitorId) FROM ( SELECT CONCAT