data_export
Module to interact with data exports.
This module contains class to interact with a data export request in EMS data integration.
Typical usage example:`
```python
# Export data directly as data frame:
df = data_model.export_data_frame(query)
# Export data to CSV files
data_export = data_model.create_data_export(query, ExportType.CSV)
data_export.wait_for_execution()
for i, chunk in enumerate(data_export.get_chunks()):
with open(f"FILE_PATH_{i}.csv", "wb") as f:
f.write(chunk.read())
```
DataExport ¶
Bases: DataExportStatusResponse
Data export object to interact with data export specific data integration endpoints.
from_transport
classmethod
¶
Creates high-level data export object from given DataExportStatusResponse.
Parameters:
-
client
(
Client
) –Client to use to make API calls for given data pool.
-
data_model_id
(
str
) –Id of data model where data export is located.
-
data_export_transport
(
DataExportStatusResponse
) –DataExportStatusResponse object containing properties of data export.
Returns:
-
DataExport
–A DataExport object with properties from transport and given client.
get_chunks ¶
Yields exported chunks.
Yields:
-
typing.Generator[io.BytesIO, None, None]
–Byte chunks of exported data.
Raises:
-
PyCelonisDataExportRunningError
–Raised in case export is still in progress.
-
PyCelonisDataExportFailedError
–Raised in case export failed.