Skip to content

Commit

Permalink
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
added an integration test for the new append method
Browse files Browse the repository at this point in the history
Seher Karakuzu authored and Seher Karakuzu committed Mar 13, 2024

Verified

This commit was signed with the committer’s verified signature.
zackkatz Zack Katz
1 parent dfb91fd commit e46aca8
Showing 2 changed files with 30 additions and 1 deletion.
29 changes: 29 additions & 0 deletions tiled/_tests/test_writing.py
Original file line number Diff line number Diff line change
@@ -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]
]
2 changes: 1 addition & 1 deletion tiled/client/dataframe.py
Original file line number Diff line number Diff line change
@@ -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.

0 comments on commit e46aca8

Please sign in to comment.