Dynamic Annotation Client¶
dynamicannotationdb.annotation_client module¶
-
class
dynamicannotationdb.annotation_client.
DynamicAnnotationClient
(aligned_volume, sql_base_uri)[source]¶ Bases:
dynamicannotationdb.interface.DynamicAnnotationInterface
-
create_table
(table_name: str, schema_type: str, description: str, user_id: str, reference_table: Optional[str] = None, flat_segmentation_source: Optional[str] = None)[source]¶ Create a new annotation table
- Parameters
table_name (str) – name of new table
schema_type (str) – type of schema for that table
description (str) – a string with a human readable explanation of what is in the table. Including who made it and any information that helps interpret the fields of the annotations.
user_id (str) – user id for this table
reference_table (str) – reference table name, if required by this schema
flat_segmentation_source (str) –
- a path to a segmentation source associated with this table
i.e. ‘precomputed:\gs:\my_synapse_segexample1’
- Returns
description of table at creation time
- Return type
str
-
delete_annotation
(table_name: str, annotation_ids: List[int])[source]¶ Delete annotations by ids
- Parameters
table_name (str) – name of table to delete from
annotation_ids (List[int]) – list of ids to delete
-
delete_table
(table_name: str) → bool[source]¶ Marks a table for deletion, which will remove it from user visible calls and stop materialization from happening on this table only updates metadata to reflect deleted timestamp.
- Parameters
table_name (str) – name of table to mark for deletion
- Returns
whether table was successfully deleted
- Return type
bool
-
drop_table
(table_name: str) → bool[source]¶ Drop a table, actually removes it from the database along with segmentation tables associated with it
- Parameters
table_name (str) – name of table to drop
- Returns
whether drop was successful
- Return type
bool
-
get_annotations
(table_name: str, annotation_ids: List[int]) → List[dict][source]¶ Get a set of annotations by ID
- Parameters
table_name (str) – name of table
annotation_ids (List[int]) – list of annotation ids to get
- Returns
list of returned annotations
- Return type
List[dict]
-
insert_annotations
(table_name: str, annotations: List[dict])[source]¶ Insert some annotations.
- Parameters
table_name (str) – name of target table to insert annotations
annotations (list of dict) –
- a list of dicts with the annotations
that meet the schema
- Returns
True is successfully inserted annotations
- Return type
bool
- Raises
AnnotationInsertLimitExceeded – Exception raised when amount of annotations exceeds defined limit.
-
load_table
(table_name: str)[source]¶ Load a table
- Parameters
table_name (str) – name of table
- Returns
the sqlalchemy table of that name
- Return type
DeclarativeMeta
-
property
table
¶
-
update_annotation
(table_name: str, annotation: dict)[source]¶ Update an annotation
- Parameters
table_name (str) – name of targeted table to update annotations
annotation (dict) – new data for that annotation
- Returns
[description]
- Return type
[type]
- Raises
TODO – make this raise an exception rather than return strings:
-