Datasource

class perses_api.datasource.DatasourceBase[source]

Bases: ResourceBase

The class includes all necessary base methods to access the Perses datasources API

Parameters:

perses_api_model (APIModel) – Inject a Perses API model object that includes all necessary values and information

api

This is where we store the api

Type:

Api

create_datasource(datasource) dict[source]

The method includes a functionality to create a new datasource

Parameters:

datasource (Datasource | GlobalDatasource) – Specify the datasource resource to create

Raises:

Exception – Unspecified error by executing the API call

Returns:

The created datasource dict

Return type:

dict

delete_datasource(name: str) None[source]

The method includes a functionality to delete a datasource by name

Parameters:

name (str) – Specify the name of the datasource to delete

Raises:

ValueError – Missed specifying a necessary value

get_datasource(name: str) dict[source]

The method includes a functionality to retrieve a single datasource by name

Parameters:

name (str) – Specify the name of the datasource to retrieve

Raises:
  • ValueError – Missed specifying a necessary value

  • Exception – Unspecified error by executing the API call

Returns:

The datasource dict

Return type:

dict

get_datasources(name: str = None) list[source]

The method includes a functionality to retrieve all datasources

Parameters:

name (str) – Specify a name to filter the results (default None)

Raises:

Exception – Unspecified error by executing the API call

Returns:

A list of datasource dicts

Return type:

list

update_datasource(name: str, datasource) dict[source]

The method includes a functionality to update an existing datasource by name

Parameters:
  • name (str) – Specify the name of the datasource to update

  • datasource (Datasource | GlobalDatasource) – Specify the updated datasource resource

Raises:
  • ValueError – Missed specifying a necessary value

  • Exception – Unspecified error by executing the API call

Returns:

The updated datasource dict

Return type:

dict

class perses_api.datasource.GlobalDatasource[source]

Bases: DatasourceBase

The class includes all necessary methods to access the Perses global datasources API

Parameters:

perses_api_model (APIModel) – Inject a Perses API model object that includes all necessary values and information

api

This is where we store the api

Type:

Api

class perses_api.datasource.ProjectDatasource[source]

Bases: DatasourceBase

The class includes all necessary methods to access the Perses project-scoped datasources API

Parameters:
  • perses_api_model (APIModel) – Inject a Perses API model object that includes all necessary values and information

  • project_name (str) – Specify the name of the project to scope datasource operations to

api

This is where we store the api

Type:

Api

project_name

This is where we store the project_name

Type:

str

__init__(perses_api_model: APIModel, project_name: str)[source]