Diffreader

class wrgl.diffreader.RowIterator(repo, tbl_sum, columns, primary_key, fetch_size=100)

Iterates over rows with specified offsets of a table.

Each row is returned as a list of strings.

Variables
  • columns (list[str]) – column names

  • primary_key (list[str]) – primary key

Parameters
  • repo (Repository) – the repo handle

  • tbl_sum (str) – checksum of the table the rows belong to

  • columns (list[str]) – column names

  • primary_key (list[str]) – primary key

  • fetch_size (int) – number of rows to fetch for each batch

add_offset(offset)

Add a single row offset

Parameters

offset (int) – row offset

class wrgl.diffreader.ModifiedRowIterator(repo, tbl_sum1, tbl_sum2, cd, columns, primary_key, fetch_size=100)

Iterates over row pairs with specifies offsets from a pair of tables

Each row is returned as a list of tuple of two values: (newer_value, older_value). If either cell is missing (because the column is missing in one of the tables) then one of the values is None.

Variables
  • columns (list[str]) – column names

  • primary_key (list[str]) – primary key

Parameters
  • repo (Repository) – the repo handle

  • tbl_sum1 (str) – checksum of the newer table

  • tbl_sum2 (str) – checksum of the older table

  • cd (ColDiff) – column differences

  • columns (list[str]) – column names

  • primary_key (list[str]) – primary key

  • fetch_size (int) – number of rows to fetch for each batch

add_offset(offset1, offset2)

Add a single row offset

Parameters
  • offset1 (int) – row offset for the newer table

  • offset2 (int) – row offset for the older table

class wrgl.diffreader.ColumnChanges(new_values, old_values, unchanged, added, removed)

Represents changes in column names.

Variables
  • new_values (list[str]) – new columns

  • old_values (list[str]) – old columns

  • unchanged (set[str]) – columns that are present in both versions

  • added (set[str]) – columns that appear in newer version but not in older version

  • removed (set[str]) – columns that appear in older version but not in newer version

Method generated by attrs for class ColumnChanges.

classmethod from_new_old_columns(new_cols, old_cols)

Creates a new instance by comparing two column lists

Parameters
  • new_cols (list[str]) – newer columns

  • old_cols (list[str]) – older columns

Return type

ColumnChanges

class wrgl.diffreader.DiffReader(repo, com_sum1, com_sum2, fetch_size=100)

Interprets the changes between two commits.

Variables
Parameters
  • repo (Repository) – the repo handle

  • com_sum1 (str) – checksum of the first (newer) commit

  • com_sum2 (str) – checksum of the second (older) commit