hapcat.models

Hapcat database models.

class hapcat.models.Event(**kwargs)[source]

Bases: hapcat.models.Votable

__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

__mapper__ = <Mapper at 0x7fe105cfbdd8; Event>
__mapper_args__ = {'polymorphic_identity': 'event'}
__module__ = 'hapcat.models'
__table__ = Table('event', MetaData(bind=None), Column('id', UUIDType(length=16), ForeignKey('votable.id'), table=<event>, primary_key=True, nullable=False), Column('rawlocation_id', UUIDType(length=16), ForeignKey('rawlocation.id'), table=<event>, nullable=False), schema=None)
__tablename__ = 'event'
_sa_class_manager = {'id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fe105d11048>, 'name': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fe105cf6f68>, 'rawlocation': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fe105cf6d58>, 'rawlocation_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fe105cf6e08>, 'type': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fe105cf6eb8>, 'votable_photos': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fe105c58a98>, 'votable_tags': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fe105c58e60>}
id
name
rawlocation
rawlocation_id
serialize()[source]
type
class hapcat.models.Location(**kwargs)[source]

Bases: hapcat.models.Votable

__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

__mapper__ = <Mapper at 0x7fe105cfb278; Location>
__mapper_args__ = {'polymorphic_identity': 'location'}
__module__ = 'hapcat.models'
__table__ = Table('location', MetaData(bind=None), Column('id', UUIDType(length=16), ForeignKey('votable.id'), table=<location>, primary_key=True, nullable=False), Column('rawlocation_id', UUIDType(length=16), ForeignKey('rawlocation.id'), table=<location>, nullable=False), schema=None)
__tablename__ = 'location'
_sa_class_manager = {'id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fe105cf6780>, 'name': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fe105cf66d0>, 'rawlocation': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fe105cf64c0>, 'rawlocation_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fe105cf6570>, 'type': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fe105cf6620>, 'votable_photos': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fe105c58a40>, 'votable_tags': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fe105c58e08>}
id
name
rawlocation
rawlocation_id
serialize()[source]
type
votable_photos
votable_tags
class hapcat.models.Photo(**kwargs)[source]

Bases: hapcat.models.UUIDObject

__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

