Skip to content

Commit 55f1e15

Browse files
committed
updated parquet writer to not require filename extension now
1 parent a1222c0 commit 55f1e15

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

dsi/plugins/file_writer.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -313,6 +313,9 @@ def __init__(self, table_name, filename, export_cols = None, **kwargs):
313313
- Ex: if a table has columns [a, b, c, d, e], and export_cols = [a, c, e], only those are writted to Parquet
314314
"""
315315
super().__init__(filename, **kwargs)
316+
file_extension = filename.rsplit(".", 1)[-1] if '.' in filename else ''
317+
if file_extension not in ["pq", "parquet"]:
318+
filename = filename + ".pq"
316319
self.parquet_file_name = filename
317320
self.table_name = table_name
318321
self.export_cols = export_cols

dsi/plugins/tests/test_file_writer.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ def test_parquet_writer():
5656
assert os.path.exists("student_physics_parquet.pq")
5757

5858
a.load_module('plugin', 'Parquet', 'reader', filenames="student_physics_parquet.pq")
59-
6059
assert "Parquet" in a.active_metadata.keys()
61-
assert a.active_metadata["Parquet"]["specification"] == ["!amy", "!amy1"]
60+
assert a.active_metadata["Parquet"]["specification"] == ["!amy", "!amy1"]
61+
62+
os.remove("student_physics_parquet.pq")

0 commit comments

Comments
 (0)