问题标签 [bigquery-standard-sql]

For questions regarding programming in ECMAScript (JavaScript/JS) and its various dialects/implementations (excluding ActionScript). Note JavaScript is NOT the same as Java! Please include all relevant tags on your question; e.g., [node.js], [jquery], [json], [reactjs], [angular], [ember.js], [vue.js], [typescript], [svelte], etc.

0 投票
1 回答
1429 浏览

google-analytics - Google BigQuery:访问一组页面的会话数

我一直在研究 GA 数据的(标准)SQL 查询,以查找包含两个 URL 之一的会话数。但是,通过两个 URL 过滤并从 hits.page.pagePath 中提取是我遇到问题的地方。

这是一个给我错误的查询示例:

并且直接展平也不起作用:

另外,我不确定这种方法是否会给我想要的数据。

0 投票
1 回答
2835 浏览

python - BigQuery check for array overlap

So I'm writing a BigQuery query and basically just need to be able to check if any of a number of strings are present as elements in one of the columns of the table, where the cared-about column itself contains arrays of strings. Just for context, I'm writing the query as part of a little automated Python job and am using standard SQL.

I couldn't find anything that would explicitly check for array inclusion here: https://cloud.google.com/bigquery/docs/reference/standard-sql/functions-and-operators

So I came up with a solution that employs a pretty hacky regex, specifically:

...where column is the column I care about in the table, and joined_string is a long string composed of all the strings I need to check for joined by | (where | serves as the regex OR operator).

Does there exist some kind of built-in functionality in BigQuery standard SQL that allows one to do this more sanely?

0 投票
1 回答
704 浏览

google-bigquery - #standardsql Bigquery 中的会话数

我希望将此 Bigquery #legacySQL 查询转换为 #standardsql。

到目前为止,我得到了正确的用户数量,但努力获得正确的会话数量:

现在是 3 月 14 日,所以日期条件很好。

我猜这是因为重复的字段显示了会话数。任何人都可以帮助解决语法问题吗?

0 投票
1 回答
849 浏览

python - 在 google bigquery 中,如何使用 google python 客户端使用 javascript UDF

我正在使用标准 SQL 和 javascript UDF 在 bigquery 中编写查询。我可以使用 WebUI 和 bigquery 命令行工具来实现这一点,但我的要求是使用 google python 客户端进行此查询。无法做到这一点。请有人帮忙。

这对我不起作用。请有人帮助我该怎么做。

0 投票
1 回答
1487 浏览

sql - Big Query:将旧版 sql 请求转换为标准 SQL 请求?

这是我的查询:请如何将其转换为标准 SQL?非常感谢你的帮助。我不知道该怎么做。

我尝试将其翻译成标准 sql,但出现以下错误:

语法错误:意外的浮点文字“85801771”。

也许我的查询中还有其他错误。

标准 SQL:

0 投票
2 回答
2051 浏览

google-bigquery - BigQuery:用于查询表的标准 sql 错误?

你能帮我把这个查询转换成 BigQuery 的标准 sql 吗?我收到此错误无法访问 hits.page.hostname LIKE 'website.fr' 中类型为 ARRAY> 的值的字段页面。请告诉我处理该问题以纠正它。

0 投票
1 回答
5557 浏览

sql - 如何在 Bigquery 中查询多个嵌套字段?

当我查询两级嵌套字段时,我错过了一些行。

架构是这样的:

一些 Variants.Price 记录为空。

当我用这个查询查询这个表时:

我得到的行比这个多得多:

这是因为它不会返回缺少 Variants.Prices 的行。

如何修改我的第二个查询,使其返回所有行,如果 Variants.Prices 丢失,它显示为 NULL?

0 投票
3 回答
1325 浏览

select - BigQuery 除了双嵌套列

您好需要hits.latencyTracking.userTimingLabel从我的表中排除该列并选择所有其他列。如何在标准 Sql 中执行此操作?我已经发现了一个关于类似问题的问题(BigQuery select * except nested column),但在我的情况下,我有一个双嵌套列,我无法调整代码。谢谢

0 投票
1 回答
6730 浏览

google-bigquery - 有没有比 EXTRACT(HOUR FROM TIMESTAMP_SECONDS(visitStartTime)) 更短的方法从存储为整数的时间戳中提取小时?

如题。在使用标准 SQL 时,是否有比 EXTRACT(HOUR FROM TIMESTAMP_SECONDS(visitStartTime)) 更短的方法从存储为整数的时间戳中提取小时(或其他日期部分)?

0 投票
1 回答
802 浏览

mysql - 将 mysql DB 导入 Bigquery 的最佳方法

目前,我们有一个脚本可以创建 DB 转储并将其滚动到 Amazon RDS 服务器上。这种情况每小时发生一次,当新转储到达时,它的先前版本将被删除。

我希望在 Bigquery 中有这些数据。最简单的过程是什么?特别:

  1. 有没有办法将转储上传到 BQ 自动删除以前的版本?

  2. 有什么方法可以自动将数据库从 RDS 复制到 BQ 删除 BQ 端的先前版本?

对此的任何其他见解将不胜感激。