Exporter¶
-
class
previsionio.exporter.
Exporter
(_id, connector_id: str, name: str, description: str = None, path: str = None, bucket: str = None, database: str = None, table: str = None, g_cloud: previsionio.connector.GCloud = None, write_mode: previsionio.exporter.ExporterWriteMode = <ExporterWriteMode.safe: 'safe'>, **kwargs)¶ Bases:
previsionio.api_resource.ApiResource
,previsionio.api_resource.UniqueResourceMixin
An exporter to access a distant data pool and upload data easily. This resource is linked to a
Connector
resource that represents the connection to the distant data source.Parameters: - _id (str) – Unique id of the exporter
- connector_id (str) – Reference to the associated connector (the resource to go through to get a data snapshot)
- name (str) – Name of the exporter
- description (str, optional) – Description of the exporter
- path (str, optional) – Path to the file to write on via the exporter
- bucket (str, optional) – Bucket of the file to write on via the exporter
- database (str, optional) – Name of the database to write on via the exporter
- table (str, optional) – Name of the table to write on via the exporter
- g_cloud (
GCloud
, optional) – Type of google cloud service - write_mode (
ExporterWriteMode
, optional) – Write mode
-
delete
()¶ Delete an exporter from the actual [client] workspace.
Raises: PrevisionException
– If the exporter does not existrequests.exceptions.ConnectionError
– Error processing the request
-
export_dataset
(dataset: previsionio.dataset.Dataset, wait_for_export: bool = False)¶ Upload a
Dataset
from the current active project using the exporter.Parameters: Returns: The registered export object
Return type:
-
export_file
(file_path: str, encoding: str = None, separator: str = None, decimal: str = None, thousands: str = None, wait_for_export: bool = False, **kwargs)¶ Upload a CSV file using the exporter.
Parameters: - file_path (str) – Path of the file to upload
- encoding (str, optional) – Encoding of the file to upload
- separator (str, optional) – Separator of the file to upload
- decimal (str, optional) – Decimal of the file to upload
- thousands (str, optional) – Thousands of the file to upload
- wait_for_export (bool, optional) – Wether to wait until the export is complete or not
Returns: The registered export object
Return type:
-
export_prediction
(prediction: Union[previsionio.prediction.DeploymentPrediction, previsionio.prediction.ValidationPrediction], wait_for_export: bool = False)¶ Upload a
DeploymentPrediction
or aValidationPrediction
from the current active project using the exporter.Parameters: - dataset (
DeploymentPrediction`|:class:
.ValidationPrediction`) – prediction to upload - wait_for_export (bool, optional) – Wether to wait until the export is complete or not
Returns: The registered export object
Return type: - dataset (
-
classmethod
from_id
(_id: str)¶ Get an exporter from the instance by its unique id.
Parameters: _id (str) – Unique id of the exporter to retrieve Returns: The fetched exporter Return type: Exporter
Raises: PrevisionException
– Any error while fetching data from the platform or parsing the result