You can access data from Amazon Redshift, optionally also using Amazon Redshift Spectrum to access data stored in S3.
Encrypting network traffic
Looker strongly recommends encrypting network traffic between the Looker application and your database. Consider one of the options described on the Enabling secure database access documentation page.
If you’re interested in using SSL encryption, see the Amazon Redshift documentation.
Users and security
First, create your Looker user.
some_password_here to a unique, secure password:
CREATE USER looker WITH PASSWORD 'some_password_here';
(taken from the Redshift ALTER USER documentation)
- 8 to 64 characters in length.
- Must contain at least one uppercase letter, one lowercase letter, and one number.
- Can use any printable ASCII characters (ASCII code 33 to 126) except
@, or space.
Next, grant the appropriate privileges:
GRANT USAGE ON SCHEMA public TO looker; GRANT SELECT ON TABLE public.table1 TO looker; GRANT SELECT ON TABLE public.table2 TO looker; ... GRANT SELECT ON TABLE public.tableN TO looker;
To give Looker access to the information schema data it needs for the LookML Generator and the SQL Runner side bar, run:
GRANT SELECT ON TABLE information_schema.tables TO looker; GRANT SELECT ON TABLE information_schema.columns TO looker;
If you want to
GRANT SELECT on all of your tables to the
looker user, execute this query:
GRANT SELECT ON ALL TABLES IN SCHEMA public TO looker;
For acceptable Redshift performance, it is necessary to set the proper distribution and sort keys. See the Redshift documentation for details.
Temp schema setup
While logged in to your Redshift database as an admin user, run:
CREATE SCHEMA looker_scratch AUTHORIZATION looker;
looker_scratch schema is already created or has bad permissions:
ALTER SCHEMA looker_scratch OWNER TO looker;
Setting the search_path
Finally, you should set an appropriate
search_path, which Looker’s SQL Runner uses to retrieve certain metadata from your database. Assuming you have created a user called
looker, and a temp schema called
looker_scratch, the command is:
ALTER USER looker SET search_path TO '$user',looker_scratch,schema_of_interest,public; ^^^^^^^^^^^^^^^^^^ ^^^^^^^^^^^^^^^^^^ include a comma-separated list of all schemas you'll use with Looker
Optionally accessing data in S3 using Amazon Redshift Spectrum
You can take full advantage of Amazon Redshift Spectrum’s performance from within Looker.
Spectrum significantly extends the functionality and ease of use for Redshift by letting users access data stored in S3, without having to load it into Redshift first. You can even join S3 data to data stored in Redshift, and the Redshift optimizer will take care of maximizing your query performance, optimizing both the S3 and Redshift portions of your query. For information on setting up access using Amazon Spectrum, see the Community topic on Using Amazon Redshift’s new Spectrum Feature.
Adding the connection
After completing the database configuration, you can connect to the database from Looker. In the Admin section of Looker, select Connections, and then select New Connection.
Fill out the connection details. The majority of these settings are common to most database dialects. They are described on the Connecting Looker to your database documentation page.
After configuring the connection options, click on Test These Settings to verify that the connection to Redshift is successful. See the Testing database connectivity documentation page for troubleshooting information.
Click Add Connection to save the connection.
For Looker to support some features, your database dialect must also support them.
In Looker 22.10, Amazon Redshift supports the following Looker features: