Note

This is a public alpha release, and therefore features and functionality may change and the software and documentation may contain technical bugs or other issues. If you discover any issues please consider registering a GitHub issue.

datasources.connectors.csv module

Connectors for handling CSV data.

class datasources.connectors.csv.CsvConnector(location: str, api_key: Union[str, NoneType] = None, auth: Union[Callable, NoneType] = None, metadata: Optional = None)[source]

Bases: datasources.connectors.base.DataSetConnector

Data connector for retrieving data from CSV files.

get_metadata(params: Union[Mapping[str, str], NoneType] = None)[source]

Return a JSON response from a CSV file.

Parameters:params – Query params - ignored
Returns:Metadata
get_response(params: Union[Mapping[str, str], NoneType] = None)[source]

Return a JSON response from a CSV file.

CSV file must have a header row with column titles.

Parameters:params – Optional query parameter filters
Returns:Requested data
class datasources.connectors.csv.CsvRow(*args, **values)[source]

Bases: mongoengine.document.DynamicDocument

MongoDB dynamic document to store CSV data.

Store in own database - distinct from PROV data. Collection must be changed manually when managing CsvRows since all connectors use the same backing model.

exception DoesNotExist

Bases: mongoengine.errors.DoesNotExist

exception MultipleObjectsReturned

Bases: mongoengine.errors.MultipleObjectsReturned

id

A field wrapper around MongoDB’s ObjectIds.

objects
class datasources.connectors.csv.CsvToMongoConnector(location: str, api_key: Union[str, NoneType] = None, auth: Union[Callable, NoneType] = None, metadata: Optional = None)[source]

Bases: datasources.connectors.base.InternalDataConnector, datasources.connectors.base.DataSetConnector

Data connector representing an internally hosted data source, backed by MongoDB.

This connector allows data to be pushed as well as retrieved.

clean_data(**kwargs)[source]

Clean, validate or otherwise structure the data contained within this data source.

clear_data()[source]

Clear all data from this data source.

get_response(params: Union[Mapping[str, str], NoneType] = None)[source]

Transparently return a response from a source API.

Parameters:params – Optional query parameter filters
Returns:Requested data / metadata - response is passed transparently
id_field_alias = '__id'
post_data(data: Union[MutableMapping[str, str], List[MutableMapping[str, str]]])[source]

Add data to this data source.

Parameters:data – Data to add