hapcat.models

Hapcat database models.

class hapcat.models.Event(**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 0x7f69b823b9b0; Event>
__mapper_args__ = {'polymorphic_identity': 'event'}
__module__ = 'hapcat.models'
__table__ = Table('event', MetaData(bind=None), Column('id', UUIDType(length=16), ForeignKey('uuidobject.id'), table=<event>, primary_key=True, nullable=False), Column('name', UnicodeText(), table=<event>, nullable=False), Column('rawlocation_id', UUIDType(length=16), ForeignKey('rawlocation.id'), table=<event>, nullable=False), schema=None)
__tablename__ = 'event'
_sa_class_manager = {'event_photos': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f69b8068258>, 'event_tags': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f69b80680a0>, 'id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f69b8236bf8>, 'name': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f69b8236af0>, 'rawlocation': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f69b82369e8>, 'rawlocation_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f69b8236ca8>, 'type': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f69b8236b48>}
id
name
photos

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

rawlocation
rawlocation_id
serialize()[source]
tags

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

type
class hapcat.models.EventPhoto(**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 0x7f69b824dbe0; EventPhoto>
__module__ = 'hapcat.models'
__table__ = Table('event_photo', MetaData(bind=None), Column('event_id', UUIDType(length=16), ForeignKey('event.id'), table=<event_photo>, primary_key=True, nullable=False), Column('photo_id', UUIDType(length=16), ForeignKey('photo.id'), table=<event_photo>, primary_key=True, nullable=False), schema=None)
__tablename__ = 'event_photo'
_sa_class_manager = {'event': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f69b8253620>, 'event_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f69b8253780>, 'photo': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f69b82536d0>, 'photo_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f69b8253830>}
event
event_id
photo
photo_id
class hapcat.models.EventTag(**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 0x7f69b823bfd0; EventTag>
__module__ = 'hapcat.models'
__table__ = Table('event_tag', MetaData(bind=None), Column('event_id', UUIDType(length=16), ForeignKey('event.id'), table=<event_tag>, primary_key=True, nullable=False), Column('tag_id', UUIDType(length=16), ForeignKey('tag.id'), table=<event_tag>, primary_key=True, nullable=False), schema=None)
__tablename__ = 'event_tag'
_sa_class_manager = {'event': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f69b8236eb8>, 'event_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f69b82530a0>, 'tag': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f69b8236f68>, 'tag_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f69b82530f8>}
event
event_id
tag
tag_id
class hapcat.models.Location(**kwargs)[source]

Bases: hapcat.models.RawLocation

__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 0x7f69b828aeb8; Location>
__mapper_args__ = {'polymorphic_identity': 'location'}
__module__ = 'hapcat.models'
__table__ = Table('location', MetaData(bind=None), Column('id', UUIDType(length=16), ForeignKey('rawlocation.id'), table=<location>, primary_key=True, nullable=False), Column('name', UnicodeText(), table=<location>, nullable=False), schema=None)
__tablename__ = 'location'
_sa_class_manager = {'address': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f69b8236308>, 'id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f69b82363b8>, 'location_photos': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f69b8167e08>, 'location_tags': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f69b80680f8>, 'name': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f69b82360f8>, 'type': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f69b8236258>}
address
id
location_photos
location_tags
name
photos

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

serialize()[source]
tags

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

type
class hapcat.models.LocationPhoto(**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 0x7f69b81e0208; LocationPhoto>
__module__ = 'hapcat.models'
__table__ = Table('location_photo', MetaData(bind=None), Column('location_id', UUIDType(length=16), ForeignKey('location.id'), table=<location_photo>, primary_key=True, nullable=False), Column('photo_id', UUIDType(length=16), ForeignKey('photo.id'), table=<location_photo>, primary_key=True, nullable=False), schema=None)
__tablename__ = 'location_photo'
_sa_class_manager = {'location': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f69b82539e8>, 'location_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f69b8253b48>, 'photo': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f69b8253a40>, 'photo_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f69b8253bf8>}
location
location_id
photo
photo_id
class hapcat.models.LocationTag(**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 0x7f69b823b278; LocationTag>
__module__ = 'hapcat.models'
__table__ = Table('location_tag', MetaData(bind=None), Column('location_id', UUIDType(length=16), ForeignKey('location.id'), table=<location_tag>, primary_key=True, nullable=False), Column('tag_id', UUIDType(length=16), ForeignKey('tag.id'), table=<location_tag>, primary_key=True, nullable=False), schema=None)
__tablename__ = 'location_tag'
_sa_class_manager = {'location': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f69b82365c8>, 'location_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f69b8236728>, 'tag': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f69b8236678>, 'tag_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f69b82367d8>}
location
location_id
tag
tag_id
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 0x7f69b824d5c0; 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 = {'event_photos': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f69b8068308>, 'id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f69b8253468>, 'location_photos': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f69b8167eb8>, 'photourl': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f69b8253258>, 'type': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f69b8253308>}
event_photos
events

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

id
location_photos
locations

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

photourl
type
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 0x7f69b828aa90; 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>), schema=None)
__tablename__ = 'rawlocation'
_sa_class_manager = {'address': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f69b827cf10>, 'id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f69b8236048>, 'type': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f69b827cf68>}
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 0x7f69b81e0d68; 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 0x7f69b81ed308>, 'payload': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f69b81ed410>}
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 0x7f69ba1d90b8; 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 0x7f69b827cd58>, 'name': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f69b827caf0>, 'type': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f69b827cba0>}
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 0x7f69b828a438; 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 0x7f69b827c830>, 'type': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f69b827c990>}
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 0x7f69b81e0898; 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 0x7f69b81ed150>, 'email': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f69b81ed0a0>, 'id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f69b8253fc0>, 'password': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f69b81ed200>, 'type': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f69b8253e08>, 'username': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7f69b8253db0>}
static checkpwstrength(password, username, email, minscore=3)[source]

Check the user’s password strength.

date_of_birth
email
id
password
type
username