ovo.core.database.base_db¶
Module Contents¶
Classes¶
Data¶
API¶
- ovo.core.database.base_db.T¶
‘TypeVar(…)’
- class ovo.core.database.base_db.DBEngine¶
Bases:
abc.ABC- init()¶
- abstractmethod save(obj: ovo.core.database.models.Base)¶
- abstractmethod save_all(objs: Sequence[ovo.core.database.models.Base])¶
- abstractmethod remove(model: Type[ovo.core.database.base_db.T], *id_args, **kwargs)¶
- abstractmethod save_value(model: Type[ovo.core.database.base_db.T], column: str, value, *id_args, **kwargs)¶
- abstractmethod count(model: Type[ovo.core.database.base_db.T], field='id', **kwargs) Sequence[ovo.core.database.base_db.T]¶
- abstractmethod count_distinct(model: Type[ovo.core.database.base_db.T], field='id', group_by=None, **kwargs) int¶
- abstractmethod select(model: Type[ovo.core.database.base_db.T], limit: int = None, order_by=None, **kwargs) Sequence[ovo.core.database.base_db.T]¶
- abstractmethod get(model: Type[ovo.core.database.base_db.T], *id_args, **kwargs) ovo.core.database.base_db.T¶
- abstractmethod get_value(model: Type[ovo.core.database.base_db.T], column: str, *id_args, raw=False, **kwargs)¶
- abstractmethod select_values(model: Type[ovo.core.database.base_db.T], column: str, order_by=None, **kwargs) list¶
- abstractmethod select_dict(model: Type[ovo.core.database.base_db.T], key_column: str, value_column: str, order_by=None, **kwargs) dict¶
- abstractmethod select_unique_values(model: Type[ovo.core.database.base_db.T], column: str, **kwargs) set¶
- abstractmethod select_descriptor_values(descriptor_key: str, design_ids: list[str], descriptor_job_id: str | None = None) pandas.Series¶
- abstractmethod select_wide_descriptor_table(design_ids: list[str], descriptor_keys: list[str], **kwargs) pandas.DataFrame¶
- __getattr__(name: str) ovo.core.database.db_proxy.DBProxy¶
Enable accessing models as attributes of the DBEngine instance.
For example instead of db.select(Design) you can do db.Design.select().
- abstractmethod add_label(label: str, design_ids: list[str], username: str, explanation: str | None = None)¶
Add a label to multiple designs.
Args: label: The label to add design_ids: List of design IDs to add the label to username: The username of the person adding the label explanation: Optional explanation for adding the label (for audit/logging purposes)
- abstractmethod remove_label(label: str, design_ids: list[str], **kwargs)¶
Remove a label from multiple designs.
Args: label: The label to remove design_ids: List of design IDs to remove the label from
- abstractmethod remove_designs_labeling(labeling_id: int, design_ids: list[str])¶
Remove a specific design labeling by its ID.
Args: labeling_id: The ID of the design labeling to remove design_ids: List of design IDs to remove the labeling from
- abstractmethod get_designs_with_all_labels(label_names: list[str], design_ids: list[str] = None) list[str]¶
Get design IDs that have ALL of the specified labels.
Args: label_names: List of label names that designs must have (ALL of them) design_ids: Optional list of design_ids to filter within (if None, searches all designs)
Returns: List of design_ids that have all the specified labels
- abstractmethod get_designs_with_any_labels(label_names: list[str], design_ids: list[str] = None) list[str]¶
Get design IDs that have ANY of the specified labels.
Args: label_names: List of label names that designs can have (ANY of them) design_ids: Optional list of design_ids to filter within (if None, searches all designs)
Returns: List of design_ids that have at least one of the specified labels
- abstractmethod get_labelings_for_design(design_id: str) list[ovo.core.database.models.Labeling]¶
Get all labelings for a specific design using a single optimized query.
- abstractmethod get_available_labels_for_design_ids(design_ids: list[str]) list[str]¶
Get unique labels available for the given design IDs.
- abstractmethod get_available_labels_for_pool_ids(pool_ids: list[str], **design_filters) list[str]¶
Get unique labels available for designs in the given pool IDs.
Args: pool_ids: List of pool IDs to get labels for **design_filters: Additional filters to apply to Design model (e.g., accepted=True)
Returns: Sorted list of unique label strings available for designs in the specified pools