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

Remove inconsistent Jinja param errors #309

Merged
merged 2 commits into from
Jul 8, 2024
Merged

Conversation

courtneyholcomb
Copy link
Contributor

@courtneyholcomb courtneyholcomb commented Jul 8, 2024

Description

Remove some errors related to Jinja objects. This will allow more flexible syntax. The main problem driving this change is that we have multiple places that parse the same Jinja syntax, but each has different behavior. This means that if you pass a certain syntax into a where filter, that same syntax won't work in a group by. In order to align the two, we must use the more permissive option, since adding new restrictions would be a breaking change. Changes here:

  • Allow passing the grain in the name of a time dimension using dunder syntax. This means it can be passed in the name or via a separate parameter, and we will only error if both are passed and they don't match.
  • Don't error if metric_time is passed into a Dimension(...) object. This error creates inconsistent restrictions, not only between where & group by params, but within this where param. Before this change, it would only error if you passed metric_time into Dimension(...) without a grain. If you include a grain, no error. Instead of raising this error, just allow it and MF will sort it out.

Checklist

@@ -16,15 +16,16 @@

@dataclass(frozen=True)
class DimensionCallParameterSet:
"""When 'Dimension(...)' is used in the Jinja template of the where filter, the parameters to that call."""
"""When 'Dimension(...)' is used in a Jinja template, the parameters to that call."""
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Removed specificity to where filter here, since Jinja parsing is used elsewhere now, too.

@courtneyholcomb courtneyholcomb changed the title Court/params Remove inconsistent Jinja param errors Jul 8, 2024
@dbt-labs dbt-labs deleted a comment from github-actions bot Jul 8, 2024
Copy link
Contributor

@DevonFulcher DevonFulcher left a comment

Choose a reason for hiding this comment

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

Thank you!

@courtneyholcomb courtneyholcomb merged commit c9c98ca into main Jul 8, 2024
98 of 100 checks passed
@courtneyholcomb courtneyholcomb deleted the court/params branch July 8, 2024 23:55
courtneyholcomb added a commit to dbt-labs/metricflow that referenced this pull request Jul 9, 2024
Upgrades DSI. This is needed to upgrade DSI in MFS. MFS does not depend
on DSI directly, instead relying on MF to set the DSI dependency. The
DSI upgrade is needed in MFS to get [this bug
fix](dbt-labs/dbt-semantic-interfaces#309)
released.
[This is the PR](dbt-labs/metricflow-server#746)
currently blocked by the upgrade.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants