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.
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.
Example
In the ecommerce.model.lookml file, specify that the model should retrieve data from the ecommerce_events connection:
connection: "ecommerce_events"
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 that is 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.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-07-22 UTC."],[],[],null,["# connection\n\n\u003cbr /\u003e\n\nUsage\n-----\n\n```\n\nconnection: \"connection_name\"\n```\n\nDefinition\n----------\n\n`connection` specifies the database connection from which a model will retrieve data. Database connections are defined and named on the [**Connections**](/looker/docs/admin-panel-database-connections) page in the **Database** section of Looker's **Admin** panel.\n| **Important:** Each model can specify only one connection. If you want to use multiple database connections in a project, you must create a different model file for each connection.\n\nWhen a Looker developer defines a connection in a model file using the `connection` parameter, the [Looker IDE](/looker/docs/looker-ide) displays a drop-down that suggests database connections that are available on the instance.\n\nExample\n-------\n\nIn the `ecommerce.model.lookml` file, specify that the model should retrieve data from the `ecommerce_events` connection: \n\n connection: \"ecommerce_events\"\n\nCommon challenges\n-----------------\n\n### `connection` must reference a connection name from Looker's admin settings\n\nThe 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 that is available when you're [configuring a model](/looker/docs/manage-projects#adding_and_editing_configurations) or on the [**Connections**](/looker/docs/admin-panel-database-connections) page in Looker's **Admin** panel.\n\n### If a model configuration exists, then `connection` can only reference an allowed connection\n\nIf 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.\n\n### If a model configuration does not exist, then only certain people can query\n\nIf you have not been given the [`manage_models` permission](/looker/docs/admin-panel-users-roles#permissions_list) (which is included in the admin role) then the model must be configured before you can run queries on the model."]]