Skip to content

Rows

Get Rows

listRows

base.listRows(table_name, view_name=None, order_by='', desc='', start='', limit='')

Example

const rows1 = await base.listRows('Table1')
const rows2 = await base.listRows('Table1', view_name='default', order_by='年龄', desc=true, start=5, limit=20)

getRow

base.getRow(table_name, row_id)

Example

const row = await base.getRow('Table1', 'U_eTV7mDSmSd-K2P535Wzw')

Add Row(s)

appendRow

base.appendRow(table_name, row_data, apply_default = false)

Example

row_data = {
    "Name": "I am new Row"
}

await base.appendRow('Table1', row_data)

insertRow

base.insertRow(table_name, row_data, anchor_row_id, apply_default = false)

Example

const row_data = {
    "Name": "I am new Row"
}

await base.insertRow('Table1', row_data, 'U_eTV7mDSmSd-K2P535Wzw')

batchAppendRows

base.batchAppendRows(table_name, rows_data, apply_default = false)

Example

const rows_data = [{
    'Name': 'test batch',
    'content': 'Yes'
}, {
    'Name': 'test batch',
    'content': 'Yes'
}, {
    'Name': 'test batch',
    'content': 'Yes'
}]

// Whether to use the default value set in the table column.
// If set to true, the default value will be used if the column is not specified in row_data.
// apply_default is set to false by default.
await base.batchAppendRows('Table6', rows_data, apply_default = true)

Update Row

updateRow

base.updateRow(table_name, row_id, row_data)

Example

row_data = {
    "Number": "123"
}
await base.updateRow('Table1', 'U_eTV7mDSmSd-K2P535Wzw', row_data)

batchUpdateRows

base.batchUpdateRows(table_name, rows_data)

Example

const updates_data = [
        {
            "row_id": "fMmCFyoxT4GN5Y2Powbl0Q",
            "row": {
                "Name": "Ranjiwei",
                "age": "36"
            }
        },
        {
            "row_id": "cF5JTE99Tae-VVx0BGT-3A",
            "row": {
                "Name": "Huitailang",
                "age": "33"
            }
        },
        {
            "row_id": "WP-8rb5PSUaM-tZRmTOCPA",
            "row": {
                "Name": "Yufeng",
                "age": "22"
            }
        }
    ]
await base.batchUpdateRows('Table1', rows_data=updates_data)

Delete Row(s)

deleteRow

base.deleteRow(table_name, row_id)

Example

await base.deleteRow('Table1', 'U_eTV7mDSmSd-K2P535Wzw')

batchDeleteRows

base.batchDeleteRows(table_name, row_ids)

Example

const del_rows = rows.slice(0, 3);
const row_ids = del_rows.map(row => row._id);
await base.batchDeleteRows('Table1', row_ids)