Skip to main content

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 entities
  • mathesar_client.client_raw: Low-level raw client mapping API methods 1:1
  • mathesar_client.client: High-level client with Database → Schema → Table hierarchy 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.

Metadata

Release files for mathesar-client 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for mathesar-client 0.1.0
File Size Uploaded
mathesar_client-0.1.0.tar.gz 31.9 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for mathesar-client 0.1.0
File Interpreter ABI Platform
mathesar_client-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 64.4 kB

Release files / mathesar_client-0.1.0.tar.gz

Download URL mathesar_client-0.1.0.tar.gz
Size 31.9 kB
Tags Source
SHA-256 checksum
How to use checksums
03d8dd068f1a75a66986417b16208289f89e52f00260c36b33cff94c2b9e7602
BLAKE2b-256 checksum
How to use checksums
ed17cd9671fd2ca7941588479679d8296aead1b1928619d74a651b795c5e26b5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 2, 2025.

Transparency log

Release files / mathesar_client-0.1.0-py3-none-any.whl

Download URL mathesar_client-0.1.0-py3-none-any.whl
Size 32.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
d93d38ccd56e6543b48e23890dabcaea55e5eb5245b8b0c3e7adee7baee1c38d
BLAKE2b-256 checksum
How to use checksums
8788efc44e3a9c50f1ab785b694f090a29e2e7cb81e72d1590e38e3e26f140a6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/6.1.0 CPython/3.13.7

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Nov 2, 2025.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page