datanommer.models package¶
- class datanommer.models.Message(**kwargs)[source]¶
Bases:
Base- agent_name¶
- category¶
- certificate¶
- crypto¶
- get_category(key, topic)[source]¶
Update the category when the topic is set.
The method seems… unnatural. But even zzzeek says it’s OK to do it: https://stackoverflow.com/a/6442201
- classmethod get_first(*, order='asc', **kwargs)[source]¶
Get the first message matching the regular grep filters.
- classmethod grep(*, page=1, rows_per_page=100, order='asc', defer=False, **kwargs)[source]¶
Flexible query interface for messages.
Arguments are filters. start and end should be
datetimeobjs.Other filters should be lists of strings. They are applied in a conjunctive-normal-form (CNF) kind of way
for example, the following:
users = ['ralph', 'lmacken'] categories = ['bodhi', 'wiki']
should return messages where
(user==’ralph’ OR user==’lmacken’) AND (category==’bodhi’ OR category==’wiki’)
Furthermore, you can use a negative version of each argument.
users = [‘ralph’] not_categories = [‘bodhi’, ‘wiki’]
should return messages where
(user == ‘ralph’) AND NOT (category == ‘bodhi’ OR category == ‘wiki’)
If the defer argument evaluates to True, the query won’t actually be executed, but a SQLAlchemy query object returned instead.
- headers¶
- i¶
- id¶
- classmethod make_query(start=None, end=None, msg_id=None, users=None, not_users=None, packages=None, not_packages=None, categories=None, not_categories=None, topics=None, not_topics=None, agents=None, not_agents=None, contains=None)[source]¶
Flexible query interface for messages.
Arguments are filters. start and end should be
datetimeobjs.Other filters should be lists of strings. They are applied in a conjunctive-normal-form (CNF) kind of way
for example, the following:
users = ['ralph', 'lmacken'] categories = ['bodhi', 'wiki']
should return messages where
(user==’ralph’ OR user==’lmacken’) AND (category==’bodhi’ OR category==’wiki’)
Furthermore, you can use a negative version of each argument.
users = [‘ralph’] not_categories = [‘bodhi’, ‘wiki’]
should return messages where
(user == ‘ralph’) AND NOT (category == ‘bodhi’ OR category == ‘wiki’)
- msg¶
- msg_id¶
- packages¶
- signature¶
- source_name¶
- source_version¶
- timestamp¶
- topic¶
- property username¶
- users¶
- class datanommer.models.NamedSingleton[source]¶
Bases:
object- classmethod get_or_create(name)[source]¶
Return the instance of the class with the specified name. If it doesn’t already exist, create it.
- id = Column(None, Integer(), table=None, primary_key=True, nullable=False)¶
- name = Column(None, UnicodeText(), table=None)¶
- datanommer.models.add(message)[source]¶
Take a the fedora-messaging Message and store in the message table.
- datanommer.models.init(uri=None, alembic_ini=None, engine=None, create=False)[source]¶
Initialize a connection. Create tables if requested.