Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Rule? Equality constraint type checking #7

Open
fabio-looker opened this issue May 8, 2019 · 0 comments
Open

New Rule? Equality constraint type checking #7

fabio-looker opened this issue May 8, 2019 · 0 comments
Labels
enhancement New feature or request new-rule New Rule

Comments

@fabio-looker
Copy link
Contributor

Possible enhancement...

As I recently discovered, for strictly typed dialects like BigQuery, updating the type of a column/field can be very difficult since you don't know where that field is referenced in join constraints.

So for example, the following could throw an error:

explore: a {
  join: b {sql_on: ${b.pk1_b_id} = ${a.b_id} ;;}
}
view: a { dimension: b_id {type:string}}
view: b { dimension: pk1_b_id {type:number}}

As stated, this would the first linter-enabled rule that is not strictly locally scoped. (Contrast with PK rules which are mediated by a naming convention, so they are implementable as two separate rules, one which checks local conformance to the naming convention, and another which checks local conformance given the name).

Alternately, we could encourage defensive application of the new LookML type coercion operator (::type), if that operator does not apply unnecessary conversions when the field is already of the desired type, like so:

explore: a {
  join: b {sql_on: ${b.pk1_b_id::number} = ${a.b_id::number} ;;}
}
view: a { dimension: b_id {type:string}}
view: b { dimension: pk1_b_id {type:number}}

I'm not sure which I would recommend, but wanted to create a place to discuss

@fabio-looker fabio-looker added enhancement New feature or request new-rule New Rule labels May 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request new-rule New Rule
Projects
None yet
Development

No branches or pull requests

1 participant