Skip to content

{{lookupConnection}}

Looks up a property of a connection by name. All properties of a connection are stored as extensions (key/value pairs), so this helper finds the connection in the provided list and returns the extension value for the given key.

If the connection or the key can’t be found, the helper emits an empty string rather than failing the generation run.

{{lookupConnection connections connectionName key [debug]}}

The first argument is the list of connections, the second the connection name, and the third the extension key to read. Names and keys are matched case-insensitively. Passing true as the optional fourth argument writes debug trace lines into the output, which helps when a lookup unexpectedly comes back empty.

USE [{{lookupConnection dataConnections "Staging" "database"}}];

With a connection named Staging that has a database extension of 200_Staging_Area, this results in:

USE [200_Staging_Area];