diff --git a/tiled/_tests/test_writing.py b/tiled/_tests/test_writing.py index 0f3f0704d..45e31e8f9 100644 --- a/tiled/_tests/test_writing.py +++ b/tiled/_tests/test_writing.py @@ -489,3 +489,32 @@ def test_write_with_specified_mimetype(tree): ), ], ) + + +def test_append_partition(tree): + with Context.from_app(build_app(tree)) as context: + client = from_context(context, include_data_sources=True) + df = pandas.DataFrame({"A": [1, 2, 3], "B": [4, 5, 6]}) + structure = TableStructure.from_pandas(df) + + x = client.new( + "table", + [ + DataSource( + structure_family="table", + structure=structure, + mimetype="text/csv", + ), + ], + key="x", + ) + x.write(df) + + df2 = pandas.DataFrame({"A": [11, 12, 13], "B": [14, 15, 16]}) + + x.append_partition(df2, 0) + df3 = pandas.DataFrame({"A": [1, 2, 3, 11, 12, 13], "B": [4, 5, 6, 14, 15, 16]}) + + assert [row for col in x.columns for row in x[col]] == [ + row for col in df3.columns for row in df3[col] + ] diff --git a/tiled/client/dataframe.py b/tiled/client/dataframe.py index 999977266..0287a8773 100644 --- a/tiled/client/dataframe.py +++ b/tiled/client/dataframe.py @@ -229,7 +229,7 @@ def append_partition(self, dataframe, partition): headers={"Content-Type": APACHE_ARROW_FILE_MIME_TYPE}, ) ) - + def export(self, filepath, columns=None, *, format=None): """ Download data in some format and write to a file.