Skip to content

Module stac_fastapi.core.queryables

A module for managing queryable attributes.

Variables

DEFAULT_QUERYABLES
logger

Functions

get_properties_from_cql2_filter

def get_properties_from_cql2_filter(
    cql2_filter: dict[str, typing.Any]
) -> set[str]

Recursively extract property names from a CQL2 filter.

Property names are normalized by stripping the 'properties.' and 'assets.' prefix if present, to match queryables stored without the prefix.

merge_queryables

def merge_queryables(
    collection_queryables: list[dict]
) -> dict

Merge a list of queryable schemas into a single queryable schema.

Parameters:

Name Type Description Default
collection_queryables None A list of dicts, each representing a collection's queryables schema. None

Returns:

Type Description
None A dict representing the merged queryables schema containing baseline STAC properties
and all properties from the given schemas. If conflicts occur (same property, different types),
the first encountered property definition is kept and a warning is logged.

Classes

QueryablesCache

class QueryablesCache(
    database_logic: Any
)

A thread-safe, time-based cache for queryable properties.

Methods

get_all_queryables

def get_all_queryables(
    self
) -> set[str]

Return a set of all queryable attributes across all collections.

This method will update the cache if it's stale or has been cleared.

reload_settings

def reload_settings(
    self
)

Reload settings from environment variables.

validate

def validate(
    self,
    fields: set[str]
) -> None

Validate if the provided fields are queryable.

Raises HTTPException if invalid fields are found.