Skip to content

Commit

Permalink
reg: create CKAN entry for resource after uploading directly to S3
Browse files Browse the repository at this point in the history
  • Loading branch information
paulmueller committed Mar 6, 2024
1 parent 1a54508 commit 209f153
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions dcoraid/api/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,6 +333,18 @@ def resource_add_upload_direct_s3(
raise ValueError(f"Upload {upload_id} failed with "
f"{hrep.status_code}: {hrep.reason}")

# The upload succeeded, now add the resource to the CKAN database.
revise_dict = {
"match": {"id": dataset_id},
"update": {"resources": [{"id": upload_info["resource_id"],
"name": resource_name,
"s3_available": True,
}
]
}
}
api.post("package_revise", revise_dict)


def resource_add_upload_legacy_indirect_ckan(
api: CKANAPI,
Expand Down

0 comments on commit 209f153

Please sign in to comment.