From a65b8279ea6d133980354df45835b9d93da71761 Mon Sep 17 00:00:00 2001 From: kshitijrajsharma Date: Thu, 4 Jan 2024 10:18:01 +0545 Subject: [PATCH] Updates bug on hdx upload --- src/app.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/src/app.py b/src/app.py index fe8c9d5d..96a9c345 100644 --- a/src/app.py +++ b/src/app.py @@ -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, @@ -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) @@ -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): """ @@ -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)