User Guide Getting Started Help Center Documentation Community Training
Looker
Importing Files from Other Projects

You can use the experimental labs feature, Project Import, to import files from other LookML projects and external repositories into your current project. This lets you use model files, view files, and other files in more than one project.

There are several use cases for this. A few examples:

To import files from another project, perform the following tasks:

  1. Create a project manifest file.
  2. Specify the projects from which you want to import.
  3. Include files from an imported project.

Create a Project Manifest File

All projects that import files from other projects must have a project manifest file. A project that does not reference any files outside of itself does not need a project manifest file.

To create a manifest file:

  1. Ensure Development Mode is set to ON.
  2. In the IDE, click the + icon next to Add Files.
  3. Select Create Project Manifest.

This will add a Project section to the sidebar and a new file called manifest.lkml. This file details which other projects are known and usable by the current project:

Specify the Projects from which You Want to Import

To import projects, specify them in the manifest. There are two methods of doing so: locally and remotely.

Specifying Local Projects

In a local import, the imported project must be present on the same Looker instance. Versioning is dynamic, meaning that changes in the imported project will immediately impact the project that imports it. This is a good option when the same team owns both projects and can validate changes in both places before pushing to production.

To import locally, use the project_name parameter to specify the current project. Use one or more local_dependency parameters to specify the project or projects to import:

# This project project_name: "my_project" # The project to import local_dependency: { project: "my_other_project" }

Specifying Remote Projects

In a remote import, the imported project does not need to be on the same instance. Rather, the project is imported through its remote Git repository. Versioning is static; changes in the imported project will not automatically reflect in the project that imports it. The desired version of the imported project is explicitly indicated. This is a good option for using Looker Blocks.

Remote imports work only with public repositories.

To import a remote repository, use the remote_dependency parameter to specify the URL of the Git repository and the commit SHA representing the version of the repository you want:

remote_dependency: ga_360_block { url: "git://github.com/llooker/google_ga360.git" ref: "4be130a28f3776c2bf67a9acc637e65c11231bcc" }

To get the URL for a public repository, copy its HTTPS URL and replace https:// with git://.

You can find commit SHAs anywhere you can browse the commit history. Git service providers usually makes the SHA clearly visible and copyable.

The name (in this example above, ga_360_block) can be anything you like. It will be used when you include its files in the following step.

Include Files from an Imported Project

The include parameter in model files specifies the dashboards, documentation, and view files that will be available to that model. To use include to reference a file in another project, preface the filename with the other project name. For example:

include: "/my_other_project/imported_view.view.lkml" include: "/ga_360_block/ga_block.view.lkml"

You can use wildcards to include multiple files. For example, to include all view files in the IMPORTED_PROJECT project:

include: "/IMPORTED_PROJECT/*.view.lkml"

Although this syntax looks like a pathname, it doesn’t imply that files for the project are laid out in any particular way. You cannot use . or .. to specify relative paths as these are not paths — this is just how files are named in an include statement.

Including Model Files

You cannot directly include a model file. Models for a project can only come from that project.

If you want to reuse or extend explores across projects, in the imported project you could put your explores in a dedicated file that does not end with .model.lkml, such as .explore.lkml. Then include that file as described above.

Including Files That Also Include Files

When including a file that includes other files, all the includes are resolved before being passed on to the next project that includes it.

For example, if in your current project, you import a file A from another project proj_A and the imported file contains an include parameter that includes file B from project proj_B, then file B will be included into file A before file A is imported into the current project.

Top