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)
Release files for baserowsdk 0.1.2
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| baserowsdk-0.1.2.tar.gz | 7.8 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| baserowsdk-0.1.2-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 17.5 kB
Release files / baserowsdk-0.1.2.tar.gz
| Download URL | baserowsdk-0.1.2.tar.gz |
|---|---|
| Size | 7.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8f1838d07d8c54a2897ca7dda175b557ac9c4c2f847b4709d127846120e4cc4d
|
|
BLAKE2b-256 checksum How to use checksums |
2e475e302dad498654d7961d00f525ded0df6265b325353df10d6956408b2264
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.4 CPython/3.13.0 Darwin/23.5.0
|
Release files / baserowsdk-0.1.2-py3-none-any.whl
| Download URL | baserowsdk-0.1.2-py3-none-any.whl |
|---|---|
| Size | 9.7 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
708d986a925f248311ea6010d46d55714502583f2a6d2c7144fa765151d9e17f
|
|
BLAKE2b-256 checksum How to use checksums |
162d42647466625e57c5707133f0c212f1e9aaba772064fc5d802a58b738d9ea
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.4 CPython/3.13.0 Darwin/23.5.0
|