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

feat(looker): represent looker views dependencies from substitution #21806

Merged
merged 1 commit into from May 14, 2024

Conversation

rexledesma
Copy link
Member

@rexledesma rexledesma commented May 13, 2024

Summary & Motivation

Parse the Looker substitution syntax ($) using regex. See https://cloud.google.com/looker/docs/sql-and-referring-to-lookml#substitution_operator_ for more details.

This is similar to how dbt parses their jinja model templates. If raw, non-templated tables are included in the SQL alongside templated Looker views from Looker substitution, we will only provide the templated Looker views as upstream dependencies.

For SQL definitions that only use non-templated tables, we will still parse them using sqlglot.

And with SQL definitions that only use non-templated tables, but have Liquid templating, no parsing will occur.

How I Tested These Changes

pytest

Copy link
Member

@benpankow benpankow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, liking this structure

@rexledesma rexledesma force-pushed the rl/parse-looker-subtitution-views-using-regex branch 2 times, most recently from d25cdb2 to 056ace9 Compare May 14, 2024 18:40
@rexledesma rexledesma force-pushed the rl/parse-looker-subtitution-views-using-regex branch from 056ace9 to 549380a Compare May 14, 2024 18:52
Copy link
Member Author

rexledesma commented May 14, 2024

Merge activity

  • May 14, 11:52 AM PDT: Graphite rebased this pull request as part of a merge.
  • May 14, 11:53 AM PDT: @rexledesma merged this pull request with Graphite.

@rexledesma rexledesma merged commit d068ce6 into master May 14, 2024
1 check was pending
@rexledesma rexledesma deleted the rl/parse-looker-subtitution-views-using-regex branch May 14, 2024 18:53
alangenfeld pushed a commit that referenced this pull request May 14, 2024
…21806)

## Summary & Motivation

Parse the Looker substitution syntax ($) using regex. See
[https://cloud.google.com/looker/docs/sql-and-referring-to-lookml#substitution_operator_](https://cloud.google.com/looker/docs/sql-and-referring-to-lookml#substitution_operator_)
for more details.

This is similar to how dbt parses their jinja model templates. If raw,
non-templated tables are included in the SQL alongside templated Looker
views from Looker substitution, we will only provide the templated
Looker views as upstream dependencies.

For SQL definitions that only use non-templated tables, we will still
parse them using `sqlglot`.

And with SQL definitions that only use non-templated tables, but have
[Liquid
templating](https://cloud.google.com/looker/docs/liquid-variable-reference),
no parsing will occur.

## How I Tested These Changes
pytest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants