This page walks you through the steps to create a new project and automatically generate a basic model from your database.
There are other options for creating your project files: You can create a blank project and manually create its model, or you can clone an existing public Git repository. See the Creating a new LookML project documentation page for more information on those options.
Automatically generating a model from your database
From the LookML Projects page, you can generate your model and view project files based on the tables in your database.
To create a new project:
- Click on Develop in the menu bar and verify that you are in Development Mode.
- Select Manage LookML Projects from the Develop menu:
As of Looker 21.12, if your admin has enabled the Enhanced Navigation Labs feature, you can access the LookML Projects page from the Develop option in the new enhanced left navigation panel. Select the Develop option to open the Develop panel, and then select Projects.
When the Enhanced Navigation Labs feature is enabled, the Development Mode toggle is also located in the new enhanced left navigation panel.
- From the LookML Projects page, click New LookML Project to open the New Project page:
- In the New Project page, specify the options for your project:
- Give your project a name.
- For Starting Point, choose Generate Model from Database Schema.
- Select the name of your database connection from the Connection drop-down menu.
- Select the option to build views from All Tables or a Single Table:
- All Tables: The LookML generator will create a view file for each table in your database.
- Single Table: The LookML generator will create a view for one table in your database. If you choose this option, use the text field to enter the name of the database table.
- If you want to generate files for only one schema in your database, enter the name of the schema in the Schemas text field. You can list multiple schemas, separated by commas.
- If you want to leave table prefixes out of your view file names, enter your database’s prefixes in the Ignore Prefixes text field. This field is case-sensitive. You can list multiple prefixes, separated by commas. For example, if your tables are titled
DBS_users, you could enter
dwh, DBSin the Ignore Prefixes text field and Looker would create view files named
Click Create Project.
- The LookML generator creates one model file for the project, and a view file for each table in the database (unless otherwise specified). Once the files are created, Looker opens the new project in the Looker IDE.
- The LookML generator also creates IDE folders for your view and model files. If your database has more than one schema, the LookML generator will also create a folder for schemas.
For BigQuery connections, if you generate a LookML project from your database, Looker will autopopulate field descriptions with the descriptions from your BigQuery column metadata, if any.
The generator will also create an Explore for each database table. To start querying your data, use the Explore menu to select the name of an Explore. If your admin has enabled the Enhanced Navigation Labs feature, select the Explore option from the new enhanced left navigation panel. See the Exploring data in Looker documentation page for more information.
If you want to rename your project after you’ve created it, see the Renaming a project section of the Accessing and editing project information documentation page.
You can manually create additional new models for your project as described on the Understanding model and view files documentation page, configure them for use in production as discussed in the When you need to configure models section on this page, and find further instructions on the Creating a new LookML project documentation page.
Once your model files are generated or manually created, see the Setting up and testing a Git connection documentation page for information on connecting your Looker project to Git so that you can record changes to your LookML files and manage versions of your files.
Improved LookML generation
If your admin has enabled the Improved LookML Generation Labs feature, Looker adds some additional elements to your project when you generate the project from your database:
- Looker adds a README file to the new project. The README file contains an introduction to LookML along with links and resources to help new LookML developers.
- In addition to the standard
type: countmeasures that Looker automatically creates for each view, Looker also creates measures of
type: averagein each view. The
averagemeasures are created with the
hidden: yesparameter so that by default these measures are not displayed to your users. You can update each measure’s
noto display it.
When you need to configure models
Configuring a model is useful for the following reasons:
- It specifies that a given model name refers to a particular model in a particular project.
- It sets the connections that the model is allowed to use.
A model configuration is not needed for admins (or developers with the
manage_models permission) while they are in Development Mode. This lets LookML developers work easily while in Development Mode. However, if a model configuration does exist, any queries will be constrained by that configuration even in Development Mode.
Although a LookML developer specifies the desired connection in the model file, an admin controls what connections are allowed on the LookML Projects page. Thus, a model should only use a connection that the configuration allows because the configuration always wins. If a model specifies using a connection that is not allowed in the model’s configuration, then the connection is not allowed.
The LookML Projects page lets you view all your projects in one place along with their respective models. You use this page to create, view, and configure your projects.
A model needs a configuration when the model is pushed to production for the first time, and during development:
- When a model is pushed to production for the first time, the model must be configured; otherwise, any queries on that model will fail once the model is in Production Mode. When a model is pushed from Development Mode to production for the first time, Looker is often able to configure the model for you automatically. This is possible when the model’s name is unique for the Looker instance. However, if you already have a configured model with the same name in another project, then Looker will not automatically configure the model.
- During development, if you have developers who have not been given the
manage_modelspermission (which is included in the
adminrole), then the model must be configured before those developers can run queries on that model. In this case, you can configure the model before the model exists or even before the project exists. Then, when a LookML developer creates the project and the model, the model’s allowed connections are already configured and the developer can run queries successfully.
For developers without
manage_modelspermission, admins can limit their access to certain connections by limiting the developers to particular model sets and limiting the connections allowed for those models.
For developers who have the
manage_models permission, Looker allows them to run queries on an unconfigured model in Development Mode. Looker does this by searching projects for a model with that name. The first model it finds with that name is used to run the query.