ws.db.grabbers.revision module

class ws.db.grabbers.revision.GrabberRevisions(api, db, *, with_content=False)

Bases: ws.db.grabbers.GrabberBase.GrabberBase

gen_text(rev, text_id)
gen_revisions(page)
gen_deletedrevisions(page)
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, where stmt is an object accepted by sqlalchemy’s execute method (e.g. plain string or an executable SQL statement construct) and entry is a dict holding the bound parameter values to be used in the execution. The execution is deferred with ws.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 with insert(). 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.

sync_revisions_content(*, mode='latest')