A Python client for Mathesar API
Project description
Mathesar Python Client
A typed, ergonomic Python client for the Mathesar JSON-RPC API.
- Transport: JSON-RPC over HTTP
- Auth: Basic auth (username/password)
- Python: 3.13+
- Dependencies: pydantic v2, requests
Quick start
from mathesar_client import MathesarClient
# Configure base URL and credentials via env or initialize the raw client accordingly
client = MathesarClient() # uses defaults from MathesarClientRaw()
# Work with a database
db = client.database(database_id=1)
# Schemas
schemas = db.list_schemas()
public = db.schema_by_name("public")
# Tables
users = public.table_by_name("users")
# Records: returns column names and inlines linked summaries
page = users.records_list(limit=10, order_by=[("id", "asc")])
for row in page.results:
print(row)
# Add a record using column names
new_row = users.record_add({
"email": "jane@example.com",
"full_name": "Jane Doe",
})
# Columns: create a UUID primary key
users.add_primary_key_column(pkey_type="UUIDv4", name="id")
# Constraints: add a unique constraint on email
users.add_unique_constraint(columns=["email"], name="uq_users_email")
# Data modeling: suggest types for a table
suggested = users.suggest_types()
print(suggested)
Package layout
mathesar_client.client_raw_models: Pydantic models for all API entitiesmathesar_client.client_raw: Low-level raw client mapping API methods 1:1mathesar_client.client: High-level client withDatabase → Schema → Tablehierarchy and QoL
Notes
- The high-level client resolves column names↔attnums automatically where relevant.
- Record lists are enriched with column names and inline linked summaries when requested.
- For foreign keys, referent table column identifiers are passed as-is; if you prefer names, resolve them with that table's column cache.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file mathesar_client-0.1.0.tar.gz.
File metadata
- Download URL: mathesar_client-0.1.0.tar.gz
- Upload date:
- Size: 31.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
03d8dd068f1a75a66986417b16208289f89e52f00260c36b33cff94c2b9e7602
|
|
| MD5 |
633095fb3ca665c6cc2f121874d5d9bb
|
|
| BLAKE2b-256 |
ed17cd9671fd2ca7941588479679d8296aead1b1928619d74a651b795c5e26b5
|
Provenance
The following attestation bundles were made for mathesar_client-0.1.0.tar.gz:
Publisher:
pypi-deploy.yml on esoadamo/mathesar-client
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mathesar_client-0.1.0.tar.gz -
Subject digest:
03d8dd068f1a75a66986417b16208289f89e52f00260c36b33cff94c2b9e7602 - Sigstore transparency entry: 661402897
- Sigstore integration time:
-
Permalink:
esoadamo/mathesar-client@f97aaf58fd0ef79725de5448a40436249455923c -
Branch / Tag:
refs/heads/main - Owner: https://github.com/esoadamo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-deploy.yml@f97aaf58fd0ef79725de5448a40436249455923c -
Trigger Event:
push
-
Statement type:
File details
Details for the file mathesar_client-0.1.0-py3-none-any.whl.
File metadata
- Download URL: mathesar_client-0.1.0-py3-none-any.whl
- Upload date:
- Size: 32.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d93d38ccd56e6543b48e23890dabcaea55e5eb5245b8b0c3e7adee7baee1c38d
|
|
| MD5 |
50ab9055645fdae4e5949f447e068655
|
|
| BLAKE2b-256 |
8788efc44e3a9c50f1ab785b694f090a29e2e7cb81e72d1590e38e3e26f140a6
|
Provenance
The following attestation bundles were made for mathesar_client-0.1.0-py3-none-any.whl:
Publisher:
pypi-deploy.yml on esoadamo/mathesar-client
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
mathesar_client-0.1.0-py3-none-any.whl -
Subject digest:
d93d38ccd56e6543b48e23890dabcaea55e5eb5245b8b0c3e7adee7baee1c38d - Sigstore transparency entry: 661402904
- Sigstore integration time:
-
Permalink:
esoadamo/mathesar-client@f97aaf58fd0ef79725de5448a40436249455923c -
Branch / Tag:
refs/heads/main - Owner: https://github.com/esoadamo
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-deploy.yml@f97aaf58fd0ef79725de5448a40436249455923c -
Trigger Event:
push
-
Statement type: