Skip to content

Commit

Permalink
Rename as_df to as_data_table.
Browse files Browse the repository at this point in the history
  • Loading branch information
plypaul committed May 31, 2024
1 parent e4c430f commit a96c4f7
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions tests_metricflow/table_snapshot/table_snapshots.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
)
Expand Down
2 changes: 1 addition & 1 deletion tests_metricflow/table_snapshot/test_source_schema.py
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
6 changes: 3 additions & 3 deletions tests_metricflow/table_snapshot/test_table_snapshots.py
Original file line number Diff line number Diff line change
Expand Up @@ -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=(
Expand Down Expand Up @@ -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,
)

Expand Down

0 comments on commit a96c4f7

Please sign in to comment.