sol.models
-- SQLAlchemy modelization¶
The application's model objects
-
class
sol.models.
AbstractBase
¶ Abstract base entity class.
Return a possibly HTML-decorated caption of the entity.
- Parameters
html -- either
None
(the default) or a boolean valuelocalized -- a boolean value,
True
by default
- Return type
str
If html is
None
orTrue
then the result may be an HTML representation of the entity, otherwise it is plain text.If localized is
False
then the localization is turned off.
-
classmethod
check_insert
(session, fields, user_id)¶ Perform any check before an new instance is inserted.
- Parameters
session -- the SA session
fields -- a dictionary with the fields values
user_id -- either the string "admin" or the ID of the user performing the operation
-
check_update
(fields)¶ Perform any check before updating the instance.
- Parameters
fields -- a mapping containing
fieldname -> value
associations
This implementation does nothing, but subclasses can override it at will, either to adapt incoming values or to check their validity, raising an exception if something is wrong.
-
delete
()¶ Delete this instance from the database.
-
update
(data, missing_only=False)¶ Update entity with given data.
- Parameters
data -- a mapping kind of container
missing_only -- a boolean flag,
False
by default
- Return type
dict
- Returns
a mapping between field name and a tuple
(oldvalue, newvalue)
, for each modified field
First call
check_update()
to assert the validity of incoming data, then update the instance fields.If missing_only is
True
then only the fields that are currently empty (that is, their value is eitherNone
or an empty string) are updated. Note that in this case an exception is made forbool
fields: since in SoL they always have a value (i.e. they are never missing), they are always updated.
-
class
sol.models.
GloballyUnique
¶ Mixin class for globally unique identified entities.
-
guid
¶ A global unique identifier for this entity.
-
modified
= Column(None, DateTime(), table=None, nullable=False, server_default=DefaultClause(<sqlalchemy.sql.functions.now at 0x7ffff4336fa0; now>, for_update=False))¶ Last update timestamp.
-
sol.models.bio
-- Batched I/O- Entities
sol.models.boards
-- Boardssol.models.championship
-- Championshipssol.models.club
-- Clubssol.models.competitor
-- Competitorssol.models.match
-- Matchessol.models.mergedplayer
-- Merged playerssol.models.player
-- Playerssol.models.rate
-- Player ratessol.models.rating
-- Ratingssol.models.tourney
-- Tournamentssol.models.user
-- User
sol.models.utils
-- Utilities