google-bigquery

Index column in SELECT EXCEPT() after joining table using default table name as prefix

只愿长相守 提交于 2020-01-14 06:25:51
问题 This question is following up from the question originally regarding renaming the column names with table names as prefixes in google big query. Long story short, I need to join two tables with exact names and keep the origins of the columns. I learned that I can use, for example: SELECT table_A , table_B FROM table_A FULL JOIN table_B USING (KEY1, KEY2, KEY3) This code would generate a joined table with column names for example: table_A.KEY1 , table_B.KEY1 in the result on google big query.

Index column in SELECT EXCEPT() after joining table using default table name as prefix

亡梦爱人 提交于 2020-01-14 06:25:09
问题 This question is following up from the question originally regarding renaming the column names with table names as prefixes in google big query. Long story short, I need to join two tables with exact names and keep the origins of the columns. I learned that I can use, for example: SELECT table_A , table_B FROM table_A FULL JOIN table_B USING (KEY1, KEY2, KEY3) This code would generate a joined table with column names for example: table_A.KEY1 , table_B.KEY1 in the result on google big query.

bigQuery Google Cloud how to share dataset with other users?

假如想象 提交于 2020-01-14 05:55:07
问题 I have a bigQuery dataset defined in Google Cloud with my userA account, and I want my colleague userB, who is a member of the same group, to be able to see the dataset that I have defined. Using the bq command-line interface, userB can see the project, but not the dataset. How can I share the dataset created by userA with userB? 回答1: On the Web UI of BigQuery, there is a dropdown menu to the right of the dataset's name. There, you can choose Share Dataset : On the popup window, you'll be

bigQuery Google Cloud how to share dataset with other users?

折月煮酒 提交于 2020-01-14 05:55:07
问题 I have a bigQuery dataset defined in Google Cloud with my userA account, and I want my colleague userB, who is a member of the same group, to be able to see the dataset that I have defined. Using the bq command-line interface, userB can see the project, but not the dataset. How can I share the dataset created by userA with userB? 回答1: On the Web UI of BigQuery, there is a dropdown menu to the right of the dataset's name. There, you can choose Share Dataset : On the popup window, you'll be

Specify SQL dialect for ViewDefinition in BigQuery API

独自空忆成欢 提交于 2020-01-14 05:05:22
问题 There are two APIs for manipulating BigQuery entities (Datasets, Tables, Views, etc.)... The old (deprecated) API: com.google.api.services.bigquery The new API: com.google.cloud.bigquery In the old API, the View class has a boolean flag that specifies whether the associated query is using legacy or standard SQL. That flag is accessed via the methods: getUseLegacySql setUseLegacySql The new API introduces the ViewDefinition class, but it does not have the boolean flag. How do you specify the

Specify SQL dialect for ViewDefinition in BigQuery API

落爺英雄遲暮 提交于 2020-01-14 05:04:58
问题 There are two APIs for manipulating BigQuery entities (Datasets, Tables, Views, etc.)... The old (deprecated) API: com.google.api.services.bigquery The new API: com.google.cloud.bigquery In the old API, the View class has a boolean flag that specifies whether the associated query is using legacy or standard SQL. That flag is accessed via the methods: getUseLegacySql setUseLegacySql The new API introduces the ViewDefinition class, but it does not have the boolean flag. How do you specify the

How do I remove the first character of a string and treat the remaining values as an integer in BigQuery

微笑、不失礼 提交于 2020-01-14 04:53:08
问题 I currently am working with a large data set that was pre-populated in BigQuery. I have a column of orderID's which have the following set-up: o377412876, o380940924, etc. This is stored in a string. I need to do the following and am running into problems: 1) Strip off the first character using the BigQuery query language 2) Convert the remaining (or treat the remaining values), as an integer. I will then run a join against the values. Now, I would be abundantly happier down this operation in

BQ scripting: Writing results of a loop to a table

北城以北 提交于 2020-01-14 04:14:29
问题 I am working with BigQuery scripting, I have written a simple WHILE loop which iterates through daily Google Analytics tables and sums the visits, now I'd like to write these results out to a table. I've gotten as far as creating the table, but I can't capture the value of visits from my SQL query to populate the table. Date works fine, because it is defined outside of the SQL. I tried to DECLARE the value of visits with a new variable, but again this does not work because it's not known

BigQuery: optimised query to get top 5 most visited wikipedia pages in each month

谁都会走 提交于 2020-01-14 04:07:06
问题 I am trying to get an optimised query to find the top 5 most visited wikipedia pages in each month in 2019 from the public dataset fh-bigquery.wikipedia_v3.pageviews_2019 . I have come up with the below query but I need two things: The query runs for about 2 minutes and processes 2.3 TB irrespective of whether I filter top 5 ranks or display them all in the outer query. Is there a better optimised query to process less volume and in less time - something by which we can limit the number of

Count number of events before and after a event “A” till another event “A” is encountered in Big query?

☆樱花仙子☆ 提交于 2020-01-14 03:55:14
问题 I have a table containing date and events and users. There is event named 'A'. I want to find out how many time a particular event occurred before and after event 'A' in SQL Bigquery. The event A might appear multiple times. But it should count events only till it encounters another event A in both before and after condition. for Example, User Date Events 123 2018-02-14 X.Y.A 123 2018-02-12 X.Y.B 134 2018-02-10 Y.Z.A 123 2018-02-11 A 123 2018-02-01 X.Y.Z 134 2018-02-05 X.Y.B 134 2018-02-04 A