The Local Project Import feature is an experimental Labs feature that imports files from local LookML projects. Experimental features are not fully developed and may be significantly changed or completely removed.
Importing files from remote or local LookML projects is not currently compatible with model localization.
You can 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:
Building on top of an installed Looker Block without having to make direct changes to it. If Looker makes changes to the Block, you can easily pull the changes in because all of the LookML you’ve added to it is kept in a separate repository.
Maintaining a base project that is autogenerated based on the database schema. You can put all your custom dimensions, measures, and so on, in a separate project that imports all the LookML from the autogenerated project. You can regularly regenerate the base project as the database schema changes without overwriting all your custom LookML.
Encapsulating shared objects in a single project and then importing them into multiple other projects. For example, if you’ve got a table that is common to multiple databases, you could put the view for it in one project and maintain it in that one place. Then have multiple other projects make use of it by importing the table into those projects.
To import files from another project, perform the following tasks:
- Create a project manifest file.
- Specify the projects from which you want to import.
- 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. If your project doesn’t already have a manifest file, you can create one.
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
Your Looker Admin must enable the Local Project Import Labs feature in order to import local files into your project.
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:
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.
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:
To get the URL for a remote repository, copy its HTTPS URL and replace
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.
Adding Authentication Credentials for Private Remote Repositories
The Project Settings page includes the Import Credentials tab, where you can manage authentication credentials for private remote repositories:
The Import Credentials tab lists the URL for each remote repository that has been defined in the project manifest file, the type of authentication used for the repository, and whether Looker can successfully connect to the repository.
To add authentication credentials for a repository:
Hover over a repository name to display the Test and Edit buttons, and click Edit:
Looker displays a dialog box letting you configure credentials for the remote repository. The dialog box will reflect the type of credentials required.
If the repository requires a username and password for authentication, enter your username and password and click Submit:
If the repository requires an SSH key, Looker displays a dialog box showing your local SSH key. Click Copy Key to copy the SSH key to your clipboard, and add it to your repository’s list of keys:
After saving the credentials, click Test button to test Looker’s access to the repository:
After successfully connecting to the repository, the Import Credentials page shows a green check mark next to the repository name:
Include Files from an Imported Project
include parameter in a model file specifies the project files that will be available to that model. Once you specify an imported project in the manifest file, you can use the
include parameter in a model file to specify files from the imported project. Only files whose project is listed in the manifest file can be included. To
include a file from another project, preface the file name with the other project name.
You can use wildcards to include multiple files. For example, to include all view files in the
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
.. to specify relative paths as these are not paths — this is just how files are named in an include statement.
Including Model Files
You can include a model file from an imported project using the
include parameter, just like a view file or other file type:
include a model file, and that model file defines a database connection using the
connection parameter, that connection will override any database connection configured in the importing model file. See the
include parameter documentation for more information on including model files in a different model file.
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.
Importing Data Files
Files stored in the Data section of a project are not imported. To reference a data file from an imported project, such as in the
map_layer parameter, use the full path and file name of the file. For example: