Datasets

class sample_db.models.datasets.Datasets(**kwargs)

Datasets Model.

classmethod create_ds_table(table_name: str, version: str, **kwargs) Datasets

Create an sample table to store and retrieve a respective dataset instance.

Parameters:
  • name (table_name - Dataset) –

  • version. (version - Dataset) –

classmethod get_table_id(ds_table_name: str) str

Retrieve a Table OID from a sample dataset name.

Raises:

Exception when there is no sample table for ds name.

classmethod get_ds_table(ds_name: str, ds_version: str) Table | None

Retrieve the sample dataset table based in the given name and version.

Notes

It does not raise error when dataset does not exist.

Parameters:
  • ds_name – The Dataset name

  • ds_version – The Dataset version

Returns:

A SQLAlchemy table reference to dataset geometry table.

Return type:

Table

property ds_table: Table | None

Retrieve instance dataset table.

property insert_ds_table: None

Insert data into dataset table.

property make_view_dataset_data: Table

Create a view of an observation model using a table name.

__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

created_at
updated_at
query: t.ClassVar[Query]

A SQLAlchemy query for a model. Equivalent to db.session.query(Model). Can be customized per-model by overriding query_class.

Warning

The query interface is considered legacy in SQLAlchemy. Prefer using session.execute(select()) instead.

class sample_db.models.datasets.CollectMethod(**kwargs)

Collect Method Model.

__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

created_at
updated_at
query: t.ClassVar[Query]

A SQLAlchemy query for a model. Equivalent to db.session.query(Model). Can be customized per-model by overriding query_class.

Warning

The query interface is considered legacy in SQLAlchemy. Prefer using session.execute(select()) instead.