Skip to content

Commit

Permalink
Updates bug on hdx upload
Browse files Browse the repository at this point in the history
  • Loading branch information
kshitijrajsharma committed Jan 4, 2024
1 parent 097b57b commit a65b827
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@
if ENABLE_HDX_EXPORTS:
import duckdb
from hdx.data.dataset import Dataset
from hdx.data.resource import Resource

from src.config import (
DUCK_DB_MEMORY_LIMIT,
Expand Down Expand Up @@ -1494,7 +1495,6 @@ def resource_to_response(self, uploaded_resources, category):
"format": resource["format_suffix"],
"description": resource["format_description"],
"url": resource["download_url"],
"last_modifed": datetime.now().isoformat(),
}
resource_meta["uploaded_to_hdx"]: False
resources.append(resource_meta)
Expand Down Expand Up @@ -1757,7 +1757,9 @@ def add_resource(self, resource_meta):
"""
if self.dataset:
self.resources.append(resource_meta)
self.dataset.add_update_resource(resource_meta)
resource_obj = Resource(resource_meta)
resource_obj.mark_data_updated()
self.dataset.add_update_resource(resource_obj)

def upload_dataset(self, dump_config_to_s3=False):
"""
Expand Down Expand Up @@ -1785,9 +1787,12 @@ def upload_dataset(self, dump_config_to_s3=False):
str(s3_upload_name),
)

self.dataset.set_reference_period(datetime.now())
self.dataset.set_time_period(datetime.now())
try:
self.dataset.create_in_hdx(allow_no_resources=True)
self.dataset.create_in_hdx(
allow_no_resources=True,
hxl_update=False,
)
dataset_info["hdx_upload"] = "SUCCESS"
except Exception as ex:
logging.error(ex)
Expand Down

0 comments on commit a65b827

Please sign in to comment.