looker-open-source / look-at-me-sideways

A style guide and linter for Looker's LookML data modeling language
MIT License
126 stars 37 forks source link

Unhelpful error when using extends in explore #183

Closed aleksandarmilosev closed 4 months ago

aleksandarmilosev commented 5 months ago

To reduce code repetition, the explores can be structured as such (as an example):

  1. base explore with generic joins to dimensions, located in .../models/_base_dimension_joins.model.lkml:
    
    connection: "< some database >"

include: "../views/dim_account.view.lkml" include: "../views/dim_client.view.lkml" include: "../views/dim_user.view.lkml"

explore: account { extension: required view_name: fact join: dim_account { from: dim_account relationship: many_to_one view_label: "Accounts" sql_on: ${fact.account_id} = ${dim_account.id} ;; } }

explore: client { extension: required view_name: fact join: dim_client { relationship: many_to_one view_label: "Clients" sql_on: ${fact.client_id} = ${dim_client.id} ;; } }

explore: user { extension: required view_name: fact join: dim_user { relationship: many_to_one view_label: "Users" sql_on: ${fact.user_id} = ${dim_user.id} ;; } }


2. Then, the base dimensions are used via extends in explores, e.g. `.../models/core.model.lkml`:

include: "_base_dimension_joins.model.lkml" include: "../views/fct_client_invoice_paid.view.lkml"

explore: fct_client_created { extends: [account, client] from: fct_client_created }

explore: fct_client_invoice_paid { extends: [account, client, user] from: fct_client_invoice_paid }

explore: fct_user_signed_in { extends: [account, client] from: fct_user_signed_in }


In Looker, there are no errors and the explores, and the underlying SQL, behave correctly.

The only issue is an ambiguous error when running `lams`.

Error message:

Property (core,_base_dimension_joins) must be a string or integer



The error does not seem to be related to any rule - test by removal of each rule. Also, reading up on the docs has lead me here.

This could potentially be a bug, but not sure. Needs investigation.
fabio-looker commented 5 months ago

Someone else also mentioned this, and to be honest the extensions/refinements capabilities of the parser are only as tested as far as my imagination in writing test cases, so thank you for the specifics here.

I'm OOO for the remainder of the week, but I'll take a look at this next week!

fabio-looker commented 4 months ago

It seems this was actually an error caused by attempting to include one model file into another model file. The parser was attempting to use an array of both the files' names as the name of the assembled model. Should be fixed in v3.1.4