如何使用Airtable和Python构建轻量级数据管道

本文展示了如何使用Airtable Python API构建简单的,类似ETL的管道,并坚持使用无动层。

来源:KDnuggets
编辑图片| chatgpt

#简介

Airtable不仅提供了一个灵活的电子表格状界面,用于数据存储和分析,还为程序化交互提供了API。换句话说,您可以将其连接到外部工具和技术(例如Python)来构建数据管道或处理工作流程,将结果带回您的可用数据库(或简单地使用“基础”,在可用的术语中)。

airtable python

本文演示了如何使用Airtable Python API创建简单的ETL样管道。我们将坚持自由层,以确保该方法没有付费功能。

#airtable数据集设置

While the pipeline built in this article can be easily adapted to a variety of datasets, for those new to Airtable and needing an Airtable project and stored dataset as a starting point, we recommend you follow this recent introductory tutorial to Airtable and create a tabular dataset called "Customers", containing 200 rows and the following columns (see image):

最新介绍性启动教程
airtable中的客户数据集/表|作者的图像

#airtable-python数据管道

在Airtable中,转到您的用户头像 - 在撰写本文时,它是位于应用程序接口左下角的盘旋头像,然后选择“ Builder Hub”。在新屏幕中(请参阅下面的屏幕截图),单击“个人访问令牌”,然后在“创建令牌”上。给它一个名称,并确保至少添加这两个范围:data.records:read and data.records:write。同样,选择客户表位于“访问”部分中的基础,以便您的令牌配置了对此基础的访问。

data.records:read data.records:写
创建一个可通行的API令牌|作者的图像

创建令牌后,将其仔细地复制和存储在安全的地方,因为它将仅显示一次。我们稍后需要。令牌从PAT开始,然后是长时间的字母数字代码。

pat https://airtable.com/app [xxxxxx xxxxxxxxxxxx App [xxxx] / < / div> .env pandas get()