Thread
#discussion
    a

    adventurous-furniture-1306

    1 year ago
    Any info on how the Looker integration works? I’m trying to puzzle out why my dashboards, Looker views, and snowflake assets don’t seem to connect through. I have some guesses, but info on how you’re using the API and tying stuff together could help me validate assumptions.
    e

    elegant-house-93198

    1 year ago
    I've tried to communicate how we run extractions on Looker in this document. If you have any suggestions about how we can improve it please let me know. Right now we try to connect the Looker dashboards to Snowflake tables by parsing queries run in Snowflake but it's not as effective as we'd like it to be.
    a

    adventurous-furniture-1306

    1 year ago
    ooh, this looks helpful. I’ll give it a read
    digging through the Looker API docs and pulling sample data, they are not making your life easy at all. When pulling explore LookML, I only get the actual SQL table name for the parent table for that explore, none of the tables joined. We have our joins set up with the joined fields in our model lookml, so that’s the only thing that shows up in the API data. It doesn’t surface the table references like it does for the other views. If lookml view names perfectly mapped to DB table names, this wouldn’t be too bad, but they don’t, and I’m not sure how you’d get that info from the API. Spectacles https://www.spectacles.dev/ figures some of this out by using the API to run column header queries (limit, 0=1), which may be a decent approach for determining what the joins in an explore actually map to.
    Some more thoughts on how to stitch this together:1. GET`/lookml_models` will give you explore:name, explore:description, and explore:hidden (useful for a config option) 2. GET`/lookml_models/{lookml_model_name}/explores/{explore_name}` will give you the views joined into the explore. You can snag sql_table_name for the base view/table, and joins:name, joins:from (if its an aliased view), and TBD joins😒ql_table_name. Grab sets:name and sets:value to use in creating a query 3. use
    create_query
    to make a Looker API query, and get an ID for step 4
    {
      "model": {lookml_model_name},
      "view": {lookml_view_name}, from your explore LookML
      "fields": ["{lookml_field_name}"], from the set:value list
      "limit": "0" we just need a query ID
    }
    1. (step 4) GET`/queries/{query_id}/run/{result_format}` if you format the results as SQL, you’ll get a clean
    from schema.table
    back from the API
    I think that should allow you to scrape the Looker API for actual DB table names. you may also need to pull in the DB connection info, in case someone is using multiple DBs that you want to tie through to
    If you want to just tie a Look or Dashboard to tables, that should be simpler. The look/dashboard has a query slug, which the Look and Dash API calls will give you. You can use GET/queries/slug/{slug} to give you the query ID, then you’re back to step 4 above, with a clean set of table refs to use