Skip to main content

Python client for Quickbase structural operations, trustees management, schema backups, and schema exporting

Project description

QuickBase-Structure-Client

Python client for Quickbase structural administration: apps, tables, fields, relationships, trustees, Solutions/QBL exports, and schema snapshots.

This package is intended to pair with quickbase-data-client. The data client handles records, reports, files, and pandas workflows. This structure client focuses on administration and schema lifecycle work.

Documentation

See the documentation index for all guides:

See the changelog for notable changes.

Installation

pip install quickbase-structure-client

For local development:

python -m pip install -e ".[dev]"
pytest

Quickstart

import os

from quickbase_structure_client import Auth, QuickBaseStructureClient

auth = Auth(
    os.environ["QUICKBASE_REALM_HOSTNAME"],
    os.environ["QUICKBASE_USER_TOKEN"],
)
client = QuickBaseStructureClient(auth, auto_backup=False)

app = client.create_app("Managed Operations", description="Built by automation")
orders = app.create_table(
    "Order",
    plural_name="Orders",
    single_record_name="Order",
)

orders.create_field(
    "Total",
    "currency",
    {"description": "Order total"},
)

schema = client.exporter.compile_schema(app.id)
print(client.exporter.to_markdown(schema))

Schema Export

Use the standalone example to export an existing application's tables, fields, formulas, and relationships to both JSON and Markdown:

$env:QUICKBASE_REALM_HOSTNAME = "example.quickbase.com"
$env:QUICKBASE_USER_TOKEN = "qb-user-token"
python examples/export_schema.py --app-id "your-app-id"

By default, the files are written to schema_exports/<app-id>_schema.json and schema_exports/<app-id>_schema.md. Use --output-dir to choose another directory:

python examples/export_schema.py --app-id "your-app-id" --output-dir "exports"

The same API can be used directly:

from pathlib import Path

schema = client.exporter.compile_schema("your-app-id")
client.exporter.to_json(schema, Path("exports/schema.json"))
client.exporter.to_markdown(schema, Path("exports/schema.md"))

Pass table_id="your-table-id" to compile_schema to export only one table. The example command provides the equivalent --table-id "your-table-id" option.

Solutions / QBL

Solution creation accepts the raw QBL document required by Quickbase:

from pathlib import Path

qbl = Path("solution.qbl").read_text(encoding="utf-8")
result = client.solutions.create_solution(qbl)

Auto Backup

auto_backup=True is the default. Mutating app/table/field/relationship/trustee calls trigger a pre-change and post-change backup.

client = QuickBaseStructureClient(
    auth,
    auto_backup=True,
    backup_method="schema",
    backup_solution_id="solution-id",
    backup_dir="backups",
)

If backup_method="schema" has no backup_solution_id and fallback is enabled, the client falls back to app cloning. Internal backup calls suppress their own backup hooks to avoid recursive clone storms.

PTO Demo

The demo script builds a small PTO tracking app with a Users table, a PTO Events table, fields, an optional relationship, optional trustee access, and schema exports.

Copy the sample environment file and fill in real Quickbase credentials:

Copy-Item .env.example .env

Preview the plan without creating anything:

python examples/pto_tracking_demo.py --env-file .env

Create the live Quickbase app:

python examples/pto_tracking_demo.py --env-file .env --execute

You can also set QUICKBASE_DEMO_EXECUTE=true in .env. The script refuses to execute with placeholder credentials from .env.example.

If Quickbase returns User token is invalid, verify that:

  • QUICKBASE_REALM_HOSTNAME is the same realm where the token was generated.
  • QUICKBASE_USER_TOKEN is a user token, not an app token.
  • QUICKBASE_DEMO_ASSIGN_TOKEN=true when creating a new demo app. User tokens are scoped to assigned apps, so a token can create an app but still fail on table/field calls unless it is assigned to that new app.
  • The value has no quotes, comments, or copied label text around it.
  • The token's user has permission to create apps in that realm.

If Quickbase returns Extraneous key 'description' is not permitted while creating fields, use fieldHelp instead of description. The client maps description to fieldHelp for field create/update convenience.

Supported Surface

  • Core sync client: QuickBaseStructureClient
  • Request tuning: RequestConfig
  • App wrapper: StructureApp
  • Table wrapper: StructureTable
  • Field wrapper: StructureField
  • Relationship wrapper: StructureRelationship
  • Trustee manager: TrusteesManager
  • Solutions/QBL manager: SolutionsManager
  • Schema exporter: SchemaExporter

Notes

  • Python 3.10+ is required.
  • Tests are mock-based and validate payload/method composition plus local backup behavior. They do not prove live tenant permissions or endpoint availability.
  • Destructive app deletion requires the app name as confirmation because the Quickbase API requires that confirmation payload.

DISCLAIMER

This project was made primarily through the use of LLMs. As a result its code is open and available for all.

License

The Unlicense. See LICENSE.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

quickbase_structure_client-0.1.4.tar.gz (36.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

quickbase_structure_client-0.1.4-py3-none-any.whl (33.1 kB view details)

Uploaded Python 3

File details

Details for the file quickbase_structure_client-0.1.4.tar.gz.

File metadata

File hashes

Hashes for quickbase_structure_client-0.1.4.tar.gz
Algorithm Hash digest
SHA256 307a5b1c36cd0bc6d9de201c9f57728bcdc4e14c022d9f386fed348751dee85f
MD5 10878f4f0a341c115468edefc19950a1
BLAKE2b-256 b10eeb4a85d749078a21f6b585819d0ce61013a92431dbcbe2b866d7bd593954

See more details on using hashes here.

Provenance

The following attestation bundles were made for quickbase_structure_client-0.1.4.tar.gz:

Publisher: build_and_publish.yml on Derek-Banker/QuickBase-Structure-Client

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file quickbase_structure_client-0.1.4-py3-none-any.whl.

File metadata

File hashes

Hashes for quickbase_structure_client-0.1.4-py3-none-any.whl
Algorithm Hash digest
SHA256 85dd2d96b70205ddea58027a3b11a242b34b7cebaafa00ac4bbea371ea83040b
MD5 1f67a93354ebbabd26cf97b15dadf8da
BLAKE2b-256 c1346ccd73d518a9f4a70b9647ecae17a0937ce430b64b55b67307a61f447e09

See more details on using hashes here.

Provenance

The following attestation bundles were made for quickbase_structure_client-0.1.4-py3-none-any.whl:

Publisher: build_and_publish.yml on Derek-Banker/QuickBase-Structure-Client

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page