Skip to content

Commit

Permalink
fix(Datasets): Use the correct mutation to upload files in datasets :…
Browse files Browse the repository at this point in the history
… generateDatasetUploadUrl
  • Loading branch information
qgerome committed Sep 5, 2024
1 parent da827e7 commit d4d56d6
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions openhexa/sdk/datasets/dataset.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,8 +245,8 @@ def add_file(

upload_url_result = graphql(
"""
mutation generateUploadUrl ($input: GenerateUploadUrlInput!) {
generateUploadUrl(input: $input) {
mutation generateDatasetUploadUrl ($input: GenerateDatasetUploadUrlInput!) {
generateDatasetUploadUrl(input: $input) {
uploadUrl
success
errors
Expand All @@ -255,11 +255,11 @@ def add_file(
""",
{"input": {"versionId": self.id, "contentType": mime_type, "uri": filename}},
)
if upload_url_result["generateUploadUrl"]["success"] is False:
errors = upload_url_result["generateUploadUrl"]["errors"]
if upload_url_result["generateDatasetUploadUrl"]["success"] is False:
errors = upload_url_result["generateDatasetUploadUrl"]["errors"]
self.raise_upload_exception(errors)

upload_url = upload_url_result["generateUploadUrl"]["uploadUrl"]
upload_url = upload_url_result["generateDatasetUploadUrl"]["uploadUrl"]
with read_content(source) as content:
response = requests.put(upload_url, data=content, headers={"Content-Type": mime_type})
response.raise_for_status()
Expand Down

0 comments on commit d4d56d6

Please sign in to comment.