Connection files (.connection)

Connection files describe your data connections. They're used by Tinybird connectors to establish a connection when deploying to live environments. See Connectors.

Connection files bear the .connection extension and are stored in the connections folder of your project. See Datafiles.

Structure

All .connection file contains a TYPE declaration that specifies the type of connection. For each connection type, a number of settings are mandatory.

The name of the .connection file determines the name used in .datasource files when defining the connection.

The following example shows a .connection file for a Kafka data source:

kafkasample.connection
TYPE kafka
KAFKA_BOOTSTRAP_SERVERS {{ tb_secret("PRODUCTION_KAFKA_SERVERS", "localhost:9092") }}
KAFKA_SECURITY_PROTOCOL SASL_SSL
KAFKA_SASL_MECHANISM PLAIN
KAFKA_KEY {{ tb_secret("PRODUCTION_KAFKA_USERNAME", "") }}
KAFKA_SECRET {{ tb_secret("PRODUCTION_KAFKA_PASSWORD", "") }}

The calls to the tb_secret function contain the name of the secret and a default value. See tb secret to learn how to set and manage secrets.

Never add credentials as plain text in your datafiles. Use secrets instead.

List your connections

To list your connections, run the tb connections command:

tb connection ls

Update a connection

To update or refresh a connection after changing settings or secrets, redeploy your project. See Deployments. Connections remain active using the previous settings until you deploy them again.

Updated