Add EntryGroup#

Group#

The grouping of existing Entries can be done by the api.add_group endpoint. This function also takes a specification of the type of group. Additionally, there is a api.add_project function for the special case of adding a group of type 'Project'.

Note

'Composite' entries are best added by the model interface of one of the entries. Use the Entry.make_composite function for that.

metacatalog.api.add_group(session: Session, group_type: Union[int, str], entry_ids: List[int], title: str = None, description: str = None) EntryGroup#

Adds a new EntryGroup to the database. The Entry(s) have to exist in the database to be associated correctly. .. versionadded:: 0.2

Parameters:
  • session (sqlalchemy.Session) – SQLAlchemy session connected to the database.

  • group_type (int, str) – Either EntryGroupType id or name to be used.

  • entry_ids (list of int) – List of Entry.id to be associated tp this Group.

  • title (str) – Optional title of this Group. Mandatory, if the type is a ‘Project’

  • description (str) – Optional description of this Group. Mandatory is the type is a ‘Project’.

Returns:

entry – EntryGroup instance of the added group

Return type:

metacatalog.models.EntryGroup

Project#

metacatalog.api.add_project(session: Session, entry_ids: List[int], title: str = None, description: str = None) EntryGroup#

Adds a new Project EntryGroup to the database. The Entry(s) have to exist in the database to be associated correctly.

New in version 0.2.

Parameters:
  • session (sqlalchemy.Session) – SQLAlchemy session connected to the database.

  • entry_ids (list of int) – List of Entry.id to be associated tp this Project.

  • title (str) – Project title.

  • description (str) – Project description.

Returns:

entry – EntryGroup instance of the added group

Return type:

metacatalog.models.EntryGroup