Skip to content
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

Bugfix: copy-dictionary crashing when trying to upsert a source without children #27

Merged
merged 1 commit into from
Feb 13, 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
5 changes: 5 additions & 0 deletions toolbox/api/datagalaxy_api_dictionary.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,11 @@ def bulk_upsert_sources_tree(self, workspace_name: str, sources: list) -> DataGa

# We need to make a post request for each source tree
for source_bulk in bulk_tree:
# We cannot send a bulktree containing only a source without children (rejected by the API)
if 'children' not in source_bulk or len(source_bulk['children']) < 1:
logging.warn(f'bulk_upsert_sources_tree - Cannot create a source without children : {source_bulk}')
continue

version_id = self.workspace['defaultVersionId']
headers = {'Authorization': f"Bearer {self.access_token}"}
response = requests.post(f"{self.url}/sources/bulktree/{version_id}", json=source_bulk,
Expand Down
Loading