Skip to content

Get or create function #50

Closed
Closed
@carbonarok

Description

@carbonarok

Environment

  • DiffSync version: 1.1.0

Ability to either get or create an object like the Django ORM

Function that takes the identifiers of an object and either gets or create an object.
Current work around is wrap an object get in an exception of ObjectNotFound.

Use Case

Currently using try and except to catch if an object already exists.

            try:
                self.add(vrf)
            except ObjectAlreadyExists:
                pass

Expected use

self.get_or_create(vrf)
self.update_or_create(vrf)

Metadata

Metadata

Labels

status: acceptedThis issue has been accepted by the maintainers team for implementationstatus: help wantedThis issue is tentatively accepted pending a volunteer committed to its implementation

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions