home User Guide Getting Started Help Center Documentation Community Training Certification
menu
close
settings
Looker keyboard_arrow_down
language keyboard_arrow_down
English
Français
Deutsch
日本語
search
print
Looker Blocks

Looker Blocks™ are pre-built data models for common analytical patterns and data sources. Reuse the work others have already done rather than starting from scratch, then customize the blocks to your exact specifications. From optimized SQL patterns to fully built-out data models, Looker Blocks can be used as a starting point for quick and flexible data modeling in Looker.

Available Blocks

There are many Looker Blocks to choose from. To see what blocks are currently available, check out the Blocks Directory or select a category below:

Looker blocks were created to make analyzing data easier and more efficient. They are available on an “as is” basis, meaning there will not be updates moving forward. Looker cannot represent or warrant that this data will be accurate, reliable, or error-free. Please consult the documented data source sites for details on how their data is being collected and how to interpret it.

Click a block that interests you to see its specific usage instructions.

Some Looker Blocks can be quickly and easily installed using the Looker Marketplace. If you are deploying a block through the Looker Marketplace, your Looker admin must have enabled both the Marketplace and the Local Project Import Labs features. See the Looker Marketplace documentation page for more information about installing and customizing Looker Blocks available from the Looker Marketplace.

Standardization and Customization

To build on an existing block, your Looker admin must enable the Local Project Import Labs feature.

The ease of using the different blocks will vary, depending on the degree to which your database schema is standardized. Most Looker Blocks require some customization to fit your data schema, with the exception of data blocks, which are the simplest to implement but are not customizable.

If you’re new to Looker, your Looker analyst can help you get the most from these models.

Adding Blocks to Your LookML

Using Data Blocks

Data blocks are a special type of Looker Blocks that provide the dataset as well as the data model. Looker Data Blocks include public data sources, such as:

To see the full list of currently available blocks, see the Blocks Directory.

Accessing Datasets on Different Databases

The procedure for accessing a data block’s dataset varies depending on your database schema. The sections below contain instructions for accessing datasets on these databases:

Accessing Datasets on Google BigQuery

If you have an existing Google BigQuery account, you can access Looker’s BigQuery-hosted datasets. Skip ahead to the Adding Data Blocks to Projects section of this page.

If you do not already have a Google BigQuery account, you can set up a free trial and then access Looker’s public datasets on BigQuery.

Google BigQuery does not support project sharing across regions. To directly access Data Blocks in Google BigQuery from outside the U.S. region, you can:

Accessing Datasets on Snowflake

You can access a Looker-hosted Snowflake data warehouse and use data sharing to get access to Looker’s public datasets.

Snowflake does not support project sharing across regions. To directly access Data Blocks in Snowflake from outside the U.S. region, you can:

First, reach out to your Looker analyst with the following information:

Once Looker’s Ops team provides the Snowflake account with access to the data blocks, run the following commands to get access to Looker’s public datasets:

‐‐ Data Consumer Side (* Need to be ACCOUNT ADMIN *) ‐‐ For customers in us-west region create database looker_datablocks from share looker.looker_share_datablocks; ‐‐ For customers in us-east region create database looker_datablocks from share gt97609.looker_share_datablocks; grant imported privileges on database looker_datablocks to role sysadmin; use role sysadmin; grant imported privileges on database looker_datablocks to <other_role>; show databases; use looker_datablocks; show tables;

If you are using one of Looker’s public datasets with your own Snowflake data warehouse, your Looker user must have database write privileges to create PDTs. See the Snowflake configuration documentation page for more information about connecting Looker to Snowflake.

Accessing Datasets on Other Databases

Are you on Amazon Redshift? MySQL? PostgreSQL? Oracle?

We’ve made the transformed data for each of these datasets publicly available in both GCS and S3 so that you can directly import them into the database of your choice.

We’ve also made the Data Definition Language (DDL) available for each of the datasets in the GitHub Repo. The DDL statements might need to be modified for the datatypes in your selected database, but should provide an idea of the column types for each table.

Download data directly from one of these locations:

Accessing the LookML Model

Fork one of our GitHub repos into a new GitHub repo (either hosted by Looker or by your company) that you can then extend or refine within your instance:

Adding Data Blocks to Projects

In addition to the method described in this section, you can also use LookML refinements to build on the LookML of views and Explores in your projects.

To build on a data block, your Looker admin must enable the Local Project Import Labs feature. If you are deploying a block through the Looker Marketplace, your Looker admin must have enabled both the Marketplace and the Local Project Import Labs features.

To add a data block to your project:

  1. Add a new project to your Looker instance.

  2. Fork or copy the GitHub repos mentioned above to access prebuilt LookML. Be sure to create a new GitHub repo.

  3. Remove other database dialect files from the repo. Looker Blocks will typically contain files for Google BigQuery, Amazon Redshift, and Snowflake. For example, if you are setting up data blocks on Google BigQuery, you will only need the Google BigQuery view files, Google BigQuery Explore file, and Google BigQuery model file.

  4. Replace the connection name in your model file with your database connection where the data for data blocks lives, or, in the case of Google BigQuery and Snowflake, with your existing database connection from which you will be extending or refining:

    All join logic exists in an .explore file in each of the repositories. This is the file you will be including in the following steps, after you have set up your project manifest.

  5. In your main Looker project where you will be extending or refining data blocks, create a project manifest file:

  6. Add the following LookML to the project manifest file to reference data blocks in your main Looker project:

    project_name: "<your_project_name>" local_dependency: { project: "<project_name_of_datablock>" }

Setup Considerations and Options

Google BigQuery: Be sure to use the correct set of modeled files. If you are on Google BigQuery you may want to reference all files with _bq_ in the file name. You may have to adapt our Google BigQuery model dialects to your own database dialect.

Google BigQuery does not support project sharing across regions. To directly access Data Blocks in Google BigQuery from outside the U.S. region, you can:

Extensions: All of our projects have been set up to allow for extensions from Explore files, since model extension could cause issues with multiple connections.

Joining Derived Tables: You may want to take a look at our documentation for native derived tables. You can let Looker write SQL for you at different levels of aggregation on our publicly available datasets and join them into your model.

Merging Result Sets: You can also choose to merge result sets from our datasets with your data by combining query result sets. View this short video to learn more about merging data.

Example Setup of the Demographic Dataset

  1. Get access to data by either downloading raw data from our S3 or GCS buckets or by connecting to a Looker database.

  2. Import the Demographic Data Block model from LookML as a separate project in your Looker instance:

  3. Use the include parameter to bring in the view file.

  4. Then either extend or refine the view file, or make use of native derived tables to get data at the level of aggregation that is necessary for Explores.

    In our example, since the demographic data is at a different level of aggregation than our e-commerce dataset (block group vs. zip code) we use native derived tables to aggregate stats up to the zip code level. This eliminates messy many-to-many joins:

    include: "/american_community_survey/bq.explore" view: zipcode_income_facts { derived_table: { persist_for: "10000 hours" explore_source: fast_facts { column: ZCTA5 { field: tract_zcta_map.ZCTA5 } column: income_household { field: bg_facts.avg_income_house } column: total_population { field: bg_facts.total_population } } } dimension: ZCTA5 {} dimension: income_household { hidden: yes }

  5. Join view files into the model:

    include: "acs*.view" explore: order_items { join: users { sql_on: ${users.id} = ${order_items.user_id} ;; type: left_outer relationship: many_to_one } join: zipcode_income_facts { sql_on: ${users.zip} = ${zipcode_income_facts.ZCTA5} ;; type: left_outer relationship: many_to_one } }

  6. Explore your data:

  7. Visualize your data:

Using Viz Blocks

Looker includes a variety of native visualization types. However, if, you have charting needs that are not covered by Looker’s native visualization types, you can also add your own custom visualization types. You can also develop a custom visualization and make it available to all Looker users from the Looker Marketplace.

Viz Blocks are pre-built JavaScript visualization types that are hosted by Looker. You can add the Viz Blocks to your Looker instance, and they will act similarly to any of Looker’s native visualization types: they appear on the visualization menu bar, and they include core functionality such as drilling, downloading, embedding, and scheduling.

To learn more about a Viz Block, select the visualization type in the Viz Block category of the Blocks Directory, then click See the Code and navigate to the Viz Block’s READ.ME file. The READ.ME file shows an example of the visualization and gives more information about the Viz Block. For some visualizations the READ.ME file also provides a URL and instructions for adding the Viz Block.

To add the visualization type to your instance, see the instructions in the READ.ME file (if any) and the information on our Visualizations documentation page.

Top