From a96c4f79130a7a9b54e0faceaf35c45fd07df749 Mon Sep 17 00:00:00 2001 From: Paul Yang Date: Tue, 28 May 2024 18:19:00 -0700 Subject: [PATCH] Rename `as_df` to `as_data_table`. --- tests_metricflow/table_snapshot/table_snapshots.py | 4 ++-- tests_metricflow/table_snapshot/test_source_schema.py | 2 +- tests_metricflow/table_snapshot/test_table_snapshots.py | 6 +++--- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/tests_metricflow/table_snapshot/table_snapshots.py b/tests_metricflow/table_snapshot/table_snapshots.py index 35aaa3216b..b2474cc0d8 100644 --- a/tests_metricflow/table_snapshot/table_snapshots.py +++ b/tests_metricflow/table_snapshot/table_snapshots.py @@ -90,7 +90,7 @@ def _parse_bool_str(bool_str: str) -> bool: raise RuntimeError(f"Invalid string representation of a boolean: {bool_str}") @property - def as_df(self) -> MetricFlowDataTable: + def as_data_table(self) -> MetricFlowDataTable: """Return this snapshot as represented by an equivalent data_table.""" # In the YAML files, all values are strings, but they need to be converted to defined type so that it can be # properly represented in a data_table @@ -134,7 +134,7 @@ def load(self, table_snapshot: SqlTableSnapshot) -> None: # noqa: D102 self._ddl_sql_client.create_table_from_data_table( sql_table=sql_table, - df=table_snapshot.as_df, + df=table_snapshot.as_data_table, # Without this set, the insert queries may be too long. chunk_size=500, ) diff --git a/tests_metricflow/table_snapshot/test_source_schema.py b/tests_metricflow/table_snapshot/test_source_schema.py index 985d5c02c1..b866390fba 100644 --- a/tests_metricflow/table_snapshot/test_source_schema.py +++ b/tests_metricflow/table_snapshot/test_source_schema.py @@ -56,7 +56,7 @@ def test_validate_data_in_source_schema( for table_snapshot in matching_table_snapshots: try: sql_table = SqlTable(schema_name=schema_name, table_name=table_snapshot.table_name) - expected_table_df = table_snapshot.as_df + expected_table_df = table_snapshot.as_data_table actual_table_df = sql_client.query(f"SELECT * FROM {sql_table.sql}") assert_data_tables_equal( actual=actual_table_df, diff --git a/tests_metricflow/table_snapshot/test_table_snapshots.py b/tests_metricflow/table_snapshot/test_table_snapshots.py index 554acfb7e7..a9ac77003a 100644 --- a/tests_metricflow/table_snapshot/test_table_snapshots.py +++ b/tests_metricflow/table_snapshot/test_table_snapshots.py @@ -42,10 +42,10 @@ def table_snapshot() -> SqlTableSnapshot: # noqa: D103 ) -def test_as_df(table_snapshot: SqlTableSnapshot) -> None: +def test_as_data_table(table_snapshot: SqlTableSnapshot) -> None: """Check that SqlTableSnapshot.as_df works as expected.""" assert_data_tables_equal( - actual=table_snapshot.as_df, + actual=table_snapshot.as_data_table, expected=MetricFlowDataTable.create_from_rows( column_names=[f"col{i}" for i in range(5)], rows=( @@ -73,7 +73,7 @@ def test_load( actual = ddl_sql_client.query(f"SELECT * FROM {schema_name}.{table_snapshot.table_name}") assert_data_tables_equal( actual=actual, - expected=table_snapshot.as_df, + expected=table_snapshot.as_data_table, compare_names_using_lowercase=ddl_sql_client.sql_engine_type is SqlEngine.SNOWFLAKE, )