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

Rename MetricFlowTestConfiguration in snapshot-generation script #1567

Merged
merged 1 commit into from
Dec 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions tests_metricflow/generate_snapshots.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ class MetricFlowTestCredentialSet(FrozenBaseModel): # noqa: D101


@dataclass(frozen=True)
class MetricFlowTestConfiguration: # noqa: D101
class MetricFlowEngineConfiguration: # noqa: D101
engine: SqlEngine
credential_set: MetricFlowTestCredentialSet

Expand All @@ -79,33 +79,33 @@ class MetricFlowTestCredentialSetForAllEngines(FrozenBaseModel): # noqa: D101
trino: MetricFlowTestCredentialSet

@property
def as_configurations(self) -> Sequence[MetricFlowTestConfiguration]: # noqa: D102
def as_configurations(self) -> Sequence[MetricFlowEngineConfiguration]: # noqa: D102
return (
MetricFlowTestConfiguration(
MetricFlowEngineConfiguration(
engine=SqlEngine.DUCKDB,
credential_set=self.duck_db,
),
MetricFlowTestConfiguration(
MetricFlowEngineConfiguration(
engine=SqlEngine.REDSHIFT,
credential_set=self.redshift,
),
MetricFlowTestConfiguration(
MetricFlowEngineConfiguration(
engine=SqlEngine.SNOWFLAKE,
credential_set=self.snowflake,
),
MetricFlowTestConfiguration(
MetricFlowEngineConfiguration(
engine=SqlEngine.BIGQUERY,
credential_set=self.big_query,
),
MetricFlowTestConfiguration(
MetricFlowEngineConfiguration(
engine=SqlEngine.DATABRICKS,
credential_set=self.databricks,
),
MetricFlowTestConfiguration(
MetricFlowEngineConfiguration(
engine=SqlEngine.POSTGRES,
credential_set=self.postgres,
),
MetricFlowTestConfiguration(
MetricFlowEngineConfiguration(
engine=SqlEngine.TRINO,
credential_set=self.trino,
),
Expand All @@ -119,7 +119,7 @@ def run_command(command: str) -> None: # noqa: D103
raise RuntimeError(f"Error running command: {command}")


def set_engine_env_variables(test_configuration: MetricFlowTestConfiguration) -> None:
def set_engine_env_variables(test_configuration: MetricFlowEngineConfiguration) -> None:
"""Set connection env variables dynamically for the engine being used.

Requires MF_TEST_ENGINE_CREDENTIALS env variable to be set with creds for all engines.
Expand All @@ -137,7 +137,7 @@ def set_engine_env_variables(test_configuration: MetricFlowTestConfiguration) ->
os.environ["MF_SQL_ENGINE_PASSWORD"] = test_configuration.credential_set.engine_password


def run_tests(test_configuration: MetricFlowTestConfiguration) -> None: # noqa: D103
def run_tests(test_configuration: MetricFlowEngineConfiguration) -> None: # noqa: D103
set_engine_env_variables(test_configuration)

if test_configuration.engine is SqlEngine.DUCKDB:
Expand Down
4 changes: 2 additions & 2 deletions tests_metricflow/populate_persistent_source_schemas.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

from metricflow.protocols.sql_client import SqlEngine
from tests_metricflow.generate_snapshots import (
MetricFlowTestConfiguration,
MetricFlowEngineConfiguration,
run_cli,
run_command,
set_engine_env_variables,
Expand All @@ -18,7 +18,7 @@
logger = logging.getLogger(__name__)


def populate_schemas(test_configuration: MetricFlowTestConfiguration) -> None: # noqa: D103
def populate_schemas(test_configuration: MetricFlowEngineConfiguration) -> None: # noqa: D103
set_engine_env_variables(test_configuration)

if test_configuration.engine is SqlEngine.DUCKDB or test_configuration.engine is SqlEngine.POSTGRES:
Expand Down
Loading