google-bigquery

how to extract all countries geometry from Openstreet map dataset in BigQuery

房东的猫 提交于 2020-04-18 03:57:12
问题 I am using this query to extract the geometry of all countries using OSM, it works ok, but I am sure, it is creating a duplicated as I am using flag as a reference, some places have a flag, but they are not really countries SELECT feature_type, osm_id, osm_timestamp, geometry,ar.key,ar.value, FROM `bigquery-public-data.geo_openstreetmap.planet_features`,UNNEST(all_tags) ar where ('boundary', 'administrative') IN (SELECT (key, value) FROM UNNEST(all_tags)) and(feature_type="polygon" or feature

Creating External table from GCS with hive partition information in BigQuery using Command Line

北战南征 提交于 2020-04-17 22:05:12
问题 I have a bucket in google cloud storage with the following naming hierarchy. gs://<bucket>/events/year=2020/month=03/day=23/hour=12 I've used the following command to create a BigQuery Native table with hive partitioned information to import from google cloud store. This works. bq load --project_id=<projectId> --source_format=NEWLINE_DELIMITED_JSON --autodetect --hive_partitioning_mode=AUTO --hive_partitioning_source_uri_prefix=gs://<bucket>/events/ <targetTableName> "gs://<bucket>/events/*"

For BigQuery JS UDF, is there any simpler way to load a wasm file into a user defined function on?

耗尽温柔 提交于 2020-04-17 21:37:35
问题 As illustrated here, dumping the wasm byte code and copy past into the javascript seems difficult. 来源: https://stackoverflow.com/questions/60094498/for-bigquery-js-udf-is-there-any-simpler-way-to-load-a-wasm-file-into-a-user-de

Search bigquery for messageid from my gmail account

情到浓时终转凉″ 提交于 2020-04-16 02:55:21
问题 I want to search bigquery gmail logs for a particular messageid from my email account. function myFunction() { // Get the first message in the first thread of your inbox var message = GmailApp.getInboxThreads(0, 1)[0].getMessages()[0]; // Get its ID var messageId = message.getId(); // Now fetch the same message using that ID. var messageById = GmailApp.getMessageById(messageId); // Should always log true as they should be the same message var messageIdRFC2822 = message.getHeader("Message-ID")

Cannot set destination table with BigQuery Python API

痴心易碎 提交于 2020-04-14 09:04:20
问题 I'm recently getting the following BigQuery error when using the Python API: google.api_core.exceptions.BadRequest: 400 configuration.query.destinationTable cannot be set for scripts This is the function I use: def execute_bigquery_sql(query, dataset_id, table_id, use_legacy_sql=True, write_disposition='WRITE_TRUNCATE'): client = bigquery.Client() job_config = bigquery.QueryJobConfig() job_config.use_legacy_sql = use_legacy_sql print("table_id: {table_id}".format(table_id=table_id)) print(

Cannot set destination table with BigQuery Python API

一世执手 提交于 2020-04-14 09:03:58
问题 I'm recently getting the following BigQuery error when using the Python API: google.api_core.exceptions.BadRequest: 400 configuration.query.destinationTable cannot be set for scripts This is the function I use: def execute_bigquery_sql(query, dataset_id, table_id, use_legacy_sql=True, write_disposition='WRITE_TRUNCATE'): client = bigquery.Client() job_config = bigquery.QueryJobConfig() job_config.use_legacy_sql = use_legacy_sql print("table_id: {table_id}".format(table_id=table_id)) print(

How to select columns of data in BigQuery that has all NULL values

孤者浪人 提交于 2020-04-14 06:37:50
问题 How to select columns of data in BigQuery that has all NULL values A B C NULL 1 NULL NULL NULL NULL NULL 2 NULL NULL 3 NULL I want to retrieve columns A and C. Please can you help!! 回答1: Expanding on my comment on Mikhail's answer, this is what I had in mind. It doesn't require generating a query string, which could be quite long if you have a large number of columns. It compares the count of null values for each column name to the total number of rows in the table to decide if the column

How to select columns of data in BigQuery that has all NULL values

 ̄綄美尐妖づ 提交于 2020-04-14 06:35:00
问题 How to select columns of data in BigQuery that has all NULL values A B C NULL 1 NULL NULL NULL NULL NULL 2 NULL NULL 3 NULL I want to retrieve columns A and C. Please can you help!! 回答1: Expanding on my comment on Mikhail's answer, this is what I had in mind. It doesn't require generating a query string, which could be quite long if you have a large number of columns. It compares the count of null values for each column name to the total number of rows in the table to decide if the column

How is user_engagement event generated in firebase analytics?

拈花ヽ惹草 提交于 2020-04-12 14:33:12
问题 I have seen a param named firebase_screen_class (along with engagement_time_msec , firebase_event_origin and firebase_screen_id ) in the user_engagement event in bigQuery, it contains the name of activity classes in my app. Please, can you explain this params and how is the user_engagement event generated? I also wonder whether this can be useful to get the quantity of impressions or screen views of the activities in my app. 回答1: The user_engagement event is triggered when a user interacts

BigQuery Integer Partitions - can I use the results of another query to get a list of the partitions to access?

走远了吗. 提交于 2020-04-12 06:38:25
问题 I have a large table using integer partitions (~1TB). I need to regularly make several small subsets of this table. This was costing a lot, but using integer partitions I can decrease the cost by like 95%. It looks something like this. tbl_a : partition_index IN (1, 2, 5, 6, 7, 10, 11, 15, 104, 106, 111) tbl_b : partition_index IN (3, 4, 5, 20, 21, 25, 16, 84, 201, 301, 302, 303) and so on an so forth, with different subtables using different subsets of the index. Its ugly as all hell, but it