How to turn an Airtable base into a SQLite database
By airtable.download, an independent service, not affiliated with Airtable · Updated 13 November 2026
Airtable has no SQL export. A free script puts a whole base into one SQLite file. Or we make the file for you, with a join table for every link, the comments and the attachment files.
We make one ZIP of your whole base: every table as Excel, CSV, JSON and SQLite, with the attachment files and the comments. $29 once per base.
The only file Airtable downloads is a CSV of one view, and "Each table in a base will need to be downloaded as its own CSV" (Airtable, Getting started with views).
Its API has everything a database needs: every record of every table, and the schema that says which field links to which table. SQLite is the simplest place to put it: one file, no server, and every SQL tool opens it.
A script, free
It makes base.sqlite with one table per Airtable table. It is one file and needs only Python:
SQLite comes with it.
# to_sqlite.py: every table of an Airtable base in one SQLite file
import json, os, sqlite3, time
import urllib.parse, urllib.request
TOKEN = os.environ["AIRTABLE_TOKEN"] # a token that can only read
BASE = os.environ["AIRTABLE_BASE"] # the id that starts with "app"
API = "https://api.airtable.com/v0"
def get(path, params=None):
url = f"{API}/{path}"
if params:
url += "?" + urllib.parse.urlencode(params)
head = {"Authorization": f"Bearer {TOKEN}"}
time.sleep(0.25) # Airtable allows 5 requests a second
with urllib.request.urlopen(urllib.request.Request(url, headers=head)) as r:
return json.load(r)
def records(table_id):
offset = None
while True:
page = get(f"{BASE}/{table_id}", {"offset": offset} if offset else None)
yield from page["records"]
offset = page.get("offset")
if not offset:
return
def cell(v):
# SQLite holds text and numbers; a list or an object becomes JSON text.
if isinstance(v, bool):
return int(v)
return json.dumps(v) if isinstance(v, (list, dict)) else v
def q(name):
return '"' + name.replace('"', '""') + '"'
if os.path.exists("base.sqlite"):
os.remove("base.sqlite")
db = sqlite3.connect("base.sqlite")
for t in get(f"meta/bases/{BASE}/tables")["tables"]:
names = [f["name"] for f in t["fields"]]
cols = ", ".join(q(n) for n in names)
db.execute(f"CREATE TABLE {q(t['name'])} (_record_id TEXT PRIMARY KEY, {cols})")
marks = ", ".join("?" * (len(names) + 1))
n = 0
for r in records(t["id"]):
row = [r["id"]] + [cell(r["fields"].get(name)) for name in names]
db.execute(f"INSERT INTO {q(t['name'])} VALUES ({marks})", row)
n += 1
print(t["name"], n, "records")
db.commit()
Make a token with the scopes data.records:read and schema.bases:read, then
AIRTABLE_TOKEN=pat... AIRTABLE_BASE=app... python3 to_sqlite.py
sqlite3 base.sqlite ".tables"
Where it stops:
- A link is a list of IDs in a text cell, such as
["reckqHfpN7BB1ZP3F"]. You can join on it with SQLite'sjson_each, which is slower and harder to read than a join table. - Columns have no types. Numbers arrive as numbers and the rest as text; nothing says "this is a date" or "this is a currency".
- A formula field holds its result, not the formula. The formula is in the schema (how to export it).
- No comments and no attachment files. Each is another script: comments, attachments.
If you would rather not write Python, airtable-export
is a free command-line tool that writes a SQLite file itself, with its --sqlite option: one table
for each Airtable table. Like the script, it does not download files or comments.
The finished file
This is what we make: the whole base as one ZIP, $29 once per base, no account. In
it is a .sqlite file with
- every table, with
_record_idand_created_timeon each row - a join table for every linked field, named
<Table>__<Field>, withfrom_id,to_idandposition, indexed both ways, so a link is an ordinary SQL join - each linked field also as text, with the linked records' names, so a table reads on its own
- three more tables:
_comments,_attachments,_schema(every field, its type, its formula) - next to it in the ZIP: the same data as Excel, CSV and JSON, and the attachment files
For our download, make the token as the token guide shows: it adds a third scope,
data.recordComments:read. With the two scopes above, the ZIP comes without the comments.
On the sample base, which you can download and open yourself, each project with its client:
SELECT p.Project, c.Name AS client, c.Country
FROM Projects p
JOIN Projects__Client l ON l.from_id = p._record_id
JOIN Clients c ON c._record_id = l.to_id;
| Project | client | Country |
|---|---|---|
| New brand identity | Harbour & Pine Bakery | Portugal |
| Online shop | Harbour & Pine Bakery | Portugal |
| Harvest report 2026 | Monte Verde Coffee | Colombia |
See your own base first
Paste a read-only token: you see your tables and rows before you pay anything.
You see your base before you pay · $29 once per base
Read-only: the token cannot change your base. We delete it when your download is built, or after 24 hours. Privacy
From SQLite to Postgres or MySQL
A SQLite file is a good halfway house. pgloader loads one into Postgres in a single command, and most database tools import it directly. Moving the data is the small half of leaving a tool like Airtable; the views, forms and automations have to be rebuilt wherever you go.
If you need the database kept up to date
Then you want a sync service, not a download. A one-time file is for a copy, an archive, an analysis or a move.