Module lunar.data.datasets

Sub-modules

lunar.data.datasets.dataset
lunar.data.datasets.models

Classes

class Dataset (**data: Any)

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Ancestors

  • DatasetBase
  • pydantic.generics.GenericModel
  • pydantic.main.BaseModel
  • pydantic.utils.Representation
  • typing.Generic

Class variables

var id : str
class DatasetClient (config: Config)

Client for BAP Data API (/v1/datasets/).

Example

import bap

client = bap.client("dataset")

Ancestors

Methods

def create_dataset(self, id: str, data_type: str, params: Dict[str, Any]) ‑> Dataset

Create a new dataset.

Args

  • id: (str) Unique identifier of a dataset
  • data_type: (str) Dataset type
  • params: (dict) Dataset parameters

Returns

Dataset

Example

# For dynamodb
dataset = client.create_dataset(
    id="my_dataset",
    data_type="dynamodb",
    params={"tables": ["first_table", "second_table"], "main_table": "first_table"},
)

# For docdb
dataset = client.create_dataset(
    id="my_dataset",
    data_type="docdb",
    params={"collection": "my_collection"},
)
async def create_dataset_async(self, id: str, data_type: str, params: Dict[str, Any]) ‑> Dataset

Create a new dataset (async).

Args

  • id: (str) Unique identifier of a dataset
  • data_type: (str) Dataset type
  • params: (dict) Dataset parameters

Returns

Dataset

Example

# For dynamodb
dataset = await client.create_dataset_async(
    id="my_dataset",
    data_type="dynamodb",
    params={"tables": ["first_table", "second_table"], "main_table": "first_table"},
)

or

# For docdb
dataset = await client.create_dataset_async(
    id="my_dataset",
    data_type="docdb",
    params={"collection": "my_collection"},
)
def delete_dataset(self, id: str) ‑> None

Delete a dataset.

Args

  • id: (str) Unique identifier of a dataset

Example

client.delete_dataset(id="my_dataset")
async def delete_dataset_async(self, id: str) ‑> None

Delete a dataset (async)

Args

  • id: (str) Unique identifier of a dataset

Example

await client.delete_dataset_async(id="my_dataset")
def get_dataset(self, id: str) ‑> Dataset

Get a dataset.

Args

  • id: (str) Unique identifier of a dataset

Returns

Dataset

Example

dataset = client.get_dataset(id="my_dataset")
async def get_dataset_async(self, id: str) ‑> Dataset

Get a dataset (async).

Args

  • id: (str) Unique identifier of a dataset

Returns

Dataset

Example

dataset = await client.get_dataset_async(id="my_dataset")
def list_datasets(self) ‑> List[Dataset]

List datasets.

Returns

list(Dataset)

Example

datasets = client.list_datasets()
async def list_datasets_async(self) ‑> List[Dataset]

List datasets (async).

Returns

list(Dataset)

Example

datasets = await client.list_datasets_async()
def update_dataset(self, id: str, data_type: str, params: Dict[str, Any]) ‑> Dataset

Update a dataset.

Args

  • id: (str) Unique identifier of a dataset
  • data_type: (str) Dataset type
  • params: (dict) Dataset parameters

Returns

Dataset

Example

# For dynamodb
experiment = client.update_dataset(
    id="my_dataset",
    data_type="dynamodb",
    params={"tables": ["first_table", "second_table", "third_table"], "main_table": "second_table"}
)

# For docdb
experiment = client.update_dataset(
    id="my_dataset",
    data_type="docdb",
    params={"collections": "new_collections"}
)
async def update_dataset_async(self, id: str, data_type: str, params: Dict[str, Any]) ‑> Dataset

Update a dataset (async).

Args

  • id: (str) Unique identifier of a dataset
  • data_type: (str) Dataset type
  • params: (dict) Dataset parameters with tables and main_table

Returns

Dataset

Example

# For dynamodb
experiment = await client.update_dataset_async(
    id="my_dataset",
    data_type="dynamodb",
    params={"tables": ["first_table", "second_table", "third_table"], "main_table": "second_table"}
)

# For docdb
experiment = await client.update_dataset_async(
    id="my_dataset",
    data_type="docdb",
    params={"collections": "new_collections"}
)
def update_dataset_partial(self, id: str, data_type: str, params: Dict[str, Any] = None) ‑> Dataset

Partially update a dataset.

Args

  • id: (str) Unique identifier of a dataset
  • data_type: (optional) (str) Dataset type
  • params: (optional) (dict) Dataset parameters with tables and main_table

Returns

Dataset

Example

dataset = client.update_dataset_partial(
    id="my_dataset", params={"tables": ["first_table"], "main_table": "first_table"}
)
async def update_dataset_partial_async(self, id: str, data_type: str, params: Dict[str, Any] = None) ‑> Dataset

Partially update a dataset (async).

Args

  • id: (str) Unique identifier of a dataset
  • data_type: (optional) (str) Dataset type
  • params: (optional) (dict) Dataset parameters

Returns

Dataset

Example

dataset = await client.update_dataset_partial_async(
    id="my_dataset", params={"tables": ["first_table"], "main_table": "first_table"}
)