DbCassandraQuery

class lsst.analysis.ap.DbCassandraQuery(config_uri: str | ParseResult | ResourcePath | Path, *, instrument: Instrument | None = None)

Bases: DbQuery

Implementation of DbQuery interface for Cassandra backend.

Parameters:
config_uriResourcePathExpression

URI or local file path pointing to a file with serialized configuration, or a string with a “label:” prefix to locate configuration in APDB index.

instrumentstr

Short name (e.g. “DECam”) of instrument to make a dataId unpacker and to add to the table columns; supports any gen3 instrument. To be deprecated once this information is in the database.

Attributes Summary

timeout

Timeout for queries in seconds.

Methods Summary

load_forced_source(id)

Load one diaForcedSource.

load_forced_sources([limit])

Load all diaForcedSources.

load_forced_sources_for_object(dia_object_id)

Load diaForcedSources for a single diaObject.

load_object(id)

Load the most-recently updated version of one diaObject.

load_objects([limit, latest])

Load all diaObjects.

load_source(id)

Load one diaSource.

load_sources([exclude_flagged, limit])

Load diaSources.

load_sources_for_object(dia_object_id[, ...])

Load diaSources for a single diaObject.

set_excluded_diaSource_flags(flag_list)

Set flags of diaSources to exclude when loading diaSources.

Attributes Documentation

timeout = 600

Timeout for queries in seconds. Regular timeout specified in APDB configuration could be too short for for full-scan queries that this class executes.

Methods Documentation

load_forced_source(id: int) Series

Load one diaForcedSource.

Parameters:
idint

The diaForcedSourceId to load data for.

Returns:
datapandas.Series

The requested forced source.

load_forced_sources(limit: int = 100000) DataFrame

Load all diaForcedSources.

Parameters:
limitint

Maximum number of rows to return.

Returns:
datapandas.DataFrame

All available diaForcedSources.

load_forced_sources_for_object(dia_object_id: int, exclude_flagged: bool = False, limit: int = 100000) DataFrame

Load diaForcedSources for a single diaObject.

Parameters:
dia_object_idint

Id of object to load sources for.

exclude_flaggedbool, optional

Exclude sources that have selected flags set. Use set_excluded_diaSource_flags to configure which flags are excluded.

limitint

Maximum number of rows to return.

Returns:
datapandas.DataFrame

A data frame of diaSources for the specified diaObject.

load_object(id: int) Series

Load the most-recently updated version of one diaObject.

Parameters:
idint

The diaObjectId to load data for.

Returns:
datapandas.Series

The requested object.

load_objects(limit: int = 100000, latest: bool = True) DataFrame

Load all diaObjects.

Parameters:
limitint

Maximum number of rows to return.

latestbool

Only load diaObjects where validityEnd is None. These are the most-recently updated diaObjects.

Returns:
datapandas.DataFrame

All available diaObjects.

load_source(id: int) Series

Load one diaSource.

Parameters:
idint

The diaSourceId to load data for.

Returns:
datapandas.Series

The requested diaSource.

load_sources(exclude_flagged: bool = False, limit: int = 100000) DataFrame

Load diaSources.

Parameters:
exclude_flaggedbool, optional

Exclude sources that have selected flags set. Use set_excluded_diaSource_flags to configure which flags are excluded.

limitint

Maximum number of rows to return.

Returns:
datapandas.DataFrame

All available diaSources.

load_sources_for_object(dia_object_id: int, exclude_flagged: bool = False, limit: int = 100000) DataFrame

Load diaSources for a single diaObject.

Parameters:
dia_object_idint

Id of object to load sources for.

exclude_flaggedbool, optional

Exclude sources that have selected flags set. Use set_excluded_diaSource_flags to configure which flags are excluded.

limitint

Maximum number of rows to return.

Returns:
datapandas.DataFrame

A data frame of diaSources for the specified diaObject.

set_excluded_diaSource_flags(flag_list: list[str]) None

Set flags of diaSources to exclude when loading diaSources.

Any diaSources with configured flags are not returned when calling load_sources_for_object or load_sources with exclude_flagged = True.

Parameters:
flag_listlist [str]

Flag names to exclude.