web_monitoring.db.Client.add_versions

Client.add_versions(versions, *, update='skip', create_pages=None, skip_unchanged_versions=None, batch_size=1000)[source]

Submit versions in bulk for importing into web-monitoring-db.

Chunk the versions into batches of at most the given size.

Parameters
versionsiterable

Iterable of dicts from format_version()

update{‘skip’, ‘replace’, ‘merge’}, optional

Specifies how versions that are already in the database (i.e. versions with the same capture_time and source_type) should be handled:

  • 'skip' (default) – Don’t import the version or modify the existing database entry.

  • 'replace' – Replace the existing database entry with the imported one

  • 'merge' – Similar to replace, but merges the values in source_metadata

create_pagesbool, optional

If True, create new pages for any URLs in the import set that don’t already exist.

skip_unchanged_versionsbool, optional

If true, don’t import versions of a page that have the same hash as the version captured immediately before them.

batch_sizeinteger, optional

Default batch size is 1000 Versions.

Returns
import_idstuple