On this Page
Docs Menu

Go to View Parameter List

This page refers to the sql_table_name parameter that is part of a view

sql_table_name can also be used as part of a join, described here

sql_table_name can also be used as part of an explore, described here


sql_table_name is a child of
view: new_alias_name
sql_table_name: table_name
a table name in your database


sql_table_name sets the table in your database that will be queried by a view. If you do not add a sql_table_name Looker defaults to the name of the view.

In other words, this:

- view: my_name

is logically equivalent to this:

- view: my_name sql_table_name: my_name

It is quite common to fall back on this default behavior, and not use sql_table_name. However, there are some major situations where it can be useful. First, in some cases you’ll simply want the view to have a different name than the underlying table, such as to clean up a messy table name:

- view: order sql_table_name: prod_orders_2

Additionally, there are cases when a view needs to be based on a database or schema that is not the default. The default database and schema for any given connection is configured in the Admin section of Looker under Connections. You can then make references like this:

- view: desired_view_name sql_table_name: database_name.schema_name.table_name


Make the customer view rely on the customer_1 table from the default schema:

- view: customer sql_table_name: customer_1

Make the customer view rely on the customer_1 table from the analytics schema:

- view: customer sql_table_name: analytics.customer_1

Common Challenges

Tables Referenced By view Must Be Accessible From The Current Connection

views are referenced by an explore or join parameter, which in turn is referenced by a model. The model determines which database connection is used (see connection for model). Database connections themselves are defined in the Admin section of Looker. When you reference a table in the sql_table_name parameter, the table needs to be accessible within the associated connection.

Still have questions?
Go to Discourse - or - Email Support