Skip to content

Commit 18d85ce

Browse files
committed
Update
1 parent 60fc0f2 commit 18d85ce

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

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

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ def ingest_from_dataframe(
107107
https://docs.microsoft.com/en-us/azure/data-explorer/ingest-data-overview#ingestion-methods
108108
:param pandas.DataFrame df: input dataframe to ingest.
109109
:param azure.kusto.ingest.IngestionProperties ingestion_properties: Ingestion properties.
110-
:param DataFormat data_format: Format to convert the dataframe to. If not specified, it will try to infer it from the mapping, if not found, it will default to JSON.
110+
:param DataFormat data_format: Format to convert the dataframe to - Can be DataFormat.CSV, DataFormat.JSOn or None. If not specified, it will try to infer it from the mapping, if not found, it will default to JSON.
111111
"""
112112

113113
if self._is_closed:
@@ -126,8 +126,10 @@ def ingest_from_dataframe(
126126
is_json = False
127127
elif data_format == DataFormat.CSV:
128128
is_json = False
129-
elif data_format != DataFormat.JSON:
130-
raise ValueError("Unsupported format: {}".format(data_format))
129+
elif data_format == DataFormat.JSON:
130+
is_json = True
131+
else:
132+
raise ValueError("Unsupported format: {}. Supported formats are: CSV, JSON, None".format(data_format))
131133

132134
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")
133135
temp_file_path = os.path.join(tempfile.gettempdir(), file_name)

0 commit comments

Comments
 (0)