io.db.model — Database Models

The io.db.model module describes the AutoCNet server databsae models.

New in version 0.1.0.

class autocnet.io.db.model.ArrayType(*args, **kwargs)[source]

Sqlite does not support arrays. Therefore, use a custom type decorator.

See http://docs.sqlalchemy.org/en/latest/core/types.html#sqlalchemy.types.TypeDecorator

copy()[source]

Produce a copy of this TypeDecorator instance.

This is a shallow copy and is provided to fulfill part of the TypeEngine contract. It usually does not need to be overridden unless the user-defined TypeDecorator has local state that should be deep-copied.

impl

alias of sqlalchemy.sql.sqltypes.String

process_bind_param(value, dialect)[source]

Receive a bound parameter value to be converted.

Subclasses override this method to return the value that should be passed along to the underlying TypeEngine object, and from there to the DBAPI execute() method.

The operation could be anything desired to perform custom behavior, such as transforming or serializing data. This could also be used as a hook for validating logic.

This operation should be designed with the reverse operation in mind, which would be the process_result_value method of this class.

Parameters
  • value – Data to operate upon, of any type expected by this method in the subclass. Can be None.

  • dialect – the Dialect in use.

process_result_value(value, dialect)[source]

Receive a result-row column value to be converted.

Subclasses should implement this method to operate on data fetched from the database.

Subclasses override this method to return the value that should be passed back to the application, given a value that is already processed by the underlying TypeEngine object, originally from the DBAPI cursor method fetchone() or similar.

The operation could be anything desired to perform custom behavior, such as transforming or serializing data. This could also be used as a hook for validating logic.

Parameters
  • value – Data to operate upon, of any type expected by this method in the subclass. Can be None.

  • dialect – the Dialect in use.

This operation should be designed to be reversible by the “process_bind_param” method of this class.

class autocnet.io.db.model.Cameras(**kwargs)[source]
class autocnet.io.db.model.CandidateGroundPoints(**kwargs)[source]
class autocnet.io.db.model.Costs(**kwargs)[source]
class autocnet.io.db.model.Edges(**kwargs)[source]
class autocnet.io.db.model.Images(**kwargs)[source]
classmethod union(session)[source]

The boundary formed by unioning (or merging) all of the input footprints. The result will likely be a multipolygon, likely with holes where data were not collected. :returns: A shapely MULTIPOLYGON object :rtype: obj

class autocnet.io.db.model.IntEnum(enumtype, *args, **kwargs)[source]

Mapper for enum type to sqlalchemy and back again

impl

alias of sqlalchemy.sql.sqltypes.Integer

process_bind_param(value, dialect)[source]

Receive a bound parameter value to be converted.

Subclasses override this method to return the value that should be passed along to the underlying TypeEngine object, and from there to the DBAPI execute() method.

The operation could be anything desired to perform custom behavior, such as transforming or serializing data. This could also be used as a hook for validating logic.

This operation should be designed with the reverse operation in mind, which would be the process_result_value method of this class.

Parameters
  • value – Data to operate upon, of any type expected by this method in the subclass. Can be None.

  • dialect – the Dialect in use.

process_result_value(value, dialect)[source]

Receive a result-row column value to be converted.

Subclasses should implement this method to operate on data fetched from the database.

Subclasses override this method to return the value that should be passed back to the application, given a value that is already processed by the underlying TypeEngine object, originally from the DBAPI cursor method fetchone() or similar.

The operation could be anything desired to perform custom behavior, such as transforming or serializing data. This could also be used as a hook for validating logic.

Parameters
  • value – Data to operate upon, of any type expected by this method in the subclass. Can be None.

  • dialect – the Dialect in use.

This operation should be designed to be reversible by the “process_bind_param” method of this class.

class autocnet.io.db.model.Json(*args, **kwargs)[source]

Sqlite does not have native JSON support. Therefore, use a custom type decorator.

See http://docs.sqlalchemy.org/en/latest/core/types.html#sqlalchemy.types.TypeDecorator

impl

alias of sqlalchemy.sql.sqltypes.String

process_bind_param(value, dialect)[source]

Receive a bound parameter value to be converted.

Subclasses override this method to return the value that should be passed along to the underlying TypeEngine object, and from there to the DBAPI execute() method.

The operation could be anything desired to perform custom behavior, such as transforming or serializing data. This could also be used as a hook for validating logic.

This operation should be designed with the reverse operation in mind, which would be the process_result_value method of this class.

Parameters
  • value – Data to operate upon, of any type expected by this method in the subclass. Can be None.

  • dialect – the Dialect in use.

process_literal_param(value, dialect)[source]

Receive a literal parameter value to be rendered inline within a statement.

This method is used when the compiler renders a literal value without using binds, typically within DDL such as in the “server default” of a column or an expression within a CHECK constraint.

The returned string will be rendered into the output string.

New in version 0.9.0.

process_result_value(value, dialect)[source]

Receive a result-row column value to be converted.

Subclasses should implement this method to operate on data fetched from the database.

Subclasses override this method to return the value that should be passed back to the application, given a value that is already processed by the underlying TypeEngine object, originally from the DBAPI cursor method fetchone() or similar.

The operation could be anything desired to perform custom behavior, such as transforming or serializing data. This could also be used as a hook for validating logic.

Parameters
  • value – Data to operate upon, of any type expected by this method in the subclass. Can be None.

  • dialect – the Dialect in use.

This operation should be designed to be reversible by the “process_bind_param” method of this class.

property python_type

Return the Python type object expected to be returned by instances of this type, if known.

Basically, for those types which enforce a return type, or are known across the board to do such for all common DBAPIs (like int for example), will return that type.

If a return type is not defined, raises NotImplementedError.

Note that any type also accommodates NULL in SQL which means you can also get back None from any type in practice.

class autocnet.io.db.model.Keypoints(**kwargs)[source]
class autocnet.io.db.model.Matches(**kwargs)[source]
class autocnet.io.db.model.MeasureType(value)[source]

Enum to enforce measure type for ISIS control networks

class autocnet.io.db.model.Measures(**kwargs)[source]
class autocnet.io.db.model.Overlay(**kwargs)[source]
classmethod overlapping_larger_than(size_threshold, Session)[source]

Query the Overlay table for an iterable of responses where the objects in the iterable have an area greater than a given size.

Parameters

size_threshold (Number) – area >= this arg are returned

class autocnet.io.db.model.PointType(value)[source]

Enum to enforce point type for ISIS control networks

class autocnet.io.db.model.Points(**kwargs)[source]