simplelogincmd.database.models.Contact¶
- class Contact(**kwargs)¶
Bases:
LenientInit,ObjectAn alias contact
Methods
Retrieve the value of the given field
Retrieve a string representation of the field
Restrict a query based on a generic identifier
Retrieve a list of model objects based on a generic identifier
Attributes
block_forwardcontactcreation_timestampidlast_email_sent_timestampRefers to the
_schema.MetaDatacollection that will be used for new_schema.Tableobjects.nameRefers to the
_orm.registryin use where new_orm.Mapperobjects will be associated.reverse_aliasreverse_alias_address- get(field: str) str | None¶
Retrieve the value of the given field
- Parameters:
field (str) – The name of the field to get
- Returns:
The field’s value, or None if the field is undefined
- Return type:
str | None
- get_string(field: str) str¶
Retrieve a string representation of the field
- Parameters:
field (str) – The name of the field to get
- Returns:
String representation of the field’s value
if value is string, then return value
if value is None, then “”
if value is bool, then “Y” or “N”
if value is iterable, then each element as a string, separated by commas
otherwise return str(value)
- Return type:
str
- classmethod identifier_query(query: Select, id: Any) Select¶
Restrict a query based on a generic identifier
In the event that id is not a numeric primary key id, model classes can decide for themselves, by overriding this method, how to find the objects to which id refers. Overriding implementations should restrict query, as via a call to
sqlalchemy.Select.where()or similar, to a condition that identifies one (ideally) or more objects. For example, a Mailbox model might allow to search through email addresses, while an Alias model might search emails and alias notes for a match.- Parameters:
query (
sqlalchemy.Select) – The query to be conditionedid (Any) – The identifier which is supposed to identify ideally one, but potentialy many or no model objects
- Returns:
The modified query
- Return type:
sqlalchemy.Select
- metadata: ClassVar[MetaData] = MetaData()¶
Refers to the
_schema.MetaDatacollection that will be used for new_schema.Tableobjects.See also
- registry: ClassVar[_RegistryType] = <sqlalchemy.orm.decl_api.registry object>¶
Refers to the
_orm.registryin use where new_orm.Mapperobjects will be associated.
- classmethod resolve_identifier(session: Session, id: Any) list[Object]¶
Retrieve a list of model objects based on a generic identifier
Attempt to produce a single model object by passing id directly on to
sqlalchemy.orm.Session.get_one(). If that fails, then fall back toidentifier_query(), which subclasses can override in order to determine how that particular model should interpret the identifier.- Parameters:
session (
sqlalchemy.orm.Session) – The database session which is to search for object(s)id (Any) – The identifier for which to search. This might be as simple as a primary key numeric id, or it could be a string which (ideally uniquely) identifies a particular model object.
- Returns:
A list of zero or more matching model objects
- Return type:
list[Object]