标签: google-bigquery

BigQuery和BigTable有什么区别?

是否有人会使用BigTable而不是BigQuery?两者似乎都支持读写操作,后者提供高级'查询'操作.

我需要开发一个联盟网络(因此我需要跟踪点击次数和'销售'),所以我很困惑,因为bigQuery似乎只是一个更好的API的bigTable.

cloud bigtable google-bigquery google-cloud-platform google-cloud-spanner

65
推荐指数
2
解决办法
3万
查看次数

Google BigQuery中的随机抽样

我刚刚发现RAND()函数虽然没有文档,但在BigQuery中有效.我能够使用以下方法从莎士比亚数据集中生成一个(看似)10个单词的随机样本:

SELECT word FROM
(SELECT rand() as random,word FROM [publicdata:samples.shakespeare] ORDER BY random)
LIMIT 10
Run Code Online (Sandbox Code Playgroud)

我的问题是:使用这种方法代替参考手册"高级示例"部分中定义的HASH()方法有什么缺点吗?https://developers.google.com/bigquery/query-reference

google-bigquery google-cloud-platform

51
推荐指数
5
解决办法
2万
查看次数

有没有办法将BigQuery表的架构导出为JSON?

BigQuery 具有可以在Web UI中查看,更新或用于使用该工具作为JSON文件加载数据的模式bq.但是,我找不到将此模式从现有表转储到JSON文件(最好是从命令行)的方法.那可能吗?

json google-bigquery

48
推荐指数
4
解决办法
3万
查看次数

如何从Google Developers Console中识别Google云端存储URI?

当我尝试从Google云端存储中将数据加载到BigQuery时,它会要求提供Google云存储URI(gs://).我已经审核了您的所有在线支持以及stackoverflow,但无法找到通过基于浏览器的Google Developers Console识别上传数据的网址的方法.我看到找到URL的唯一方法是通过gsutil,我无法让gsutil在我的机器上工作.

有没有办法通过基于浏览器的Google Developers Console确定网址?

google-cloud-storage google-bigquery google-cloud-platform

43
推荐指数
2
解决办法
2万
查看次数

无法访问类型为ARRAY <STRUCT <hitNumber INT64,时间INT64,小时INT64,... >>的Big Query中的字段

我正在尝试在BigQuery上使用标准SQL方言(即不是旧版SQL)运行查询.我的查询是:

SELECT
date, hits.referer
FROM `refresh.ga_sessions_xxxxxx*`
LIMIT 1000
Run Code Online (Sandbox Code Playgroud)

但不断收到错误

Error: Cannot access field referer on a value with type 
ARRAY<STRUCT<hitNumber INT64, time INT64, hour INT64, ...>> at [2:12]
Run Code Online (Sandbox Code Playgroud)

有人知道正确的语法吗?

sql nested google-bigquery

32
推荐指数
1
解决办法
3万
查看次数

从BigQuery表中删除重复的行

我有一个包含> 1M行数据和20多列的表.

在我的表格(tableX)中,我在一个特定列(troubleColumn)中识别出重复记录(~80k).

如果可能的话,我想保留原始表名并从我有问题的列中删除重复记录,否则我可以创建一个具有相同模式但没有重复项的新表(tableXfinal).

我不擅长SQL或任何其他编程语言,所以请原谅我的无知.

delete from Accidents.CleanedFilledCombined 
where Fixed_Accident_Index 
in(select Fixed_Accident_Index from Accidents.CleanedFilledCombined 
group by Fixed_Accident_Index 
having count(Fixed_Accident_Index) >1);
Run Code Online (Sandbox Code Playgroud)

distinct google-bigquery

29
推荐指数
4
解决办法
3万
查看次数

28
推荐指数
3
解决办法
3万
查看次数

是否可以使用json密钥而不是p12密钥来获取服务帐户凭据?

我在C#中使用"Google.Apis.Bigquery.v2客户端库".

我使用"服务帐户"授权Google BigQuery(请参阅http://www.afterlogic.com/mailbee-net/docs/OAuth2GoogleServiceAccounts.html).要创建X509证书,请使用Google Developers Console中的p12密钥.但是,现在json键是默认值.我可以用它代替p12键吗?

我有以下代码:

    string serviceAccountEmail = "xxxx@developer.gserviceaccount.com";

X509Certificate2 certificate;
using (Stream stream = new FileStream(@"C:\key.p12", FileMode.Open, FileAccess.Read, FileShare.Read))
{
    using (MemoryStream ms = new MemoryStream())
    {
        stream.CopyTo(ms);
        certificate = new X509Certificate2(ms.ToArray(), "notasecret", X509KeyStorageFlags.Exportable);
    }
}

// Create credentials
ServiceAccountCredential credential = new ServiceAccountCredential(
    new ServiceAccountCredential.Initializer(serviceAccountEmail)
    {
        Scopes = new[] {
        BigqueryService.Scope.Bigquery,
        BigqueryService.Scope.CloudPlatform,
    },
    }.FromCertificate(certificate));

// Create the service
BaseClientService.Initializer initializer = new BaseClientService.Initializer()
{
    HttpClientInitializer = credential,
    ApplicationName = "My Application",
    GZipEnabled = true,
}; …
Run Code Online (Sandbox Code Playgroud)

c# google-bigquery google-api-dotnet-client google-sheets-api

25
推荐指数
1
解决办法
7631
查看次数

在Google BigQuery中选择除一些以外的所有列?

有没有办法选择*除了BigQuery中的[x,y,z列名称]?我看到MySQL的一些解决方案,但不确定它是否适用于BQ.

谢谢.

google-bigquery

25
推荐指数
2
解决办法
2万
查看次数

在BigQuery中运行python函数

在BigQuery中可以运行python函数吗?

根据Felipe的这篇博客文章,似乎C可以编译为WebAssembly并在BQ中运行。

当然,可以使用cython或其他工具将Python编译为C或C ++(甚至可以将其编译为javascript)。因此,我的问题是,有没有人有在BigQuery中执行python函数的经验。如果是这样,您正在使用的流程是什么?

这里可能的选项是:

  • 将python“转换”为javascript以运行。
  • 将python编译为c或cpp并将其编译为wasm

这是使用示例输入:

(1)来源

id         product 
1          box     
2          bottle
Run Code Online (Sandbox Code Playgroud)

(2)要使用的Python函数

def double_id(row):
    return row['id'] * 2

def product_code(row):
    # B3
    return row['product'].upper()[0] + str(len(row['product']))
Run Code Online (Sandbox Code Playgroud)

(3)预期产量

id     product      double_id       product_code
1      box          2               B3
2      bottle       4               B6
Run Code Online (Sandbox Code Playgroud)

我不仅希望使用javascript(可能是最简单的方法)来重写上面的代码,而且我还在寻找一种更通用的解决方案,如果有的话,我可以在其中采用python(标准库)函数,并在BigQuery查询中使用它。

python transpiler google-bigquery webassembly

25
推荐指数
1
解决办法
1006
查看次数