def test_roundtrip_multi_partitioned(tmp_path: pathlib.Path, sample_data: pa.Table): write_deltalake(str(tmp_path), sample_data, partition_by=["int32", "bool"]) delta_table = DeltaTable(str(tmp_path)) assert delta_table.pyarrow_schema() == sample_data.schema table = delta_table.to_pyarrow_table() table = table.take(pc.sort_indices(table["int64"])) assert table == sample_data
def test_roundtrip_basic(tmp_path: pathlib.Path, sample_data: pa.Table): write_deltalake(str(tmp_path), sample_data) assert ("0" * 20 + ".json") in os.listdir(tmp_path / "_delta_log") delta_table = DeltaTable(str(tmp_path)) assert delta_table.pyarrow_schema() == sample_data.schema table = delta_table.to_pyarrow_table() assert table == sample_data
def test_writer_with_table(existing_table: DeltaTable, sample_data: pa.Table): write_deltalake(existing_table, sample_data, mode="overwrite") existing_table.update_incremental() assert existing_table.to_pyarrow_table() == sample_data