__mapper__ = <Mapper at 0x7fe105d0c400; Photo>
__mapper_args__ = {'polymorphic_identity': 'photo'}
__module__ = 'hapcat.models'
__table__ = Table('photo', MetaData(bind=None), Column('id', UUIDType(length=16), ForeignKey('uuidobject.id'), table=<photo>, primary_key=True, nullable=False), Column('photourl', URLType(), table=<photo>, nullable=False), schema=None)
__tablename__ = 'photo'
_sa_class_manager = {'id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fe105d11360>, 'photourl': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fe105d110f8>, 'type': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fe105d112b0>, 'votable_photos': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fe105c58990>}
id
photourl
type
votable_photos
votables

A descriptor that presents a read/write view of an object attribute.

class hapcat.models.RawLocation(**kwargs)[source]

Bases: hapcat.models.UUIDObject

__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

__mapper__ = <Mapper at 0x7fe105d49940; RawLocation>
__mapper_args__ = {'polymorphic_identity': 'rawlocation'}
__module__ = 'hapcat.models'
__table__ = Table('rawlocation', MetaData(bind=None), Column('id', UUIDType(length=16), ForeignKey('uuidobject.id'), table=<rawlocation>, primary_key=True, nullable=False), Column('address', UnicodeText(), table=<rawlocation>, nullable=False), schema=None)
__tablename__ = 'rawlocation'
_sa_class_manager = {'address': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fe105d3deb8>, 'id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fe105cf6048>, 'type': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fe105d3df10>}
address
id
serialize()[source]
type
class hapcat.models.Secret(**kwargs)[source]

Bases: sqlalchemy.ext.declarative.api.Model

__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

__mapper__ = <Mapper at 0x7fe105ca05c0; Secret>
__module__ = 'hapcat.models'
__table__ = Table('secret', MetaData(bind=None), Column('id', Unicode(), table=<secret>, primary_key=True, nullable=False), Column('payload', LargeBinary(), table=<secret>, nullable=False), schema=None)
__tablename__ = 'secret'
_sa_class_manager = {'id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fe105d11db0>, 'payload': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fe105d11eb8>}
id
payload
class hapcat.models.Tag(**kwargs)[source]

Bases: hapcat.models.UUIDObject

__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

__mapper__ = <Mapper at 0x7fe107c960b8; Tag>
__mapper_args__ = {'polymorphic_identity': 'tag'}
__module__ = 'hapcat.models'
__table__ = Table('tag', MetaData(bind=None), Column('id', UUIDType(length=16), ForeignKey('uuidobject.id'), table=<tag>, primary_key=True, nullable=False), Column('name', UnicodeText(), table=<tag>, nullable=False), schema=None)
__tablename__ = 'tag'
_sa_class_manager = {'id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fe105d3dd00>, 'name': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fe105d3da98>, 'type': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fe105d3db48>}
id
name
serialize()[source]
type
class hapcat.models.UUIDObject(**kwargs)[source]

Bases: sqlalchemy.ext.declarative.api.Model

__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

__mapper__ = <Mapper at 0x7fe105d492e8; UUIDObject>
__mapper_args__ = {'polymorphic_identity': 'uuidobject', 'polymorphic_on': Column('type', String(length=32), table=<uuidobject>)}
__module__ = 'hapcat.models'
__table__ = Table('uuidobject', MetaData(bind=None), Column('id', UUIDType(length=16), table=<uuidobject>, primary_key=True, nullable=False), Column('type', String(length=32), table=<uuidobject>), schema=None)
__tablename__ = 'uuidobject'
_sa_class_manager = {'id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fe105d3d7d8>, 'type': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fe105d3d938>}
id
type
class hapcat.models.User(id, username, email, date_of_birth, password)[source]

Bases: hapcat.models.UUIDObject

__init__(id, username, email, date_of_birth, password)
__mapper__ = <Mapper at 0x7fe105ca00f0; User>
__mapper_args__ = {'polymorphic_identity': 'user'}
__module__ = 'hapcat.models'
__table__ = Table('user', MetaData(bind=None), Column('id', UUIDType(length=16), ForeignKey('uuidobject.id'), table=<user>, primary_key=True, nullable=False), Column('username', UnicodeText(), table=<user>, nullable=False), Column('email', EmailType(length=255), table=<user>, nullable=False), Column('date_of_birth', Date(), table=<user>, nullable=False), Column('password', PasswordType(length=4294967331), table=<user>, nullable=False), schema=None)
__tablename__ = 'user'
_sa_class_manager = {'date_of_birth': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fe105d11c50>, 'email': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fe105d11ba0>, 'id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fe105d11a98>, 'password': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fe105d113b8>, 'type': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fe105d119e8>, 'username': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fe105d11938>}
static checkpwstrength(password, username, email, minscore=3)[source]

Check the user’s password strength.

date_of_birth
email
id
password
type
username
class hapcat.models.Votable(**kwargs)[source]

Bases: hapcat.models.UUIDObject

__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

__mapper__ = <Mapper at 0x7fe105d49dd8; Votable>
__mapper_args__ = {'polymorphic_identity': 'votable'}
__module__ = 'hapcat.models'
__table__ = Table('votable', MetaData(bind=None), Column('id', UUIDType(length=16), ForeignKey('uuidobject.id'), table=<votable>, primary_key=True, nullable=False), Column('name', UnicodeText(), table=<votable>, nullable=False), schema=None)
__tablename__ = 'votable'
_sa_class_manager = {'id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fe105cf6308>, 'name': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fe105cf6200>, 'type': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fe105cf6258>, 'votable_photos': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fe105c588e0>, 'votable_tags': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fe105c58ca8>}
id
name
photos

A descriptor that presents a read/write view of an object attribute.

tags

A descriptor that presents a read/write view of an object attribute.

type
votable_photos
votable_tags
class hapcat.models.VotablePhoto(**kwargs)[source]

Bases: sqlalchemy.ext.declarative.api.Model

__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

__mapper__ = <Mapper at 0x7fe105d0c9e8; VotablePhoto>
__module__ = 'hapcat.models'
__table__ = Table('votable_photo', MetaData(bind=None), Column('votable_id', UUIDType(length=16), ForeignKey('votable.id'), table=<votable_photo>, primary_key=True, nullable=False), Column('photo_id', UUIDType(length=16), ForeignKey('photo.id'), table=<votable_photo>, primary_key=True, nullable=False), schema=None)
__tablename__ = 'votable_photo'
_sa_class_manager = {'photo': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fe105d11620>, 'photo_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fe105d11780>, 'votable': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fe105d11570>, 'votable_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fe105d116d0>}
photo
photo_id
votable
votable_id
class hapcat.models.VotableTag(**kwargs)[source]

Bases: sqlalchemy.ext.declarative.api.Model

__init__(**kwargs)

A simple constructor that allows initialization from kwargs.

Sets attributes on the constructed instance using the names and values in kwargs.

Only keys that are present as attributes of the instance’s class are allowed. These could be, for example, any mapped columns or relationships.

__mapper__ = <Mapper at 0x7fe105cfb860; VotableTag>
__module__ = 'hapcat.models'
__table__ = Table('votable_tag', MetaData(bind=None), Column('votable_id', UUIDType(length=16), ForeignKey('votable.id'), table=<votable_tag>, primary_key=True, nullable=False), Column('tag_id', UUIDType(length=16), ForeignKey('tag.id'), table=<votable_tag>, primary_key=True, nullable=False), schema=None)
__tablename__ = 'votable_tag'
_sa_class_manager = {'tag': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fe105cf6a40>, 'tag_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fe105cf6ba0>, 'votable': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fe105cf6990>, 'votable_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fe105cf6af0>}
tag
tag_id
votable
votable_id