CLI and automation
Connections commands
Add, edit, remove and list saved connections with the sqlflow CLI, including capture mode, options and secret references.
These commands manage the saved connections of the account you are signed in to: the same records as the Connections page. A saved connection holds connection details and, optionally, a secret reference. It never holds a password. See Saved connections. Set up the CLI first: see Overview and authentication.
| Command | Changes something | Purpose |
|---|---|---|
sqlflow connection add | Yes | Save a new connection. |
sqlflow connection edit | Yes | Change fields of a saved connection. |
sqlflow connection remove | Yes | Delete a saved connection. |
sqlflow connection list | No | List saved connections. |
Add a connection
sqlflow connection add <name> --engine <engine> --host <host> --port <port> --db <database> --user <user>
[--mode <mode>] [--encryption require|prefer] [--opt <key=value> ...]
[--secret-ref <env:NAME|file:NAME>]add fails if a connection with the same engine and name already exists. Use edit to change one.
| Option | Description |
|---|---|
<name> | The connection's name, for example orders-production. |
--engine <engine> | postgres, mysql, oracle, sqlserver, azuresql, sybase or fabricsql. |
--host <host> | The server's host name or address, as the agent sees it. localhost means the agent's own machine. |
--port <port> | The port, as a whole number. Defaults of each engine: PostgreSQL 5432, MySQL 3306, Oracle 1521, SQL Server, Azure SQL and SQL database in Fabric 1433, Sybase ASE 5000. |
--db <database> | The database name. For Oracle, the service name of the pluggable database. |
--user <user> | The login. Not needed for a SQL Server or Azure SQL authentication method that signs in as the agent's own identity, and optional for a managed identity. |
--mode <mode> | The capture mode of a source. See the table below. |
--encryption <setting> | require or prefer: the connection's encryption setting, for sqlserver, postgres, mysql, oracle and sybase. require, the default, encrypts the connection and validates the server certificate. prefer doesn't validate the certificate, and for some engines connects unencrypted when the server offers no TLS. See Encryption. |
--opt <key=value> | An engine-specific connection option. Repeat the flag for several options. See Options. |
--secret-ref <reference> | Where the agent finds the password on its own host: env:<NAME> or file:<NAME>. See Database credentials and secret references. |
The capture modes you can give with --mode:
| Engine | --mode values |
|---|---|
sqlserver | directlog, reconstruction, polling, builtin (Native CDC) |
azuresql | builtin (Native CDC) |
oracle | directlog, logminer |
sybase | directlog, reconstruction. Sybase connections require --mode. |
PostgreSQL and MySQL have no capture mode. See Choosing a capture mode.
--password is refused. Pass the password when you create the pipeline, or store a secret reference.
sqlflow connection add orders-sql --engine sqlserver --host sql01.example.com --port 1433 --db Orders --user sqlflow_reader --mode directlog --secret-ref file:orders-pw
sqlflow connection add warehouse-pg --engine postgres --host pg01.example.com --port 5432 --db warehouse --user sqlflow_writerThe command prints saved connection 'orders-sql' [<id>] → sqlserver sqlflow_reader@sql01.example.com:1433/Orders secret=file:orders-pw encryption=require.
Encryption
Every SQL Server, PostgreSQL, MySQL, Oracle and Sybase ASE connection carries an encryption setting, the same Encryption choice the connection form shows:
| Value | SQL Server | PostgreSQL and MySQL | Oracle | Sybase ASE |
|---|---|---|---|---|
require (default) | Encrypted, certificate validated | Encrypted, certificate and host name validated | TLS listener, certificate DN matched | TLS, certificate validated |
prefer | Encrypted, certificate not validated | TLS when the server offers it, otherwise unencrypted; certificate not validated | Plain TCP unless TLS settings are given | Unencrypted unless a trusted certificate file is given |
Use prefer only for a server you trust on a network you trust, for example an on-premises SQL Server with a self-signed certificate. A sqlserver connection to an Azure host name, such as *.database.windows.net, validates the certificate under prefer too. Azure SQL and SQL database in Fabric connections always validate the server certificate and have no setting, so --encryption is refused for them: --encryption is not applicable to Azure SQL connections, which always validate the server certificate. Leave the flag out.
Options
--opt sets the same engine-specific fields the pipeline wizard shows. The ones you are most likely to need are:
| Option | Engines | Meaning |
|---|---|---|
authentication=<method> | sqlserver, azuresql, fabricsql | The sign-in method: sql (the default), windows (SQL Server only), entraManagedIdentity, entraWorkloadIdentity, entraServicePrincipal (client secret), entraServicePrincipalCertificate (certificate), entraIntegrated or entraPassword. Azure SQL has no windows. SQL database in Fabric accepts the Entra methods only. |
certificatePath=<path> | with entraServicePrincipalCertificate | An absolute path to a PEM or PFX file on the agent, including its private key. |
The options trustServerCertificate and sslMode are refused as retired. Use --encryption instead.
sqlflow connection add orders-azure --engine azuresql --host myserver.database.windows.net --port 1433 --db Orders --opt authentication=entraManagedIdentityA value that holds = is split at the first one.
Edit a connection
sqlflow connection edit <name> [--engine <engine>] [--host <host>] [--port <port>] [--db <database>] [--user <user>]
[--mode <mode>] [--encryption require|prefer] [--opt <key=value> ...]
[--secret-ref <env:NAME|file:NAME>]edit changes only the fields you give and keeps everything else. A repeated --opt is added to the options already saved, --mode replaces the saved capture mode, and --encryption replaces the saved encryption setting. A --secret-ref replaces the saved reference. The CLI can't remove a saved reference. To drop one, delete the connection and add it again.
A connection is identified by its engine and name, so edit can't change either. When two connections share a name, add --engine to say which. --password is refused, as for add.
sqlflow connection edit orders-sql --host sql02.example.comIf no connection matches, the command fails with No connection '<name>' to edit. Use `connection add` to create it, or `connection list` to see saved connections.
Remove a connection
sqlflow connection remove <name> [--engine <engine>]Deletes the saved connection. Pipelines created from it are unaffected, because each pipeline keeps its own copy. <name> can also be the connection's ID.
List connections
sqlflow connection listNAME ENGINE ENDPOINT ID
orders-sql sqlserver sqlflow_reader@sql01.example.com:1433/Orders secret=file:orders-pw encryption=require <id>Connections are sorted by engine, then by name. The endpoint shows user@host:port/database, secret=<reference> when the connection names a secret reference, and, for SQL Server, PostgreSQL, MySQL, Oracle and Sybase ASE, encryption=require or encryption=prefer. A reference is a name, not a password, so listing it discloses nothing. encryption=retired option, edit and save means the connection holds a retired encryption option; connection edit removes it.
Errors
| Message | Cause |
|---|---|
Connection '<name>' (<engine>) already exists [<id>]. Use `connection edit <name>` to change it, or `connection remove <name>` to delete it. | add with an engine and name that exist. |
Connection '<name>' is ambiguous (<engine>:<id>, …); pass --engine to disambiguate. | Two connections share the name. |
missing required option --<flag>. | add needs --engine, --host, --port, --db and, for most engines, --user. |
Sybase connections require --mode reconstruction or --mode directlog. | A Sybase connection without --mode. |
Unsupported Sybase capture mode '<mode>'. Use --mode reconstruction or --mode directlog. | A Sybase connection with another mode. |
<connection>: supply either a secret reference or a password, not both. | A password and a reference were both given. |
'<reference>' is not a valid secret reference. | The reference doesn't start with env: or file:, or its name breaks the rules. |
--encryption '<value>' is not a choice; use require (the default: encrypted, server certificate validated) or prefer (encrypt when the server supports it, certificate not validated). | --encryption has another value. |
--encryption is not applicable to <engine> connections, which always validate the server certificate. Leave the flag out. | --encryption on an Azure SQL or SQL database in Fabric connection. |
