Docs
Skip to content

Databases

Rows_

Master row management with Appwrite Databases. Learn how to create, update, upsert, and query rows within your tables for dynamic data storage.

9 min read

Raw

Each piece of data or information in Appwrite Databases is a row. Rows have a structure defined by the parent table.

Create rows

In most use cases, you will create rows programmatically.

During testing, you might prefer to create rows in the Appwrite Console. To do so, navigate to the Rows tab of your table and click the Add row button.

List rows

Rows can be retrieved using the List rows endpoint.

Results can be filtered, sorted, and paginated using Appwrite's shared set of query methods. You can find a full guide on querying in the Queries Guide.

By default, results are limited to the first 25 items. You can change this through pagination.

Cache list responses

You can cache list responses by passing a ttl (time-to-live) value in seconds to listRows. Subsequent identical requests return the cached result until the TTL expires. The cache is permission-aware, so users with different roles never see each other's cached data.

Set ttl between 1 and 86400 (24 hours). The default is 0 (caching disabled). The response includes an X-Appwrite-Cache header with value hit or miss.

Purge cache

Row writes do not invalidate the cache, so cached responses may contain stale data until the TTL expires. Schema changes (adding or removing columns and indexes) invalidate cached entries automatically.

To force an immediate cache purge, call updateTable with purge set to true using a Server SDK.

Update row

In most use cases, you will update rows programmatically.

Upsert rows

Upsert is a combination of "update" and "insert" operations. It creates a new row if one doesn't exist with the given ID, or updates an existing row if it does exist.

In most use cases, you will upsert rows programmatically.

Type safety with models

Mobile and native SDKs provide type safety when working with rows through the nestedType parameter. This allows you to specify custom model types for complete auto-completion and type safety.

Define your model

Create a data class or struct that matches your table structure:

Using type-safe operations

Use the nestedType parameter for full type safety in native SDKs, or generics in web SDKs:

Model methods

Models returned by native SDKs include helpful utility methods:

Permissions

In Appwrite, permissions can be granted at the table level and the row level. Before a user can create a row, you need to grant create permissions to the user.

Read, update, and delete permissions can be granted at both the table and row level. Users only need to be granted access at either the table or row level to access rows.

Learn about configuring permissions.

Use transactions

All row operations support transactionId. When provided, operations are staged to an internal log and not applied until the transaction is committed. Learn more in the Transactions guide.

Next steps

Continue learning with these related guides:

Was this page helpful?

Share what worked or what we should fix. Once approved, our agents automatically apply suggested updates to the docs.