Skip to content

Commit 681bf83

Browse files
authored
Change gzip file mode to text with UTF-8 encoding for JSON output (#616)
1 parent 3ed2cb1 commit 681bf83

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
### Fixed
1111
- Changed extra's name back to `aio`
12+
- Fixed encoding error in `ingest_from_dataframe` when using csv data format.
1213

1314
## [6.0.0] - 2025-11-26
1415

azure-kusto-ingest/azure/kusto/ingest/base_ingest_client.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ def ingest_from_dataframe(
133133

134134
file_name = "df_{id}_{timestamp}_{uid}.{ext}.gz".format(id=id(df), timestamp=int(time.time()), uid=uuid.uuid4(), ext="json" if is_json else "csv")
135135
temp_file_path = os.path.join(tempfile.gettempdir(), file_name)
136-
with gzip.open(temp_file_path, "wb") as temp_file:
136+
with gzip.open(temp_file_path, "wt", encoding="utf-8") as temp_file:
137137
if is_json:
138138
df.to_json(temp_file, orient="records", date_format="iso", lines=True)
139139
ingestion_properties.format = DataFormat.JSON

0 commit comments

Comments
 (0)