Rows¶
Get row / rows¶
Get row
Gets one row of a table by its row ID.
Example
List rows
Lists multiple rows of a table.
The default limit is 1000 which is also the maximum number of rows this method returns.
The query method (see below) offers more filter options and can return more rows.
Examples
Query
Queries a base using a SQL statement.
Unless the SQL statement specifies a higher limit, the method returns a maximum of 100 rows. The maximum number of rows returned is 10000 no matter the limit specified in the SQL statement.
Example with a wildcard
- Returns for example the following:
[ { "Name": "Thomas", "_id": "VkyADGkFRiif0bEVHd-CtA", "_ctime": "2023-08-16T15:04:56.018Z", "_mtime": "2023-08-17T07:02:59.585Z", "_creator": "a5adebe279e04415a28b2c7e256e9e8d@auth.local", "_last_modifier": "a5adebe279e04415a28b2c7e256e9e8d@auth.local", "_locked": null, "_locked_by": null, "_archived": false }, { "Name": "Steve", "_id": "UevpAVOjRrmbfqMmpsuTEg", "_ctime": "2023-08-17T07:03:00.292Z", "_mtime": "2023-08-17T07:03:00.801Z", "_creator": "a5adebe279e04415a28b2c7e256e9e8d@auth.local", "_last_modifier": "a5adebe279e04415a28b2c7e256e9e8d@auth.local", "_locked": null, "_locked_by": null, "_archived": false }, ]
Example with WHERE
json_data = base.query('select name, price from Bill where year = 2021')
print(json.dumps(json_data, indent=2))
Example with ORDER BY
json_data = base.query('select name, price, year from Bill order by year')
print(json.dumps(json_data, indent=2))
Example with GROUP BY
json_data = base.query('select name, sum(price) from Bill group by name')
print(json.dumps(json_data, indent=2))
Example with DISTINCT
Add rows¶
By default, the default values specified for the table columns in the webinterface do not apply when adding/appending rows via API. In order to apply the default values, add apply_default=True
as a function parameter. If set to True, the default values can be overwritten by specifying alternative values in row_data
.
Append row
Appends one row to a table.
Example
Batch append rows
Appends multiple rows to a table.
Example
Insert row
Inserts one row to a table under a anchor row.
Example
Update row¶
Update row
Updates one row in a table.
Example
Batch update rows
Updates multiple rows in a table.
Example
rows_data = [{
"row_id" : "fMmCFyoxT4GN5Y2Powbl0Q",
"row" : {
"Name" : "Ron",
"Height" : "183"
}
}, {
"row_id" : "cF5JTE99Tae-VVx0BGT-3A",
"row" : {
"Name" : "Richard",
"Height" : "184"
}
}, {
"row_id" : "WP-8rb5PSUaM-tZRmTOCPA",
"row" : {
"Name" : "Regina",
"Heigt" : "173"
}
}]
base.batch_update_rows('Table1', rows_data)
Delete rows¶
Delete row
Deletes one row from a table.
Example