sol.models -- SQLAlchemy modelization¶
The application's model objects
- class sol.models.Base(**kwargs: Any)¶
Abstract base entity class.
- classmethod check_insert(session: Session, fields: dict[str, Any], user_id: str | int) None¶
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
- caption(html=None, localized=True)¶
Return a possibly HTML-decorated caption of the entity.
- Parameters:
html -- either
None(the default) or a boolean valuelocalized -- a boolean value,
Trueby default
- Return type:
str
If html is
NoneorTruethen the result may be an HTML representation of the entity, otherwise it is plain text.If localized is
Falsethen the localization is turned off.
- check_update(fields: dict[str, Any], user_id: str | int) None¶
Perform any check before updating the instance.
- Parameters:
fields -- a mapping containing
fieldname -> valueassociationsuser_id -- either the string "admin" or the ID of the user performing the operation
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() None¶
Delete this instance from the database.
- update(data: dict[str, Any], user_id: str | int, *, missing_only=False) dict[str, tuple[Any, Any]]¶
Update entity with given data.
- Parameters:
data -- a mapping kind of container
missing_only -- a boolean flag,
Falseby defaultuser_id -- either the string "admin" or the ID of the user performing the operation
- 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
Truethen only the fields that are currently empty (that is, their value is eitherNoneor an empty string) are updated. Note that in this case an exception is made forboolfields: since in SoL they always have a value (i.e. they are never missing), they are always updated.
- property description¶
Simple text description of the entity, basically an alias to
caption().
- class sol.models.GloballyUnique¶
Mixin class for globally unique identified entities.
- guid¶
A global unique identifier for this entity.
- modified: Mapped[datetime] = <sqlalchemy.orm.properties.MappedColumn object>¶
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