AcceptsA string containing the name of a connection
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.
Retrieve data from the
mysql_db connection for the model being used:
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 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.