bigquery使用教程_如何使用Python和Google BigQuery构建机器人以自动执行您的笨拙任务...

2023-10-26

bigquery使用教程

Do you have repetitive tasks? Something that you do regularly, every week or even every day? Reporting might be one of your weekly or daily tasks. You query or ask for the data, and do some visualizations, then give it to your boss. What if, instead of doing it manually, you were to automate it so you don’t have to do the boring stuff, and you can use your precious time to do other things?

您有重复的任务吗? 您每周,甚至每天都定期做些什么? 报告可能是您每周或每天的任务之一。 您查询或索要数据,并进行一些可视化处理,然后将其提供给老板。 如果不是要手动执行操作,而是要自动执行操作,这样就不必做无聊的事情,而您可以利用宝贵的时间做其他事情怎么办?

In this tutorial, we are going to make a Telegram Bot that will automate the boring parts of your job — reporting. Oh, and did I mention that it won’t take more than 50 lines of code to build it? ;)

在本教程中,我们将制作一个Telegram Bot,它将自动执行您工作中无聊的部分-报告。 哦,我是否提到过构建它不会花费超过50行代码? ;)

If this is your first time building a Telegram Bot, you might want to read this post first.

如果这是您第一次构建Telegram Bot,则可能需要先阅读这篇文章

入门 (Getting started)

1.安装库 (1. Install the libraries)

We are going to use google-cloud-bigquery to query the data from Google BigQuery. matplotlib, numpy and pandas will help us with the data visualization. python-telegram-bot will send the visualization image through Telegram Chat.

我们将使用google-cloud-bigquery从Google BigQuery查询数据。 matplotlibnumpypandas将帮助我们进行数据可视化。 python-telegram-bot将通过Telegram Chat发送可视化图像。

pip3 install google-cloud-bigquery matplotlib numpy pandas python-telegram-bot
2.启用Google BigQuery API (2. Enable Google BigQuery API)

We need to enable the Google BigQuery API first if we want to use the service.

如果要使用该服务,我们需要先启用Google BigQuery API。

Go to Google Developers Console and create a new project (or select the one you have).

转到Google Developers Console并创建一个新项目(或选择您拥有的项目)。

In the project dashboard, click ENABLE APIS AND SERVICES, and search for BigQuery API.

在项目仪表板中,单击“ 启用 API 和服务” ,然后搜索BigQuery API。

Click ENABLE to enable the API.

单击启用以启用API。


3.创建服务帐户密钥 (
3. Create the service account key)

If we want to use Google Cloud services like Google BigQuery, we need a service account key. This is like our credenti

本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

bigquery使用教程_如何使用Python和Google BigQuery构建机器人以自动执行您的笨拙任务... 的相关文章

随机推荐