GitHub Gist: instantly share code, notes, and snippets. Airtable content on DEV.
Latest versionReleased:
Python client library for AirTable
Project description
Python interface to the Airtable's REST API - https://airtable.com -
For javascript enthusiasts: https://github.com/Airtable/airtable.js
Installation
Airtable Python uses Requests.py:make sure you have it installed by running
Getting started
Once you have created a newbaseand a new table through the Web interface, you're ready to start usingAirtable Python.
Here's an example of response from the Restaurant's example base
API Reference
The available methods closely mimick the RESTAPI:
Get
Given a table name, fetched one or multiple records.
where
Iterate
Given a table name, fetched all records.
where
Note: this returns a generator instead, which you can use to loopeach record:
Create
Creates a new entry in a table, and returns the newly created entry withits new ID.
where
Update
Updates some fields in a specific entry in the table. Fields which arenot explicitely included will not get updated
where
Update All
Like the previous method, but updates all fields, clearing the ones thatare not included in the request.
Delete
Delete a specific record from the table
where
Release
To release, tag the Git repo with a new version number, push that tag to GitHub then Travis CI willdo the rest.
Release historyRelease notifications | RSS feed
0.4.8
0.4.4
0.4.3
0.4.2
0.4.1
0.4.0
0.3.1
0.3.0
0.2.0
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Filename, size | File type | Python version | Upload date | Hashes |
---|---|---|---|---|
Filename, size airtable-0.4.8-py2.py3-none-any.whl (8.1 kB) | File type Wheel | Python version py2.py3 | Upload date | Hashes |
Filename, size airtable-0.4.8.tar.gz (13.0 kB) | File type Source | Python version None | Upload date | Hashes |
Hashes for airtable-0.4.8-py2.py3-none-any.whl
Algorithm | Hash digest |
---|---|
SHA256 | d653e1b3b92297e3f0cc4226215d43d7fa99c72f38918e9371e445abf0baa70c |
MD5 | 05e77d076ea5add5531f3f55395a5a4d |
BLAKE2-256 | ec2be5885493796ae222eac6d15ffab093cce8fe63bf10ee920ac205fa65e279 |
Hashes for airtable-0.4.8.tar.gz
Algorithm | Hash digest |
---|---|
SHA256 | fb667e55da3af1341e0f2946014cc29e7d0613e69f3ee20528051c4075aee75c |
MD5 | 61ae59bd2af5e8ef57aaa88d2793c52e |
BLAKE2-256 | 6ce6da9c7438fbb4100eb915fca9c431df5c60614a1debf5da899c9d2d7adb68 |
Released:
Export Airtable data to files on disk
Project description
Export Airtable data to files on disk
Installation
Install this tool using pip
:
Usage
You will need to know the following information:
- Your Airtable base ID - this is a string starting with
app...
- Your Airtable API key - this is a string starting with
key...
- The names of each of the tables that you wish to export
You can export all of your data to a folder called export/
by running the following:
This example would create two files: export/table1.yml
and export/table2.yml
.
Rather than passing the API key using the --key
option you can set it as an environment variable called AIRTABLE_KEY
.
Export options
By default the tool exports your data as YAML.
You can also export as JSON or as newline delimited JSON using the --json
or --ndjson
options:
You can pass multiple format options at once. This command will create a .json
, .yml
and .ndjson
file for each exported table:
SQLite database export
You can export tables to a SQLite database file using the --sqlite database.db
option:
This can be combined with other format options. If you only specify --sqlite
the export directory argument will be ignored.
The SQLite database will have a table created for each table you export. Those tables will have a primary key column called airtable_id
.
If you run this command against an existing SQLite database records with matching primary keys will be over-written by new records from the export.
Request options
By default the tool uses python-httpx's default configurations.
Github Air Tablet
You can override the user-agent
using the --user-agent
option:
You can override the timeout during a network read operation using the --http-read-timeout
option. If not set, this defaults to 5s.
Running this using GitHub Actions
GitHub Actions is GitHub's workflow automation product. You can use it to run airtable-export
in order to back up your Airtable data to a GitHub repository. Doing this gives you a visible commit history of changes you make to your Airtable data - like this one.
To run this for your own Airtable database you'll first need to add the following secrets to your GitHub repository:
- AIRTABLE_BASE_ID
- The base ID, a string beginning `app...`
- AIRTABLE_KEY
- Your Airtable API key
- AIRTABLE_TABLES
- A space separated list of the Airtable tables that you want to backup. If any of these contain spaces you will need to enclose them in single quotes, e.g. 'My table with spaces in the name' OtherTableWithNoSpaces
Once you have set those secrets, add the following as a file called .github/workflows/backup-airtable.yml
:
This will run once a day (at 32 minutes past midnight UTC) and will also run if you manually click the 'Run workflow' button, see GitHub Actions: Manual triggers with workflow_dispatch.
Development
To contribute to this tool, first checkout the code. Then create a new virtual environment:
Or if you are using pipenv
:
Now install the dependencies and tests:
To run the tests:
Release historyRelease notifications | RSS feed
0.7.1
0.7
Github Airtable Integration
0.6
0.5
0.4
0.3.1
0.3
0.2
Airtable Sdk
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Filename, size | File type | Python version | Upload date | Hashes |
---|---|---|---|---|
Filename, size airtable_export-0.7.1-py3-none-any.whl (9.8 kB) | File type Wheel | Python version py3 | Upload date | Hashes |
Filename, size airtable-export-0.7.1.tar.gz (5.7 kB) | File type Source | Python version None | Upload date | Hashes |
Hashes for airtable_export-0.7.1-py3-none-any.whl
Algorithm | Hash digest |
---|---|
SHA256 | 803f2578c6c689ab07c758d7d4599f77e28630037bc7318471ba688565c347db |
MD5 | 5bc5e1cb712e9c1c6aa364cf4d689711 |
BLAKE2-256 | 945e014144e1f70bd7e6d72c179b3fadb3f5e2bda10393eb175bc3e54b036e5d |
Github Airtable Tutorial
Hashes for airtable-export-0.7.1.tar.gz
Github Airtable Extension
Algorithm | Hash digest |
---|---|
SHA256 | 1dd3e6434d97c86eac9bd1c95b33ee8c29b1f58c1f1684a4f9ca541533b9c4c1 |
MD5 | 3d692601e7abc046231eee107de6b562 |
BLAKE2-256 | d44f897f00a5cc50baccd793027554b5e5b094109e8e69167da22a13316fa34a |