get_or_create_project

Retrieve the specified dbnl Project or create a new one if it does not exist

dbnl.get_or_create_project(
    *,
    name: str,
    description: Optional[str] = None,
) -> :

Parameters

Arguments
Description

name

The name for the dbnl Project. A new Project will be created with this name if there does not exist a Project with this name already. If there does exist a project with this name, the pre-existing Project will be returned.

description

An optional description for the dbnl Project, defaults to None. Description is limited to 255 characters.

Returns

Type
Description

A new Project will be created with the specified name if there does not exist a Project with this name already. If there does exist a project with the name, the pre-existing Project will be returned.

Examples

import dbnl
dbnl.login()


proj_1 = dbnl.create_project(name="test_p1")
proj_2 = dbnl.get_or_create_project(name="test_p1")

# Calling get_or_create_project will yield same Project object
assert proj_1.id == proj_2.id

Was this helpful?