Skip to content

feat: add bulk add datasource method to run #47

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Sep 17, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 9 additions & 0 deletions nominal/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,14 @@ class Run:
def add_dataset(self, ref_name: str, dataset: Dataset | str) -> None:
"""Add a dataset to this run.

Datasets map "ref names" (their name within the run) to a Dataset (or dataset rid). The same type of datasets
should use the same ref name across runs, since checklists and templates use ref names to reference datasets.
"""
self.add_datasets({ref_name: dataset})

def add_datasets(self, datasets: Mapping[str, Dataset | str]) -> None:
"""Add multiple datasets to this run.

Datasets map "ref names" (their name within the run) to a Dataset (or dataset rid). The same type of datasets
should use the same ref name across runs, since checklists and templates use ref names to reference datasets.
"""
Expand All @@ -77,6 +85,7 @@ def add_dataset(self, ref_name: str, dataset: Dataset | str) -> None:
series_tags={},
offset=None,
)
for ref_name, dataset in datasets.items()
}
self._client._run_client.add_data_sources_to_run(self._client._auth_header, data_sources, self.rid)

Expand Down
Loading