datajoint-python icon indicating copy to clipboard operation
datajoint-python copied to clipboard

Applying Restrictions to a Diagram

Open dimitri-yatsenko opened this issue 4 years ago • 1 comments

Feature Request

Problem

DataJoint needs an effective way of specifying a subset of the data from the database for export, deletion, publishing, backups, synchronization, and sharing.

dj.Diagram objects already provide powerful ways of specifying a specific subset of tables through their set operators: union, difference, intersection, etc. Adding the ability to restrict the data in the tables of a diagram would complete the functionality necessary for specifying a cross-section of the data in the database.

Requirements

  1. dj.Diagram must provide a way to apply a restriction to any of its tables.
  2. Restrictions must propagate down through dependencies and up from part to master when necessary.
  3. If a restriction causes a table to become empty, the table is excluded from the diagram.

Justification

Specifying a subset of the data in the database across multiple tables and schemas is a basic functionality that would allow many other operations. Deletions and backups are prime examples.

Alternative Considerations

The cascading delete feature already allows deleting a cross-section of the data based on a restricted table.

Related Issues

#864 - backup and restore #560 - export #151 - cascading deletes

dimitri-yatsenko avatar Jan 26 '21 14:01 dimitri-yatsenko

From separate Slack discussions, a possible syntax was presented as: section = dj.Diagram(schema) & (Session & 'subject=1')

guzman-raphael avatar Jan 28 '21 18:01 guzman-raphael