How to add a new view file


(Brett Sauve) #1

You should first decide if the view you want to add will be:

Note that new view files can only be created while in developer mode.

Adding a New View from an Existing Database Table

  1. Navigate to the LookML section

  2. Click the plus [+] sign to the right of VIEWS in the left panel.

  3. Choose Create View from Table

  4. You will be brought to a list of tables associated with one of your connections. To change the connection, use the Connection drop-down in the upper left.

  5. Select the table or tables that would like to create views from by checking the box to the left of the table name. You can collapse and expand database or schemas in this list to access all available tables.

  6. Scroll to the bottom of the page and click Create Views.

  7. New views will now be created with generated LookML of all the table columns.

Remember, in and of itself, a new view will not do anything. You should add it to your model file as an explore, or join it to an existing explore in your model file, in order to use it.

Adding a New View for a Derived Table

The Auto-generate Method

  1. Navigate to the SQL Runner

  2. Execute the SQL statement that you would like to turn into a Derived Table

  3. Copy the LookML that appears underneath the results of the query

  4. Navigate to the LookML section

  5. In the left hand pane there is a section called “Views”. Click the plus sign to the right of “Views”.

  6. Choose “Create View”

  7. An empty box will appear under your list of views (which may be below the bottom of your browser window). Type the name of the new view and hit Enter.

  8. You will be brought to the new view.

  9. Delete all the contents of the new view

  10. Paste in the LookML you copied in step 3

  11. Delete out the first row that starts with explore. It is highly discouraged to define an explore anywhere other than your model file.

Remember, in and of itself, a new view will not do anything. You should add it to your model file as an explore, or join it to an existing explore in your model file, in order to use it.

The Manual Method

  1. Navigate to the LookML section

  2. In the left hand pane there is a section called “Views”. Click the plus sign to the right of “Views”.

  3. Choose “Create View”

  4. An empty box will appear under your list of views (which may be below the bottom of your browser window). Type the name of the new view and hit Enter.

  5. You will be brought to the new view.

  6. Delete the row that is commented out and begins with “sql_table_name”

  7. Un-comment the other commented rows

  8. Create your derived table

Remember, in and of itself, a new view will not do anything. You should add it to your model file as an explore, or join it to an existing explore in your model file, in order to use it.

Adding a Blank View File

  1. Navigate to the LookML section

  2. In the left hand pane there is a section called “Views”. Click the plus sign to the right of “Views”.

  3. Choose “Create View”

  4. An empty box will appear under your list of views (which may be below the bottom of your browser window). Type the name of the new view and hit Enter.

  5. You will be brought to the new view.

  6. Modify the view as needed for your purpose.


How to access a new table in your database in Looker
View File Generation in Looker
Nested Data in BigQuery (Repeated Records)
(Yuriy) #2

Would you please add the reminder about explore somewhere under “Adding a New View from an Existing Database Table.” Screenshot would be really great.
When i refer users to this page, they seem to be not reading to the end of the article once they added a view.
Users ignore it thinking that everything else belongs to the next part.

Thank you


(Brett Sauve) #3

@yuriy I’ve made that change for you.


(davids) #4

As of version 3.36, you can add a SQL Runner query directly to a project as a derived table by selecting ‘Add to Project’ from the gear dropdown in the upper right:

More details can be found in this discourse article.


(Jesus Cruz) #5

New “Add File” button changes steps on how to add a View File. We no longer have a “+” button on “VIEWS” section. New steps should be on #2 below.

Adding a New View from an Existing Database Table

  1. Navigate to the LookML section
  2. Click the plus [+] sign to the right of Add Files … in the left panel.
  3. Choose Create View from Table


(Jesus Cruz) #6

Also need to update each section so that we replace the “+ from Views” to “+ from Add files …”

Adding a New View for a Derived Table

5. In the left hand pane there is a section called “Add Files …”. Click the plus sign to the right of “Add Files …”.

The Manual Method

2. In the left hand pane there is a section called “Add Files …”. Click the plus sign to the right of “Add Files …”.

Adding a Blank View File

2. In the left hand pane there is a section called “Add Files …”. Click the plus sign to the right of “Add Files …”.


(Yuriy) #7

Our users complain that they are not able to see/add the views from Oracle database using the automated method. Neither they are able to see the views in a list of schemas/tables. This is a real inconvenience for the teams since some teams have 250+ views, and adding them manually is a real pain. Is there an existing enhancement request that we can vote for or should we submit a new one?
To clarify, we are able to see the tables, but not views.

Thanks


(Peggy Beard) #8

Hi Yuriy!

Consider it submitted! :slight_smile: I’m curious about how you envision this working best for your users. Currently there’s a ‘create view from table’ dialog which lists the tables on the connection, and it lists the schemas to expand and see all the tables. If the teams have 250+ views, does this same type of option still work?


(Arish Ojaswi) #9

Can you please add a button to Select All Tables?
If the number of tables is very large (in the hundreds) and we wish to create views from all of the tables, it takes a lot of time to select each table one by one.


(diego.campos) #10

Hey @arishojaswi,
I think that is a very good idea indeed. I have shared your use case to Engineering, and rely on them for its implementation.