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 0x7f5adcfafe48; 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 0x7f5adcfb0e08>, 'name': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f5adcfb0ca8>, 'rawlocation': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f5adcfb0a98>, 'rawlocation_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f5adcfb0b48>, 'type': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f5adcfb0bf8>, 'votable_photos': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f5adce49af0>, 'votable_tags': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f5adce49f68>}
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 0x7f5adcfaf320; 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 0x7f5adcfb0570>, 'name': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f5adcfb0410>, 'rawlocation': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f5adcfb0258>, 'rawlocation_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f5adcfb02b0>, 'type': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f5adcfb0360>, 'votable_photos': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f5adce49a98>, 'votable_tags': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f5adce49f10>}
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 0x7f5adcfc3470; 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 0x7f5adcfcd150>, 'photourl': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f5adcfb0e60>, 'type': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f5adcfcd048>, 'votable_photos': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f5adce49990>}
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 0x7f5add0009e8; 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 0x7f5adcffcbf8>, 'id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f5adcffcdb0>, 'type': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f5adcffcc50>}
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 0x7f5adcf57c88; 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 0x7f5adcf67048>, 'payload': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f5adcf67150>}
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 0x7f5adef43d30; 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 0x7f5adcffca98>, 'name': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f5adcffc938>, 'type': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f5adcffc8e0>}
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 0x7f5add000390; 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 0x7f5adcffc570>, 'type': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f5adcffc6d0>}
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 0x7f5adcf57198; 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 0x7f5adcfcd9e8>, 'email': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f5adcfcd938>, 'id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f5adcfcd888>, 'password': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f5adcfcda98>, 'type': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f5adcfcd728>, 'user_votes': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f5adce49bf8>, 'username': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f5adcfcd678>}
static checkpwstrength(password, username, email, minscore=3)[source]

Check the user’s password strength.

date_of_birth
email
id
password
type
user_votes
username
votes

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

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 0x7f5add000e80; 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 0x7f5adcfb00f8>, 'name': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f5adcffcf10>, 'type': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f5adcffcf68>, 'votable_photos': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f5adce49938>, 'votable_tags': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f5adce49d58>}
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 0x7f5adcfc3a58; 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 0x7f5adcfcd360>, 'photo_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f5adcfcd4c0>, 'votable': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f5adcfcd308>, 'votable_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f5adcfcd410>}
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 0x7f5adcfaf908; 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 0x7f5adcfb0780>, 'tag_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f5adcfb08e0>, 'votable': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f5adcfb06d0>, 'votable_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f5adcfb0830>}
tag
tag_id
votable
votable_id
class hapcat.models.Vote(**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 0x7f5adcf57860; Vote>
__module__ = 'hapcat.models'
__table__ = Table('vote', MetaData(bind=None), Column('votable_id', UUIDType(length=16), ForeignKey('votable.id'), table=<vote>, primary_key=True, nullable=False), Column('user_id', UUIDType(length=16), ForeignKey('user.id'), table=<vote>, primary_key=True, nullable=False), Column('numvotes', Integer(), table=<vote>, nullable=False, default=ColumnDefault(0)), schema=None)
__tablename__ = 'vote'
_sa_class_manager = {'numvotes': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f5adcfcdf10>, 'user': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f5adcfcdca8>, 'user_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f5adcfcde08>, 'votable': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f5adcfcdbf8>, 'votable_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f5adcfcdd58>}
numvotes
user
user_id
votable
votable_id