Skip to content

Commit

Permalink
Rename MetricFlowTestConfiguration in snapshot-generation script (#…
Browse files Browse the repository at this point in the history
…1567)

This PR renames `MetricFlowTestConfiguration` in
`tests_metricflow/generate_snapshots.py` as it conflicts with another
class in the codebase.
  • Loading branch information
plypaul authored Dec 12, 2024
1 parent 66377f5 commit ab06b84
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
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

0 comments on commit ab06b84

Please sign in to comment.