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

Removing Materializations #445

Conversation

callum-mcdata
Copy link
Contributor

Materializations

This PR removes materializations. Originally it was done in three phases:

  • Removing materialization CLI commands
  • Removing the tests that failed with those CLI commands gone (probably should have been grouped with the first one)
  • Removing the materialization object and all its downstream uses

Unfortunately I ran into some issue with graphite because I was working on a forked version of metricflow. When trying to get it back onto this repo I ran into some real issues and just decided to fall back onto the old PR. In the future though, I've got graphite all set up and should be good to go for review and stacked commits!

Copy link
Contributor

@QMalcolm QMalcolm 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 for being so thorough! This looks great 🙂 after reading through the changes I pull down the branch and double checked for any references to materializations, and the only thing I found was a mention in the change log (and that seems appropriate to stay). Can't wait to get this merged as I think removing materializations moves the cutover to dbt-semantic-interfaces forward dramatically (a bunch of the tangled code was in materializations).

@callum-mcdata callum-mcdata marked this pull request as ready for review April 19, 2023 16:40
Copy link
Contributor

@QMalcolm QMalcolm left a comment

Choose a reason for hiding this comment

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

I was a dumbdumb and by the time I reviewed test_configurable_rules.py my brain was on autopilot 🙃

@@ -1,43 +0,0 @@
import pytest
Copy link
Contributor

@QMalcolm QMalcolm Apr 19, 2023

Choose a reason for hiding this comment

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

We shouldn't be removing this file's tests wholesale. I think we should instead modify the test_can_configure_model_validator_rules to continue working and test_cant_configure_model_validator_without_rules needs no changes.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Made changes based on your suggestions, let me know if that resolves the issue!

Comment on lines 14 to 30
model = model_with_materialization(
simple_model__with_primary_transforms,
[
materialization_with_guaranteed_meta(
name="foobar",
metrics=["invalid_bookings"],
dimensions=[DataSet.metric_time_dimension_name()],
)
],
)

# confirm that with the default configuration, an issue is raised
issues = ModelValidator().validate_model(model).issues
assert len(issues.all_issues) == 1, f"ModelValidator with default rules had unexpected number of issues {issues}"

# confirm that a custom configuration excluding ValidMaterializationRule, no issue is raised
rules = [rule for rule in ModelValidator.DEFAULT_RULES if rule.__class__ is not ValidMaterializationRule]
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this can be changed to the following

    model = copy.deepcopy(simple_model__with_primary_transforms)
    model.metrics.append(metric_with_guaranteed_meta(
        name='metric_doesnt_exist_squared',
        type=MetricType.DERIVED,
        type_params=MetricTypeParams(
            expr='metric_doesnt_exist * metric_doesnt_exist',
            metrics=[MetricInput(name='metric_doesnt_exist')]
        ),
    ))

    # confirm that with the default configuration, an issue is raised
    issues = ModelValidator().validate_model(model).issues
    assert len(issues.all_issues) == 1, f"ModelValidator with default rules had unexpected number of issues {issues}"

    # confirm that a custom configuration excluding ValidMaterializationRule, no issue is raised
    rules = [rule for rule in ModelValidator.DEFAULT_RULES if rule.__class__ is not DerivedMetricRule]

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added back!

Copy link
Contributor

Choose a reason for hiding this comment

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

Thank you! ❤️

@cla-bot cla-bot bot added the cla:yes label Apr 19, 2023
Copy link
Contributor

@QMalcolm QMalcolm left a comment

Choose a reason for hiding this comment

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

Approval 2: Electric Boogaloo

@callum-mcdata callum-mcdata merged commit 142f2a6 into main Apr 19, 2023
@mazinesy mazinesy mentioned this pull request Apr 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants