anfra docsAlpha
Administer

Connections

Manage your anfra BI Cloud organization's connections to your warehouse

An organization keeps its own connections to your warehouse. A published model queries the organization's connection with the name its data_source_name gives. Your local .anfra/data_sources.yml is never published, so each person's credentials stay on their machine, and the organization's stay on anfra BI Cloud.

For adding the first connections, see Add connections. This page is the full reference.

Data sources in the UI

The anfra BI Cloud UI, the CLI and data_sources.yml call connections data sources. They're under Settings → Organization → Data sources, which only Admins can open. Settings → Personal → Connections is something else: the apps you authorized to act as you.

Supported types

PostgreSQL, Snowflake, BigQuery, Amazon Redshift, Databricks, MySQL, SQL Server, ClickHouse, Amazon Athena, Presto / Trino, Oracle and MotherDuck.

Every type anfra Core supports except DuckDB: anfra BI Cloud can't read a file on your machine. See DuckDB files.

Each type asks for the same connection fields as in data_sources.yml. See Connection fields. Some types also have advanced options, such as timeouts and SSL, folded under the fields.

Add a connection

In Data sources, click Add data source, then:

  1. Enter the Name: what models' data_source_name refers to. It can't be changed later.
  2. Pick the type and fill in its fields.
  3. Click Test connection to check it, or Add data source, which tests it first.

If the test fails, the connection isn't saved. You can click Save anyway, for example when your warehouse doesn't let anfra BI Cloud in yet, or Keep editing.

An organization can't have two connections with the same name. See Limits for how many it can have.

anfra publish can also add connections. See Add them while you publish.

Test a connection

Click ⋯ on a connection, then Test connection. The row shows Connected, or Couldn't connect with the warehouse's message. A test reaches your warehouse, so it can take a while, and runs only when you ask.

Edit a connection

Click ⋯, then Edit. The name and type stay: models refer to the name.

Saved secrets, such as passwords and keys, are never shown again. Leave a secret blank to keep it, or enter a new one to replace it. If you change where the connection points, such as the host, every saved secret must be entered again. That way, a connection pointed at another server can't take your credentials with it.

Delete a connection

Click ⋯, then Delete, and type the connection's name to confirm. Models that use it stop working until a connection with that name is added again.

How credentials are kept

A connection's credentials are stored encrypted, and used only to run the organization's queries. No one can read a saved secret back, in the UI or through the API. Settings that aren't secret, such as timeouts, are shown as saved.

DuckDB files

When your project uses a DuckDB file, anfra publish offers to upload it to MotherDuck. It then adds it to the organization as a MotherDuck connection with the same name, so your models work without changes.

anfra walks you through installing and signing in to the MotherDuck CLI. It then creates a read-only MotherDuck token for the organization. The token is shown once. It can read every database in your MotherDuck account, so store it safely.

anfra publish --create-data-sources never uploads a DuckDB file.

Join a project that uses connections

When you pull a project a teammate published, anfra pull lists the connections it uses that your .anfra/data_sources.yml lacks, with their types. Add them with your own credentials. See Join an existing project.

On this page