export_project_as_json

Export a dbnl Project alongside its Test Specs and Tags as a JSON object

dbnl.export_project_as_json(
    *,
    project: ,
) -> dict[str, Any]:

Parameters

Arguments
Description

project

The Project to export as json.

Returns

Type
Description

dict[str, Any]

JSON object representing the Project. Example:

{
    "project": {
        "name": "My Project",
        "description": "This is my project."
    },
    "tags": [
        {
            "name": "my-tag",
            "description" :"This is my tag."
        }
    ],
    "test_specs": [
        {
            "assertion": { "name": "less_than", "params": { "other": 0.5 } },
            "description": "Testing the difference in the example statistic",
            "name": "Gr.0: Non Parametric Difference: Example_Statistic",
            "statistic_inputs": [
                {
                    "select_query_template": {
                        "filter": null,
                        "select": "{EXPERIMENT}.Example_Statistic"
                    }
                },
                {
                    "select_query_template": {
                        "filter": null,
                        "select": "{BASELINE}.Example_Statistic"
                    }
                }
            ],
            "statistic_name": "my_stat",
            "statistic_params": {},
            "tag_names": ["my-tag"]
        }
    ]
}

Examples

import dbnl
dbnl.login()


proj = dbnl.get_or_create_project(name="test_proj")
export_json = dbnl.export_project_as_json(project=proj)

assert export_json["project"]["name"] == "test_proj"

Was this helpful?