Skip to main content

Baserow OpenAPI Python SDK

Project description

Baserowsdk

Requirements

python3.8 +

Installation

pip install --upgrade baserowsdk

Getting started

初始化客户端

from baserowsdk import Client

client = Client(
    api_key="your_api_key",
    base_url="http://your.baserow.domain"
)

获取字段信息

# 获取表的所有字段定义
fields = client.fields(table_id=182)
print(fields)

查询数据

# 单条查询
base = client.base(39)
row = base.table(182).row(row_id=1)
print(row)

# 批量查询
rows = base.table(182).select(page_size=100)
print(rows)

# 查询同时种缓存
# 注意: 缓存是基于 client 对象的, 不同 client 对象之间互不干扰
# 注意: 缓存 Key 为 select 的所有查询条件进行 Hash, 仅查询条件完全相同才会命中缓存
rows = base.table(182).select(page_size=100, cache_senconds=10)
print(rows)

创建数据

# 创建新记录
row = client.base(39).table(182).create(
    fields={"黑话改写_输入": "1234567890","黑话改写_输出": "1234567890"}
)
print(row)

更新数据

# 更新记录
updated_row = client.base(39).table(182).update(
    row_id=6,
    fields={
        "执行批次ID": "BATCH-001",
        "测试用例": [1, 2, 3]  # 关联字段支持多值
    },
    user_field_names=True  # 使用用户定义的字段名
)
print(updated_row)

删除数据

# 删除记录
client.base(39).table(182).delete(row_id=7)

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

baserowsdk-0.1.1.tar.gz (7.8 kB view details)

Uploaded Source

Built Distribution

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

baserowsdk-0.1.1-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

Details for the file baserowsdk-0.1.1.tar.gz.

File metadata

  • Download URL: baserowsdk-0.1.1.tar.gz
  • Upload date:
  • Size: 7.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.13.0 Darwin/23.5.0

File hashes

Hashes for baserowsdk-0.1.1.tar.gz
Algorithm Hash digest
SHA256 ba92c07f5986348ce1fab9e967f3ef96440c35fcc16dffb555757078cd5ad960
MD5 ff30cf71192bcfb80dda76cbed2cf540
BLAKE2b-256 3be5f965b53890fdfcda89a21161f26a23e953bbe1fdbd7506e3e456ffef8707

See more details on using hashes here.

File details

Details for the file baserowsdk-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: baserowsdk-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 9.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.4 CPython/3.13.0 Darwin/23.5.0

File hashes

Hashes for baserowsdk-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 79b35071e3dde56cdecbeba6078130c62d6b253ff6bc634787211c6abb182014
MD5 74228d621a14798444aa0353bb6d1491
BLAKE2b-256 f0ded6ede1198f9b0256b33c1eb78a7cd1b72e77b54ec848040f082d2e2316b4

See more details on using hashes here.

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