---
layout: article
title: Metabase
description: Connect Metabase to an Appwrite native PostgreSQL database for analytics. Use a read-only PostgreSQL role, configure SSL, and build dashboards on a session-safe connection.
---

Appwrite's native PostgreSQL database is a standard PostgreSQL engine, so [Metabase](https://www.metabase.com/) can connect to it without an Appwrite-specific adapter. Add the database in Metabase, point it at the host from the [Connections](/docs/products/databases/postgresql/connections) page, and Metabase will sync the schema so your team can build questions and dashboards.

**Before you start**

You'll need a native PostgreSQL database in a `ready` state and its credentials. In the Console, open the database and click **Credentials**. Copy the individual values from the **Details** tab, or use the **DSN**, **.env**, or **psql** tab. You can also fetch the same values with [`postgresql.get()`](/docs/products/databases/postgresql/connections#credentials). The primary user is `admin`, and the database name is generated per database.

# Use a read-only PostgreSQL role

Dashboards should not connect as the primary `admin` user. That role owns the database and can run schema changes. For analytics, create a read-only PostgreSQL role for Metabase from the database **Roles** tab in the Console, then grant it access only to the schemas and tables Metabase should query.

At minimum, a reporting role needs permission to connect to the database, usage on the schemas you want to expose, and `SELECT` on the tables and views in those schemas. Use the [SQL editor](/docs/products/databases/postgresql/quick-start#first-queries), `psql`, or your migration workflow to apply the grants after you create the role. See [Database roles](/docs/products/databases/postgresql/connections#roles) for how roles work with native PostgreSQL databases.

If you plan to use Metabase features that write data, such as editable table data, use a separate connection with the specific write privileges that feature needs. Keep the analytics connection read-only.

# Add the database in Metabase

In Metabase, click the grid icon, then open **Admin > Databases > Add a database**. Choose **PostgreSQL** as the database type and fill in the connection form with the values from the [Connections](/docs/products/databases/postgresql/connections) page.

| Field | Value |
|-------|-------|
| Host | `db-<hash>.<region>.appwrite.center` |
| Port | `5432` |
| Database name | `<database>` |
| Username | your read-only PostgreSQL role |
| Password | the role password |

Turn on **Use a secure connection (SSL)** and set **SSL Mode** to `require`. Appwrite Cloud requires TLS for native PostgreSQL connections. If you choose `verify-ca` or `verify-full`, Metabase also requires a root certificate in PEM format. See [Network security](/docs/products/databases/postgresql/network-security) for Appwrite TLS and network controls.

**Use a session-safe connection**

Metabase keeps database sessions open and can use session-level PostgreSQL behavior while exploring data. Connect it to the direct PostgreSQL port (`5432`) or to the [connection pooler](/docs/products/databases/postgresql/connection-pooling) in `session` mode. Transaction-mode pooling can break session-level features because a client session is not bound to one backend connection.

Click **Save changes**. Metabase verifies the connection and starts its first schema sync.

# Build a question or dashboard

Once the first sync finishes, your tables appear in the data picker. To build your first chart:

1. Click **+ New > Question** and pick your Appwrite PostgreSQL database as the data source.
2. Choose a table, add a summary such as count, sum, or average, and group by a column such as a timestamp.
3. Switch the visualization to a line, bar, or table view, then save the question.
4. Add saved questions to a dashboard and use filters to slice data across cards.

Because the analytics connection is read-only, native SQL questions can inspect data without changing it. Queries that attempt writes will fail unless you intentionally connect Metabase with a role that has write privileges.

# How Metabase syncs your schema

After you connect, Metabase scans the database to discover tables, columns, constraints, and field metadata, then keeps that metadata current on a schedule:

- A lightweight schema sync runs hourly by default.
- A more intensive field-value scan runs daily by default to populate filter dropdowns.

New tables and columns appear after the next sync. To pull them in immediately, open **Admin > Databases > your database** and click **Sync database schema**. You can also restrict which schemas Metabase tracks and adjust the sync and scan cadence from the database settings. Refer to the [Metabase documentation](https://www.metabase.com/docs/latest/databases/sync-scan) for the full set of sync and scan options.

# Use a branch for testing

[Branches](/docs/products/databases/postgresql/branches) are isolated copies of a native PostgreSQL database with their own host and credentials. Point a second Metabase database connection at a branch when you want to validate a dashboard against a snapshot of production data without querying the live database. Branches are managed through the API, and you can delete the branch when testing is complete.

# Related

- [PostgreSQL](/docs/products/databases/postgresql): Provision and manage a native PostgreSQL database for your project.
- [Connections](/docs/products/databases/postgresql/connections): Retrieve credentials, rotate the primary password, and manage PostgreSQL roles.
- [Connection pooling](/docs/products/databases/postgresql/connection-pooling): Pool modes and ports, including why BI tools need session or direct connections.
- [Network security](/docs/products/databases/postgresql/network-security): TLS, certificate verification, IP allowlists, and idle connection timeouts.
