How to use the spectacles.select.is_selected function in spectacles

To help you get started, we’ve selected a few spectacles examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github spectacles-ci / spectacles / tests / test_select.py View on Github external
def test_select_wrong_explore_should_not_match():
    assert not is_selected("model_a", "explore_a", ["model_a/explore_b"], [])
github spectacles-ci / spectacles / tests / test_select.py View on Github external
def test_exclude_explore_wildcard_should_not_match():
    assert not is_selected("model_a", "explore_a", ["*/*"], ["*/explore_a"])
github spectacles-ci / spectacles / tests / test_select.py View on Github external
def test_empty_selector_should_raise_value_error():
    with pytest.raises(ValueError):
        is_selected("model_a", "explore_a", [], [])
github spectacles-ci / spectacles / tests / test_select.py View on Github external
def test_select_model_wildcard_should_match():
    assert is_selected("model_a", "explore_a", ["model_a/*"], [])
    assert is_selected("model_a", "explore_b", ["model_a/*"], [])
github spectacles-ci / spectacles / tests / test_select.py View on Github external
def test_select_model_wildcard_should_match():
    assert is_selected("model_a", "explore_a", ["model_a/*"], [])
    assert is_selected("model_a", "explore_b", ["model_a/*"], [])
github spectacles-ci / spectacles / tests / test_select.py View on Github external
def test_exclude_model_wildcard_should_not_match():
    assert not is_selected("model_a", "explore_a", ["*/*"], ["model_a/*"])
github spectacles-ci / spectacles / tests / test_select.py View on Github external
def test_select_exact_model_and_explore_should_match():
    assert is_selected("model_a", "explore_a", ["model_a/explore_a"], [])
github spectacles-ci / spectacles / tests / test_select.py View on Github external
def test_exclude_exact_model_and_explore_should_not_match():
    assert not is_selected("model_a", "explore_a", ["*/*"], ["model_a/explore_a"])
github spectacles-ci / spectacles / tests / test_select.py View on Github external
def test_select_wildcard_should_match():
    assert is_selected("model_a", "explore_a", ["*/*"], [])
    assert is_selected("model_a", "explore_a", ["model_b/explore_a", "*/*"], [])
github spectacles-ci / spectacles / spectacles / validators / validator.py View on Github external
if not project_models:
            raise LookMlNotFound(
                name="project-models-not-found",
                title="No configured models found for the specified project.",
                detail=(
                    f"Go to {self.client.base_url}/projects and confirm "
                    "a) at least one model exists for the project and "
                    "b) it has an active configuration."
                ),
            )

        for model in project_models:
            model.explores = [
                explore
                for explore in model.explores
                if is_selected(model.name, explore.name, selectors, exclusions)
            ]

            if build_dimensions:
                for explore in model.explores:
                    dimensions_json = self.client.get_lookml_dimensions(
                        model.name, explore.name
                    )
                    for dimension_json in dimensions_json:
                        dimension = Dimension.from_json(
                            dimension_json, model.name, explore.name
                        )
                        dimension.url = self.client.base_url + dimension.url
                        if not dimension.ignore:
                            explore.add_dimension(dimension)

        self.project.models = [