Skip to content

Database connections

A Supersimple account can be connected to more than one database. Each data model reads from exactly one connection, and you choose which one with the connection field.

Your first connection is set up when you connect your database. To add another connection to your account, contact support or your account manager.

Setting a data model's connection

models.<model>.connection

yaml
models:
  account:
    name: Account
    table: myschema.account
    # Name of the connection, exactly as it appears in Supersimple settings
    connection: Production Postgres Replica
    primary_key:
      - account_id

The value is the connection's name, as shown in Supersimple's connection settings and the data source picker. If it doesn't match one of your connections, the import fails with an "unknown connection" error.

Default connection

If you omit connection, the model is bound to your default connection, which is the first one you set up. If you only have a single database connection, you don't need to explicitly set connection on data models.

No cross-database relations

Data model relations (joins) only work between models on the same connection. Supersimple enforces this rule at import time and run time.

If a relation points to a model on a different connection, the data model import will be rejected.

TIP

This rule is also enforced at query time: queries that combine several database connections are rejected with a message explaining why.