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 0x7fc6774f5438; 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 0x7fc6774fd048>, 'name': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fc6774e6f10>, 'rawlocation': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fc6774e6d00>, 'rawlocation_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fc6774e6db0>, 'type': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fc6774e6e60>, 'votable_photos': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fc6773abe60>, 'votable_tags': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fc6773abb48>}¶
-
id¶
-
name¶
-
rawlocation¶
-
rawlocation_id¶
-
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 0x7fc6774e0898; 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 0x7fc6774e6728>, 'name': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fc6774e6678>, 'rawlocation': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fc6774e6468>, 'rawlocation_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fc6774e6518>, 'type': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fc6774e65c8>, 'votable_photos': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fc6773abdb0>, 'votable_tags': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fc6773abaf0>}¶
-
id¶
-
name¶
-
rawlocation¶
-
rawlocation_id¶
-
type¶
-
votable_photos¶
-
-
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 0x7fc6774f5a20; 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 0x7fc6774fd308>, 'photourl': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fc6774fd1a8>, 'type': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fc6774fd258>, 'votable_photos': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fc6773abd00>}¶
-
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 0x7fc677532f60; 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 0x7fc677527e60>, 'id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fc677527f68>, 'type': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fc677527eb8>}¶
-
address¶
-
id¶
-
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 0x7fc677496278; 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 0x7fc6774992b0>, 'payload': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fc6774993b8>}¶
-
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 0x7fc67947bf98; 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 0x7fc677527ca8>, 'name': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fc677527a40>, 'type': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fc677527af0>}¶
-
id¶
-
name¶
-
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 0x7fc677532908; 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 0x7fc677527780>, 'type': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fc6775278e0>}¶
-
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 0x7fc677508748; 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 0x7fc6774fdbf8>, 'email': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fc6774fdb48>, 'id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fc6774fda40>, 'password': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fc6774fdca8>, 'type': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fc6774fd990>, 'user_votes': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fc6773ab360>, 'username': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fc6774fd8e0>}¶
-
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 0x7fc6774e0438; 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 0x7fc6774e62b0>, 'name': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fc6774e61a8>, 'type': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fc6774e6200>, 'votable_photos': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fc6773abbf8>, 'votable_tags': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fc6773ab938>}¶
-
id¶
-
name¶
-
photos¶ A descriptor that presents a read/write view of an object attribute.
A descriptor that presents a read/write view of an object attribute.
-
type¶
-
votable_photos¶
-
-
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 0x7fc6774f5fd0; 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 0x7fc6774fd5c8>, 'photo_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fc6774fd728>, 'votable': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fc6774fd518>, 'votable_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fc6774fd678>}¶
-
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 0x7fc6774e0e80; 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 0x7fc6774e69e8>, 'tag_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fc6774e6b48>, 'votable': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fc6774e6938>, 'votable_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fc6774e6a98>}¶
-
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 0x7fc677508e10; 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 0x7fc6774991a8>, 'user': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fc6774fdf10>, 'user_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fc6774990a0>, 'votable': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fc6774fde60>, 'votable_id': <sqlalchemy.orm.attributes.InstrumentedAttribute object at 0x7fc677499048>}¶
-
numvotes¶
-
user¶
-
user_id¶
-
votable¶
-
votable_id¶
-