User Guide Getting Started Help Center Documentation Community Training
  
English
日本語
Google Cloud Spanner

Looker supports the Google Cloud Spanner relational database. This page lists the known issues with connecting to Spanner and explains how to make a connection.

Features and Known Issues

This section explains several features that are and are not supported when Looker connects to Google Cloud Spanner.

PDTs Are Not Supported

The Spanner JDBC driver is read-only, so it is not possible for Looker to create persistent derived tables. Derived tables are supported, however.

Symmetric Aggregates Are Not Supported

Spanner SQL doesn’t contain the necessary functions to support the calculations necessary for symmetric aggregates. SQL joins are supported, however.

Time Zones Are Not Supported

Time zone support is not implemented in this initial version of Spanner support. Keep in mind that the database’s default time zone is America/Pacific.

DISTINCT Aggregates Are Only Available for One Column per Query

Spanner SQL supports DISTINCT aggregates on only one column at a time. So it is possible that selecting multiple aggregates like COUNTs on joined tables can return an error. A potential workaround is to calculate DISTINCT aggregates in a subselect or a derived table.

Only One Connection to Google Spanner Is Supported per Instance

Due to the way Spanner authenticates service accounts, only one connection to Google Spanner is supported per instance.

Depending on the role that is selected for the service account, it is possible to connect to separate instances within the same project or separate databases within the same instance.

An upcoming JDBC driver will contain a fix for this issue. See your Account Manager if this issue affects you.

Getting the Connection Credentials

  1. Log in to the Google Console.

  2. Select the appropriate project:

  3. Select IAM & Admin and then Service accounts:

  4. Select Create service account, and fill in the dialog box as follows:

    • Service account name: Enter looker-spanner-service or something similar.
    • Role: Select Cloud Spanner then Cloud Spanner Database Reader.
    • Furnish a new private key: Check the box and select JSON under Key type.

  5. Click Create and keep track of the following:

    • The email address associated with the service account
    • The name and location of the JSON credential file that was downloaded

Creating the Looker Connection

This section requires command line access to the machine running Looker. If your instance is hosted by Looker, contact support@looker.com with your credential file so that we can perform these steps for you.

Preparing the Credential File

  1. Copy the credential file to the machine that will be running Looker:

    cp ~/Downloads/looker-spanner-69cb06906dc0.json ~/looker/

  2. Optional, but recommended: Modify the permissions on the credential file so that only the account running Looker can read it. Use the following commands:

    chown looker:looker ~/looker/looker-spanner-69cb06906dc0.json chmod 600 ~/looker/looker-spanner-69cb06906dc0.json

Preparing the Looker Environment

The Google Cloud Spanner JDBC driver uses the environment variable GOOGLE_APPLICATION_CREDENTIALS to locate the credential file, so it must be set in the environment that runs Looker.

  1. Create or edit the lookerstart.cfg file and add a line similar to this:

    export GOOGLE_APPLICATION_CREDENTIALS=/home/looker/looker-spanner-69cb06906dc0.json

  2. Start Looker with ./looker start, or restart Looker with ./looker restart.

Configuring the Connection Settings Page

  1. In the Admin section of Looker, navigate to the Connections page and click New Connection. Looker displays this page:

  2. In the Dialect drop-down, select Google Cloud Spanner.

  3. Fill out the page as follows:

  1. Click Test These Settings, and you should see Can connect in a green box.

  2. Click Add Connection.

Troubleshooting

Feature Support

Looker’s ability to provide some features depends on whether the database dialect can support them.

In the current Looker release, Google Cloud Spanner supports the following Looker features:

References

Next Steps

After you have connected your database to Looker, you’re ready to configure sign-in options for your users.

Top