Subsets

Subset behavior has changed in this release.

  • If your code does not use the Table.subsets property and the default subset in your tables contain all records, you should see no behavior changes. This is the most common scenario.
  • If your code sets the Table.subsets property to the default subset, then you should disable this assignment from your code, since it now occurs automatically.
  • If your code sets the Table.subsets property to a non-default subset, then you should clear the Table.subsets property with table_object.subsets.clear() before setting the non-default subset.
  • If your code sets the Table.subsets property to a set containing more than one subset and you perform any subsequent record fetching or search operations, these operations will raise a ValueError. They would previously not consider all applied subsets, and so would return incorrect results.

Detailed description of changes

The Table.subsets property defines the applied subset or subsets for a particular table. I In previous releases, if the subsets argument was not provided to the Database.get_table and Database.get_table_by_guid methods, they returned a Table object with an empty subsets property, which meant that there was no active subset for that table. In this release, calling those methods with an empty subsets argument now returns a Table object with the default subset for that table activated. This causes the following changes in default behavior:
  • Records are now added to the default subset automatically on import.
  • All record fetching operations, table-specific searches and database criteria searches will only consider records in the default subset (see Searching and browsing for records for more details).
A new property default_subset has been added to the Table class, which always contains the default subset as defined in the schema. This can be used to reactivate the default subset with the code:
table.subsets.clear()
table.subsets.add(table.default_subset)

Adding additional subsets to the Table.subsets property is allowed, but a Table in this state can only be used for creating new records. Any attempt to perform a retrieval of records, for example by searching or calling Table.all_records(), will result in a ValueError.

The method Exporter.run_exporter previously performed some record filtering in rare situations. The behavior has been simplified and now subset filtering is never performed.

Unchanged operations

The subset filtering of LinkFetcher.fetch_linked_records() is unchanged, and optionally filters the results to include only records that are in the default subset of the target table. This is controlled with the optional filter_subsets argument.

The following record fetching and data export operations are unchanged and do not perform any subset filtering:

  • Table.bulk_fetch() and Record on-demand attribute value fetching
  • Record on-demand link fetching
  • Record.find_parent() and Record.refresh_path() record fetching

Reverting to the previous behavior

The previous behavior can be retrieved by supplying subsets={} as an additional argument to Database.get_table(), or by calling clear() on the Table.subsets property before interacting with the Table object.