DataSource(_id, connector_id: str, name: str, path: str = None, database: str = None, table: str = None, request: str = None, 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 (
Connector) – 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
- request (str, optional) – Direct SQL request to use with the connector to fetch data
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.
Parameters: 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. Returns: Fetched datasource objects Return type: list(