简体   繁体   English

如何使用 google cloud bigquery 进行集成测试

[英]How can I make integration tests with google cloud bigquery

We are in the processing of migrating from apache hbase to bigquery.我们正在从 apache hbase 迁移到 bigquery。

Currently we have end to end tests (using cucumbers) that work with a docker container running hbase.目前我们有端到端的测试(使用黄瓜)与运行 hbase 的 docker 容器一起工作。

There don't seem to be any bigquery docker containers or emulators ( https://cloud.google.com/sdk/gcloud/reference/beta/emulators/ )似乎没有任何 bigquery docker 容器或模拟器( https://cloud.google.com/sdk/gcloud/reference/beta/emulators/

How would we be able to create end to end tests for an application working with bigquery?我们如何才能为使用 bigquery 的应用程序创建端到端测试?

Currently there is not any kind of BigQuery local emulator or anything similar to that.目前没有任何类型的 BigQuery 本地模拟器或类似的东西。 As pointed out by the link you shared about available GCP emulators , there are some other products that have such a feature, but probably the reason why BigQuery does not have one is that its true potential is only seen when working in its real infrastructure, plus the fact that the costs of working with BigQuery can be relatively low depending on the usage you make of it, plus you have a Free Tier to start working with.正如您分享的关于 可用 GCP 模拟器的链接所指出的,还有一些其他产品具有这样的功能,但 BigQuery 没有的原因可能是它的真正潜力只有在其真实基础设施中工作时才能看到,加上事实上,使用 BigQuery 的成本可能相对较低,具体取决于您对它的使用情况,而且您有一个免费套餐可以开始使用。

Let me summarize some info about BigQuery pricing that can be useful for you:让我总结一些可能对您有用的有关 BigQuery 定价的信息:

  • BigQuery storage and operation costs are summarized in the pricing documentation .定价文档中总结了 BigQuery 存储和运营成本。
  • BigQuery offers some operations that are free of charge . BigQuery 提供一些免费的操作。
  • There's a Storage free tier with 10GB of free storage.有一个包含 10GB 免费存储空间的存储免费层 It may not be a lot, given that BQ is designed to work with enormous amounts of data, but it can be a good starting point to do some tests.考虑到 BQ 旨在处理大量数据,它可能不会很多,但它可能是进行某些测试的良好起点。
  • There's also an Operations free tier , where the first TeraByte of processed data (per month) is free of charge.还有一个Operations 免费层,其中第一个 TeraByte 处理数据(每月)是免费的。
  • You can set up alerts in order to monitor usage with Stackdriver , using the available metrics .您可以设置警报,以便使用可用指标监控Stackdriver的使用情况。

In any case, if you still think that working with BigQuery directly is not the best option for you, can always forward your requests to the Engineering team by creating a Feature Request in the Public Issue Tracker for BigQuery, although it will be in hands of the engineering team whether to decide if (and when) to implement such a feature, even more considering the complexity of BigQuery and that its performance is optimized for working in its current architecture.在任何情况下,如果您仍然认为直接使用 BigQuery 不是您的最佳选择,可以随时通过在 BigQuery 的公共问题跟踪器中创建功能请求将您的请求转发给工程团队,尽管它将由工程团队是否决定是否(以及何时)实现这样的功能,甚至更多地考虑 BigQuery 的复杂性以及它的性能针对在其当前架构中的工作进行了优化。

This is an old post but if you can use Python and you plan to test your SQL and assert your result based on input, I would suggest bq-test-kit .这是一篇旧文章,但如果您可以使用 Python 并且您计划测试您的 SQL 并根据输入断言您的结果,我建议使用 bq-test-kit This framework allows you to interact with BigQuery in Python and make tests reliables.该框架允许您在 Python 中与 BigQuery 交互并使测试可靠。

You have 3 ways to inject data into it:您可以通过 3 种方式向其中注入数据:

  • Create datasets and tables with an ability to isolate their name and therefore have your own namespace创建能够隔离名称的数据集和表,因此拥有自己的命名空间
  • Rely on temp tables, where data is inserted with data literals依赖临时表,其中数据与数据文字一起插入
  • data literal merged into your query数据文字合并到您的查询中

Hope that this helps.希望这会有所帮助。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何通过 API 或 CLI 在 Google BigQuery 中取消授权查看 - How can I unathorized view in Google BigQuery via API or CLI 如何在 Google App Script 中将 BigQuery 查询作为数组获取? - How can I get a BigQuery query as an array in Google App Script? 如何禁用谷歌云平台集成? - How to disable Google Cloud Platform integration? 如何将 BigQuery 视图作为 csv 文件传输到 Google Cloud Storage 存储桶 - How to Transfer a BigQuery view to a Google Cloud Storage bucket as a csv file 如何在 BigQuery 中创建外部数据源并连接到 composer cloud sql? - How can I create external data source in BigQuery and connect to composer cloud sql? 如何限制谷歌云平台“BigQuery Metadata Viewer”权限? - How to limit Google Cloud Platform "BigQuery Metadata Viewer" permission? 我如何在 google BigQuery 上输入 pivot? - how do I pivot this on google BigQuery? BigQuery 中的循环 (SQL - GOOGLE CLOUD) - Loop in BigQuery (SQL - GOOGLE CLOUD) Google Cloud 中的数据验证 - BigQuery - Data validation in Google Cloud - BigQuery 如何自动将数据加载到 Google Cloud Storage 中? - How can I automate data loading into Google Cloud Storage?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM