dug_seis.db.db module#

Base DB interface.

Just a thin wrapper around the underlying implementations.

class dug_seis.db.db.DB(url: str)#

Bases: object

add_object(obj: Any, parent_object_id: Optional[int] = None)#
count(object_type: str) int#

Return the count of objects of a certain type in the database.

Parameters:

object_type – The type of object to count.

delete_objects(objects=typing.List[typing.Any])#

Delete the passed objects from the database.

dump_as_quakeml_files(folder: Path)#
get_event_by_resource_id(resource_id: Union[str, ResourceIdentifier]) Event#

Helper method retrieving and event by resource id.

Parameters:

resource_id – The resource id to query.

get_event_summary() List[Dict[str, Any]]#

Get a short summary of all events, sorted by earliest origin.

The returned latitude/longitude/depth belong to the earliest origin of each event.

get_objects(object_type: str, where: Optional[Dict[str, Any]] = None)#
get_unassociated_picks() Pick#

Get all picks currently not associated with any event.

update_event(event: Event)#

Updates an event. The event in the database will be identified via its resources id. All dependent objects will be deleted and fresh new event will be added to the database.

update_event_comments(event: Event)#

Specialized update command that only updates an event’s comments.

Mainly useful for the GUI or other mass comment changes.

Parameters:

event – The event whose comments should be updated. Will use the its resource id, delete all old comments and add the new comments.