Usage
Hierarchyconnection |
Default ValueNoneAcceptsA string containing the name of a connection |
Definition
connection
specifies the database connection from which a model will retrieve data. Database connections are defined and named on the Connections page in the Database section of Looker’s Admin panel. A model may only use one connection.
When a Looker developer defines a connection in a model file using the connection
parameter, the Looker IDE displays a drop-down that suggests database connections that are available on the instance.
Examples
Retrieve data from the mysql_db
connection for the model being used:
Common challenges
connection
must reference a connection name from Looker’s admin settings
The connection name that is referenced by connection
does not take the name of an actual database or schema. The name must be one of the connections available when you’re configuring a model or on the Connections page in Looker’s Admin panel.
If a model configuration exists, then connection
can only reference an allowed connection
If a Looker developer specifies a connection in the model file that is not allowed in the model configuration, then any query on that model will not run.
If a model configuration does not exist, then only certain people can query
If you have not been given the manage_models
permission (which is included in the admin role) then the model must be configured before you can run queries on the model.