Dynamic Annotation Base Interface

dynamicannotationdb.interface module

class dynamicannotationdb.interface.DynamicAnnotationInterface(sql_uri: str)[source]

Bases: object

property cached_session
commit_session()[source]
create_annotation_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 new annotation table unless already exists

Parameters
  • aligned_volume (str) – name of aligned_volume to attach a new annotation table

  • table_name (str) – name of table

  • schema_type (str) –

    Type of schema to use, must be a valid type from EMAnnotationSchemas

    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’

create_or_select_database(aligned_volume: str, sql_uri: str)[source]

Create a new database with the name of the aligned volume. Checks if database exists before creating.

Parameters
  • aligned_volume (str) – name of aligned volume which the database name will inherent

  • sql_uri (str) – base path to the sql server

Returns

Return type

sql_url instance

create_segmentation_table(annotation_table_name: str, schema_type: str, pcg_table_name: str)[source]
Create new segmentation table linked to an annotation table

unless it already exists.

Parameters
  • annotation_table_name (str) – name of table annotation to link the segmentation table

  • schema_type (str) – Type of schema to use, must be a valid type from EMAnnotationSchemas

  • pcg_table_name (str) – name of chunkedgraph segmentation to use

Returns

description of table that is created

Return type

dict

get_annotation_model(table_name: str)[source]
get_annotation_table_size(table_name: str)int[source]

Get the number of annotations in a table

Parameters

table_name (str) – name of table contained within the aligned_volume database

Returns

number of annotations

Return type

int

get_existing_segmentation_table_names()[source]

Collects table_names keys of existing segmentation tables contained in an aligned volume database. Used for materialization.

Returns

List of segmentation table_names

Return type

list

get_max_id_value(table_name: str)int[source]
get_min_id_value(table_name: str)int[source]
get_segmentation_model(table_name: str, pcg_table_name: str)[source]
get_segmentation_table_metadata(table_name: str, pcg_table_name: str)[source]
get_table_metadata(table_name: str)[source]
get_table_schema(table_name: str)[source]
get_table_sql_metadata(table_name)[source]
get_valid_table_names()[source]
has_table(table_name: str)bool[source]

Check if a table exists

Parameters

table_name (str) – Table name in database

Returns

whether the table exists

Return type

bool