DataSource(_id, connector_id: str, name: str, path: str = None, database: str = None, table: str = None, request: str = None, gCloud: previsionio.connector.GCloud = None, **kwargs)¶
A datasource to access a distant data pool and create or fetch data easily. This resource is linked to a
Connectorresource that represents the connection to the distant data source.
- _id (str) – Unique id of the datasource
- connector_id (str) – Reference to the associated connector (the resource to go through to get a data snapshot)
- name (str) – Name of the datasource
- path (str, optional) – Path to the file to fetch via the connector
- database (str, optional) – Name of the database to fetch data from via the connector
- table (str, optional) – Name of the table to fetch data from via the connector
- bucket (str, optional) – Bucket of the file to fetch via the connector
- request (str, optional) – Direct SQL request to use with the connector to fetch data
- gCloud (
GCloud, optional) – Type of google cloud service
Delete a datasource from the actual [client] workspace.
PrevisionException– If the datasource does not exist
requests.exceptions.ConnectionError– Error processing the request
Get a datasource from the instance by its unique id.
Parameters: _id (str) – Unique id of the resource to retrieve Returns: The fetched datasource Return type:
PrevisionException– Any error while fetching data from the platform or parsing the result
list(project_id: str, all: bool = False)¶
List all the available datasources in the current active [client] workspace.
Contrary to the parent
list()function, this method returns actual
DataSourceobjects rather than plain dictionaries with the corresponding data.
- project_id (str) – Unique reference of the project id on the platform
- all (boolean, optional) – Whether to force the SDK to load all items of the given type (by calling the paginated API several times). Else, the query will only return the first page of result.
Fetched datasource objects