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

BUG : FIX : HDX Upload last_modified #195

Merged
merged 1 commit into from
Jan 4, 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
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
Loading