Skip to content

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.

client class-attribute

client: Client = Field(Ellipsis, exclude=True)

id class-attribute

id: str

data_model_id class-attribute

data_model_id: str

from_transport classmethod

from_transport(
    client, data_model_id, data_export_transport
)

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

get_chunks()

Yields exported chunks.

Yields:

  • typing.Generator[io.BytesIO, None, None]

    Byte chunks of exported data.

Raises:

wait_for_execution

wait_for_execution()

Waits until data export execution is done.