Skip to main content

Awesome simple_baserow_api created by KuechlerO

Project description

simple_baserow_api

A lightweight Python wrapper for the Baserow REST API, developed by Oliver Kuechler, forked from xiamaz' python-baserow-simple.

📚 Full documentation available at: simple_baserow_api Documentation

🚀 Installation

pip install simple_baserow_api

🔧 Features

  • Intuitive access to Baserow tables, fields, and rows
  • Reading and writing table data (single and batch)
  • Field metadata, writable-field detection, and read-only handling
  • Optional linked-row resolution and field include/exclude
  • Lookup rows by column value (find_entries)
  • Synchronize / upsert a row from one table into another (synchronize_data)
  • Optional field-compatibility checks when writing
  • JWT login helpers and schema operations (create/delete database & tables)

🛠️ Basic Usage

1. Initialize the API

Database token (row data)

from simple_baserow_api import BaserowApi

api = BaserowApi(
    database_url="https://api.baserow.io",  # or your self-hosted URL
    token="your-database-token",
)

JWT from email / password (needed for schema changes)

api = BaserowApi.from_credentials(
    database_url="https://api.baserow.io",
    email="you@example.com",
    password="secret",
)

2. Retrieve Table Metadata

Get All Field Definitions

fields = api.get_fields(table_id=1)

Get Writable Fields (excluding read-only)

Some fields are read-only and cannot be written to (e.g. formula fields). This is useful when you want to add a new row to a table.

writable_fields = api.get_writable_fields(table_id=1)

Output

[
    {
        "id": 1,
        "table_id": 1,
        "name": "Name",
        "order": 0,
        "type": "text",
        "primary": True,
        "read_only": False,
        "description": None,
        "text_default": ""
    },
    ...
]

3. Read Table Data

Get All Rows

rows = api.get_data(table_id=1, writable_only=True)
# -> {row_id: {"Name": "...", ...}, ...}

Get a Single Row by ID

row = api.get_entry(table_id=1, row_id=1)

Find Rows by Column Value

matches = api.find_entries(table_id=1, column="Individuum ID", value="ABC-123")
# -> {row_id: {...}, ...}

4. Write Data

Add a New Row

row_id = api.add_data(table_id=1, data={"Name": "value"})

Update an Existing Row

row_id = api.add_data(table_id=1, row_id=1, data={"Name": "new_value"})

Field Compatibility Check

Validate that payload keys exist on the table before writing. On mismatch: warn (default) or raise when fail_on_error=True.

row_id = api.add_data(
    table_id=1,
    data={"Name": "value", "UnknownField": "x"},
    check_field_compatibility=True,
    fail_on_error=False,  # warn and continue
)

The same options exist on add_data_batch.

Add or Update Multiple Rows

# No ID: new row is created; with ID: existing row is updated
entries = [
    {"Name": "value1"},
    {"id": 2, "Name": "updated_value2"},
]

row_ids, errors = api.add_data_batch(table_id=1, entries=entries, fail_on_error=True)

5. Synchronize a Row Between Tables

Copy one source row into a target table. Matching uses an identifier column (update if found, otherwise create). Compatible fields are transferred; untransferable values produce warnings (or errors with fail_on_error=True). Link-row values are rematched in the target linked table.

target_row_id, messages = api.synchronize_data(
    source_table_id=10,
    source_row_id=5,
    target_table_id=20,
    identifier_column="Individuum ID",
    field_mapping={"Kommentar": "Kommentar Einschluss"},  # optional renames
    exclude_fields=["existierender Index"],  # optional skips
    fail_on_error=False,
)

# Preview without writing
target_row_id, messages = api.synchronize_data(
    source_table_id=10,
    source_row_id=5,
    target_table_id=20,
    identifier_column="Individuum ID",
    dry_run=True,
)
# messages include "dry_run: would create/update ..." and payload field names

6. Advanced Options

Include or Exclude Specific Fields

filtered_data = api.get_data(table_id=1, include=["Name", "Status"])
filtered_data = api.get_data(table_id=1, exclude=["InternalNotes"])

Resolve Linked Fields Automatically

row = api.get_entry(table_id=1, row_id=1, linked=True)

7. Schema Helpers (JWT)

Creating or deleting databases/tables requires a JWT-authenticated client (BaserowApi.from_credentials or jwt_token=True).

workspaces = api.list_workspaces()
database = api.create_database(workspace_id=workspaces[0]["id"], name="My DB")
table = api.create_table(
    database_id=database["id"],
    name="Samples",
    primary_field_name="Sample-ID",
    fields=[
        {"name": "Status", "type": "single_select",
         "select_options": [{"value": "open", "color": "blue"}]},
    ],
)
api.delete_table(table["id"])
api.delete_database(database["id"])

💻 Development

Want to contribute? See our CONTRIBUTING.md guide.

Integration tests create ephemeral tables against Baserow.io; see tests/conftest.py for credentials / env overrides (BASEROW_URL, BASEROW_EMAIL, BASEROW_PASSWORD).


Thank you for using simple_baserow_api.
Please report bugs or request features by opening an issue on the GitHub repository.

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

simple_baserow_api-0.1.7.tar.gz (26.8 kB view details)

Uploaded Source

Built Distribution

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

simple_baserow_api-0.1.7-py3-none-any.whl (17.3 kB view details)

Uploaded Python 3

File details

Details for the file simple_baserow_api-0.1.7.tar.gz.

File metadata

  • Download URL: simple_baserow_api-0.1.7.tar.gz
  • Upload date:
  • Size: 26.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.14

File hashes

Hashes for simple_baserow_api-0.1.7.tar.gz
Algorithm Hash digest
SHA256 12a13a19a5ff7ee0245c004a45916f98fa75741d6d7c87e58279c29ce3bd2f22
MD5 2d17041005ea408554ea609f4e45ee06
BLAKE2b-256 3282fae871debbc3835c508be8de4220e199a27c287ec07eb2493eaa5cf02e8a

See more details on using hashes here.

Provenance

The following attestation bundles were made for simple_baserow_api-0.1.7.tar.gz:

Publisher: release.yml on KuechlerO/simple_baserow_api

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

File details

Details for the file simple_baserow_api-0.1.7-py3-none-any.whl.

File metadata

File hashes

Hashes for simple_baserow_api-0.1.7-py3-none-any.whl
Algorithm Hash digest
SHA256 8898ab3fc561ef092f246b16aa5f0aaa97281ddb9e0c4499cc73c4d4b36d54dc
MD5 58f30e14fe32c7b711e32dbea8cc0e56
BLAKE2b-256 3c45f94703441c899290a643a9e848903335d6e5aaec23cebc3cdf0f54213fb6

See more details on using hashes here.

Provenance

The following attestation bundles were made for simple_baserow_api-0.1.7-py3-none-any.whl:

Publisher: release.yml on KuechlerO/simple_baserow_api

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