The Problem
I am migrating to a new database, but my existing LookML projects are currently configured to my old database connection. I don't want to lose my projects, and I don't want to have to rewrite them from scratch for the new database connection. Is there a way to update the existing LookML to work with the new database connection?
The solution below outlines a high-level workflow for adapting LookML projects to a new database connection.
The Solution
Communicate with your developers and freeze all development during the migration process to avoid large-scale merge conflicts. Only one developer or admin, with development permissions for all affected projects, should make the changes described in this article.
- After you have secured and configured your new database, connect it to Looker. Select your database from the Looker Dialects documentation page for dialect-specific configuration instructions.
- Switch on Development Mode. Select one LookML project to update from the Develop menu.
- In the appropriate model files, change the connection name to the new database connection.
- Run the LookML Validator and fix any resulting LookML syntax errors.
If your database migration resulted in a SQL dialect change, be sure to check SQL syntax in all sql-based parameters, such as
sql_always_where
andsql_on
, as well assql
for fields and Native Derived Tablederived_columns
. Also be sure to check the SQL in any SQL-based derived tables to determine whether any syntax updates are needed. - Select Content Validator from the Develop panel. In the Content Validator, click the Validate button.
- If there are any resulting errors, click one of the affected Looks or dashboards listed under Content.
- Select Explore from Here from a Look or the three-dot menu of a dashboard tile displaying an error to find which field or function is the error source.
- Search the LookML project for that field or function.
- Fix the errors across the project.
- Repeat Steps 5-9 to validate content as needed.
- Commit and push the LookML changes to production once there are no more errors.
- Repeat the process above as necessary for any remaining projects.
Now your projects are ready for use with your new database connection!