Generate a model from sample data

Learn how to use Looker (Google Cloud core) to automatically generate a basic data model from a connection that is included in each instance.

Each Looker (Google Cloud core) instance comes with the sample LookML project that is installed by default on the instance. The sample LookML project includes curated LookML models that are based on the public BigQuery dataset the Look eCommerce . The sample LookML project uses a connection , sample_bigquery_connection . You can use this connection to generate a new data model that is based on one of the sample project's tables. Since this quickstart is for instructional purposes only, you'll delete the data model at the end of the process.

Before you begin

To follow along with this quickstart, you'll need the following:

  1. On the Looker (Google Cloud core) homepage, click the Looker Main menuicon and enable Development Mode by selecting the Development Modetoggle at the bottom of the menu.
  2. On the Looker (Google Cloud core) homepage, click the Createbutton in the main navigation menu to open the drop-down menu.
  3. From the drop-down menu, select LookML Modelto open the Create a Modelpage.

Define your model

On the Create a Modelpage, follow these steps:

  1. In the Select Database Connectionsection, select sample_bigquery_connection from the drop-down menu.
  2. Select the radio button to add the model to the sample_thelook_ecommerce project, and click Next.
  3. In the Select Tablessection, leave the default Google Cloud project in the Select GCP projectfield.
  4. In the Datasetsfield, select bq_dataset .
  5. Click the arrow to the right of bq_dataset to get to the Tablesfield.
  6. In the Tablesfield, select bq_table .
  7. Click the arrow to the right of bq_table to get to the Fieldsfield.
  8. In the Fieldsfield, select all the fields, and click Next.
  9. In the Select Primary Keyssection, select Nameas the primary key, and click Next.
  10. In the Select Explores to Createsection, select the bq_table.view file, and click Next.
  11. In the Enter Model Namesection, enter a unique model name.
  12. Click the Complete and View Modelbutton. This action takes you to the Looker IDE.

View your model

Once you've completed all fields in the Create a Modelpage, view the model that Looker generated.

View the model files in the Looker IDE

  1. After clicking the Complete and View Modelbutton, you will be in the Looker IDE. In the IDE file browser, you see the folders for the pre-existing sample LookML models, which are 0_start_here , 1_basic_lookml , 2_intermediate_lookml , and 3_advanced_lookml . You also see the folders created for the generated model, models and views .
  2. Expand the models and views folders to see the LookML files that Looker created for the model that you defined on the Create a Modelpage. The blue dot next to each file indicates that they are new files and not yet deployed to production.
    • The .model file defines the model . In the model file, you can see the connection that you selected, the bq_table view, as well as other default configurations.
    • The bq_table.view file defines the view . In the view file, you can see the birthdate , name , and rating fields that you selected and how they are defined in the BigQuery database table, as well as a default count measure that Looker added.
  3. You also see the README.md file that Looker generated because the Generate a Readme file that gives more information about using LookMLcheckbox on the Create a Modelpage was selected by default.

View the model on the LookML Projects page

  1. From the IDE, open the main navigation menu by clicking the Main menuicon.
  2. If you aren't already in the Developmenu, click Develop.
  3. From the Developmenu, select Projectsto navigate to the LookML Projectspage .
  4. View your model in the Modelscolumn of the sample_thelook_ecommercerow. It appears along with the advanced_ecomm , basic_ecomm , and intermediate_ecomm models from the sample LookML project.

View the Explore that was created by the model

  1. From the Projectspage, click the name of your model to return to the model file in the IDE.
  2. With the model file open in the IDE, click the See file actionsarrow next to the filename at the top of the IDE.
  3. Select Explore Bq Table- your_model_namefrom the drop-down menu. This selection takes you to the Bq TableExplore that was created by your model.
  4. In the field picker, note the Birthdate Date, Name, and Ratingdimensions that you selected on this Create a Modelpage, as well as the default Countmeasure.

The model files, model configuration, and Explore that you've viewed are available only in your personal Git branch while in Development Mode. If you wanted to make this model available to other users in your Looker (Google Cloud core) instance, you would commit your changes, merge your branch, and deploy the production branch . However, for the purposes of this quickstart, you will delete this model, as described in the next section.

Clean up

To maximize Looker performance, unnecessary models shouldn't be deployed to production. To maintain a clean personal Git branch and avoid accidentally deploying this model to production, complete the following steps to delete the model:

  1. From the Explore, click the Go to LookMLlink in the field picker. This action takes you to the Looker IDE.
  2. In IDE, select the Git Actionsicon.
  3. In the Git Actionsmenu, click Revert to.
  4. In the Revert towindow, make sure that the Revert uncommitted changesoption is selected, and click Confirm.

  5. In the IDE, you should no longer see your model files.

  6. To delete the model configuration, navigate to the Projectspage by clicking Projectsin the Developmenu.

  7. Locate your model in the table, and click the Configurebutton in its row.

  8. Make sure you are in the window for your model by checking the name in the Modelfield, and click Delete Model Configuration.

What's next

Create a Mobile Website
View Site in Mobile | Classic
Share by: