bigquery-standard-sql

Why is my export sink from Stackdriver only loading the latest audit logs into BigQuery and no historical?

我与影子孤独终老i 提交于 2021-02-10 05:51:31
问题 I created an export sink in Stackdriver to load audit logs into BigQuery. I want to be able to see audit logs from the past 3 months. However, when I queried the tables in BigQuery, I am only seeing logs from today and no earlier. I applied the following filters to my export sink. I also tried removing the timestamp filter but still only seeing logs from today and no prior. resource.type="bigquery_dataset" timestamp > "2019-05-01T23:59:09.739Z" 回答1: Exports only work for new entries. Per the

How do i calculate an average time using standardSQL

ぃ、小莉子 提交于 2021-01-28 12:03:03
问题 At the moment I have a column in a table with this information: For example: 00:11:35 00:20:53 00:17:52 00:06:41 And I need to display the average of that time. These times would give an average of 00:14:15. How to do that? Ah, I'm trying to display this in Metabase, so I'd need a conversion form where after averaging the time it was converted to string. So maybe it's not that simple. The structure of field is: Table Field: tma (type time) 回答1: Below is for BigQuery Standard SQL #standardSQL

How to count frequency of elements in a bigquery array field

丶灬走出姿态 提交于 2020-06-28 02:43:25
问题 I have a table that looks like this: I am looking for a table that gives a frequency count of the elements in the fields l_0, l_1, l_2, l_3 . For example the output should look like this: | author_id | year | l_o.name | l_0.count| l1.name | l1.count | l2.name | l2.count| l3.name | l3.count| | 2164089123 | 1987 | biology | 3 | botany | 3 | | | | | | 2595831531 | 1987 | computer science | 2 | simulation | 2 | computer simulation | 2 | mathematical model | 2 | Edit: In some cases the array field

milliseconds format to parse a datetime?

蓝咒 提交于 2020-05-09 17:14:51
问题 I need to parse a datetime contains milliseconds for matching the max value in a field containing this datetimes. For example: #standardSQL SELECT PARSE_DATETIME('%Y-%m-%d %H:%M:%S.%u','2017-08-18 16:04:40.890') Any suggestions? Thanks in advance. UPDATE : Convert to milliseconds, suddendly MAX() . #standardSQL WITH Input AS ( SELECT date FROM UNNEST([ DATETIME '2017-08-18 16:04:40.890', DATETIME '2017-07-27 11:09:10.347', DATETIME '2017-08-22 13:17:34.727', DATETIME '2017-08-22 13:17:34.737'

How do I get usage data about the what views and datasets are being used/queried in BigQuery?

不打扰是莪最后的温柔 提交于 2020-03-03 16:34:54
问题 I need usage data on the dataset and views in BigQuery. I want a count of how many queries were ran against all the different datasets and views. My goal is to understand what datasets and views are currently being used. I looked in the Audit Log, however I'm not able to export all the records into excel for analysis. I am only able to export max 300 logs for a specific day. Is there a way to run a query in BigQuery that will give me this data instead of exporting from the Audit Log? 回答1: Yes

How do I get usage data about the what views and datasets are being used/queried in BigQuery?

流过昼夜 提交于 2020-03-03 16:33:32
问题 I need usage data on the dataset and views in BigQuery. I want a count of how many queries were ran against all the different datasets and views. My goal is to understand what datasets and views are currently being used. I looked in the Audit Log, however I'm not able to export all the records into excel for analysis. I am only able to export max 300 logs for a specific day. Is there a way to run a query in BigQuery that will give me this data instead of exporting from the Audit Log? 回答1: Yes