ws.db.grabbers.user module¶
- class ws.db.grabbers.user.GrabberUsers(api, db)¶
Bases:
ws.db.grabbers.GrabberBase.GrabberBase
- INSERT_PREDELETE_TABLES = ['user_groups']¶
- gen_inserts_from_user(user)¶
- gen_deletes_from_user(user)¶
- gen_insert()¶
A generator for database entries which assumes that the tables are empty.
To be implemented in subclasses.
The yielded values are passed to
sqlalchemy.engine.Connection.execute()
, so the accepted formats for the values are:(stmt, entry)
tuple, wherestmt
is an object accepted by sqlalchemy’s execute method (e.g. plain string or an executable SQL statement construct) andentry
is a dict holding the bound parameter values to be used in the execution. The execution is deferred withws.db.execution.DeferrableExecutionQueue
to exploit the executemany execution strategy.Or it can yield
stmt
objects directly, if the executemany execution strategy is not applicable.
- gen_update(since)¶
A generator for database entries which assumes incremental updates.
To be implemented in subclasses.
If
ws.client.api.ShortRecentChangesError
is raised while executing this generator,update()
starts from scratch withinsert()
. The exception should be raised as soon as possible to save unnecessary work.The yielded values should follow the same rules as the
gen_insert()
method.