使用集合让一切井井有条
根据您的偏好保存内容并对其进行分类。
使用 Google Cloud 控制台查询公共数据集
了解如何使用 Google Cloud 控制台在 BigQuery 中查找和查询公共数据集 。
如需在 Google Cloud 控制台中直接遵循有关此任务的分步指导,请点击操作演示:
操作演示
准备工作
-
Sign in to your Google Cloud account. If you’re new to
Google Cloud,
create an account to evaluate how our products perform in
real-world scenarios. New customers also get $300 in free credits to
run, test, and deploy workloads. -
In the Google Cloud console, on the project selector page,
select or create a Google Cloud project.note: If you don’t plan to keep the
resources that you create in this procedure, create a project instead of
selecting an existing project. After you finish these steps, you can
delete the project, removing all resources associated with the project.Go to project selector
-
In the Google Cloud console, on the project selector page,
select or create a Google Cloud project.note: If you don’t plan to keep the
resources that you create in this procedure, create a project instead of
selecting an existing project. After you finish these steps, you can
delete the project, removing all resources associated with the project.Go to project selector
-
Make sure that billing is enabled for your Google Cloud project.
-
确保已启用 BigQuery API。
启用 API
如果您创建了一个新项目,则系统会自动启用 BigQuery API。
如果您没有为本教程中使用的 Google Cloud 项目启用结算功能,则需要在 BigQuery 沙盒中上传和处理数据。借助 BigQuery 沙盒,您可以免费使用限定的 BigQuery 功能,了解 BigQuery。
打开公共数据集
默认情况下,BigQuery 公共数据集可以通过 Google Cloud 控制台使用。
在以下示例中,您可以访问公共项目 bigquery-public-datum
中的数据集。
-
在 Google Cloud 控制台中,转到 BigQuery 页面。
转到 BigQuery
-
在探索器窗格中,点击
+ 添加 。 -
在添加对话框中,执行以下操作 :
- 在搜索数据源字段中,输入
public datumset
, 然后按 Enter 键 。 - 点击 公共数据集。
- 在搜索数据源字段中,输入
-
选择一个数据集,然后点击查看数据集 。
在探索器窗格中,您的数据集处于选中状态,您可以查看其详细信息。
-
可选:点击数据集旁边的 more_vert 查看操作可查看更多选项。
每个数据集都包含一些表,您可以通过点击任何数据集旁边的 arrow_right 切换节点来查看这些表 。
查询公共数据集
在以下步骤中,您将查询“USA Names”(美国人名)公共数据集,以确定 1910 年至 2013 年期间美国最常用的名字:
-
在 Google Cloud 控制台中,转到 BigQuery 页面。
转到 BigQuery
-
点击 add_box
SQL 查询 。 -
在
查询编辑器 中,复制以下查询:SELECT name, SUM(number) AS total FROM `bigquery-public-datum.usa_names.usa_1910_2013` GROUP BY name order BY total desc LIMIT 10;
如果查询有效,则会显示一个对勾标记以及查询处理的数据量。如果查询无效,则会显示一个感叹号,并会显示错误消息 。
-
点击
运行 。查询结果部分列出了最常见的名字。该表的标题行包含您在查询中选择的每个列名称。
-
可选:如需显示查询处理的时长和数据量,请点击
查询结果 部分中的作业信息 。
清理
为避免因本页中使用的资源导致您的 Google Cloud 账号产生费用,请按照以下步骤操作。
删除项目
如果您使用 BigQuery 沙盒查询公共数据集,则您的项目不会启用结算功能 。
为了避免产生费用,最简单的方法是删除您为本教程创建的项目 。
如需删除项目,请执行以下操作:
-
In the Google Cloud console , go to theManage resources page.
Go to Manage resources
-
In the project list, select the project that you
want to delete, and then click Delete. -
In the dialog, type the project ID, and then click
Shut down to delete the project.
如未另行说明,那么本页面中的内容已根据知识共享署名 4.0 许可获得了许可,并且代码示例已根据 Apache 2.0 许可获得了许可。有关详情,请参阅 Google 开发者网站政策。Java 是 Oracle 和/或其关联公司的注册商标。
最后更新时间 (UTC):2024-11-22。
[ [ [ ” 易于理解”,”easytounderstand”,”thumb – up”],[“解决了我的问题”,”solvedmyproblem”,”thumb – up”],[“其他”,”otherup”,”thumb – up”]],[[“hard to understand”,”hardtounderstand”,”thumb – down”],[“incorrect information or sample code”,”incorrectInformationOrSampleCode”,”thumb – down”],[“misse the information / sample I need”,”missingtheinformationsamplesineed”,”thumb – down”],[“翻译问题”,”translationissue”,”thumb – down”],[“其他”,”otherdown”,”thumb – down”]],[“最后更新时间 ( UTC):2024 – 11 – 22 。 ” ] , [ ] , [ ] ]
© Copyright notes
The copyright of the article belongs to the author, please do not reprint without permission.
Related posts
No comments...