OceanDB.data_access.base_query#

class OceanDB.data_access.base_query.BaseReadQuery(config=None)#

Bases: OceanDB

Base class for read-only query services.

Supports:

  • ad-hoc user-supplied queries + schemas via QuerySpec

  • output processed into arbitrary schemas

The core contract is:

  • SQL aliases == schema keys

Parameters:

config (Config | None)

execute_read_query(query_spec, *, fields, params, dataset_name='query_result', debug_sql=False)#

Execute a single query and return a Dataset, or None if empty.

Parameters:
  • query_spec (QuerySpec) – The specification for the query to be made

  • fields (Iterable[TypeVar(K, bound= str)]) – Set of fields to be extracted from the query

  • params (Mapping[str, Any]) – Set of parameters to be passed to the query

  • dataset_name (str) – Name to give to the resulting dataset (this is mostly used for output to NETCDF)

  • debug_sql (bool)

Return type:

Dataset[TypeVar(K, bound= str), Any] | None