Getting started¶
Before you start¶
You need three things from Quickbase:
- Your realm, the
acmeinacme.quickbase.com. - A user token with access to your app. Quickbase explains how to create one in its authentication docs. Treat it like a password, and give it access to as few apps as possible.
- Your app's ID, which appears in the app's URL and usually starts with
b.
Install¶
pip install pyquickbase==1.0.0rc13
Read some records¶
Both clients have the same API. Use the sync client for scripts and notebooks, and the async client in applications that already use asyncio or Trio.
from pyquickbase import F, Quickbase
with Quickbase(realm="acme", token="your_user_token") as qb:
tasks = qb.app("bq1234567").table("Tasks")
for task in tasks.query(where=F("Status") == "Done", select=["Title"]):
print(task.id, task["Title"])
from pyquickbase import AsyncQuickbase, F
async with AsyncQuickbase(realm="acme", token="your_user_token") as qb:
tasks = qb.app("bq1234567").table("Tasks")
async for task in tasks.query(where=F("Status") == "Done", select=["Title"]):
print(task.id, task["Title"])
To keep the token out of your code, set QB_REALM and QB_USER_TOKEN in the environment and use
Quickbase.from_env().
from pyquickbase import Quickbase
with Quickbase.from_env() as qb:
print(qb.app("bq1234567").info().name)
Write a record¶
tasks.insert([{"Title": "Pour slab", "Status": "Not Started"}])
How the objects fit together¶
A client gives you apps, an app gives you tables, and a table gives you its records, fields, reports, and operations. Getting an app or a table sends nothing. They're checked when first used.
flowchart TD
QB["<b>Quickbase</b><br/>the client"] -- "qb.app(id)" --> App[<b>App</b>]
App -- "app.table(name)" --> T[<b>Table</b>]
T --> TO["records, fields,<br/>reports, operations"]
Next steps¶
- Reading records covers queries, paging, and record values.
- Writing records covers inserts, updates, upserts, and deletes.
- Handling errors lists what can go wrong.