hdx-python-api 6.6.7__py3-none-any.whl → 6.6.8__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- hdx/api/_version.py +2 -2
- hdx/data/resource.py +50 -0
- {hdx_python_api-6.6.7.dist-info → hdx_python_api-6.6.8.dist-info}/METADATA +2 -2
- {hdx_python_api-6.6.7.dist-info → hdx_python_api-6.6.8.dist-info}/RECORD +6 -6
- {hdx_python_api-6.6.7.dist-info → hdx_python_api-6.6.8.dist-info}/WHEEL +0 -0
- {hdx_python_api-6.6.7.dist-info → hdx_python_api-6.6.8.dist-info}/licenses/LICENSE +0 -0
hdx/api/_version.py
CHANGED
|
@@ -18,7 +18,7 @@ version_tuple: tuple[int | str, ...]
|
|
|
18
18
|
commit_id: str | None
|
|
19
19
|
__commit_id__: str | None
|
|
20
20
|
|
|
21
|
-
__version__ = version = '6.6.
|
|
22
|
-
__version_tuple__ = version_tuple = (6, 6,
|
|
21
|
+
__version__ = version = '6.6.8'
|
|
22
|
+
__version_tuple__ = version_tuple = (6, 6, 8)
|
|
23
23
|
|
|
24
24
|
__commit_id__ = commit_id = None
|
hdx/data/resource.py
CHANGED
|
@@ -62,6 +62,9 @@ class Resource(HDXObject):
|
|
|
62
62
|
"search": "resource_search",
|
|
63
63
|
"broken": "hdx_mark_broken_link_in_resource",
|
|
64
64
|
"datastore_delete": "datastore_delete",
|
|
65
|
+
"datastore_create": "datastore_create",
|
|
66
|
+
"datastore_insert": "datastore_insert",
|
|
67
|
+
"datastore_upsert": "datastore_upsert",
|
|
65
68
|
"datastore_search": "datastore_search",
|
|
66
69
|
}
|
|
67
70
|
|
|
@@ -701,6 +704,53 @@ class Resource(HDXObject):
|
|
|
701
704
|
return True
|
|
702
705
|
return False
|
|
703
706
|
|
|
707
|
+
def create_datastore(
|
|
708
|
+
self,
|
|
709
|
+
schema: Sequence[dict],
|
|
710
|
+
primary_key: str | Sequence[str] | None = None,
|
|
711
|
+
) -> None:
|
|
712
|
+
"""Create a datastore for the resource with the given schema.
|
|
713
|
+
|
|
714
|
+
Args:
|
|
715
|
+
schema: Sequence of field definitions, each a dict with 'id' and 'type' keys.
|
|
716
|
+
primary_key: Primary key field name(s). Defaults to None.
|
|
717
|
+
|
|
718
|
+
Returns:
|
|
719
|
+
None
|
|
720
|
+
"""
|
|
721
|
+
data: dict = {
|
|
722
|
+
"resource_id": self.data["id"],
|
|
723
|
+
"force": True,
|
|
724
|
+
"fields": schema,
|
|
725
|
+
}
|
|
726
|
+
if primary_key is not None:
|
|
727
|
+
if not isinstance(primary_key, str):
|
|
728
|
+
primary_key = ",".join(primary_key)
|
|
729
|
+
data["primary_key"] = primary_key
|
|
730
|
+
self._write_to_hdx("datastore_create", data, "resource_id")
|
|
731
|
+
|
|
732
|
+
def update_datastore(
|
|
733
|
+
self,
|
|
734
|
+
records: Sequence[dict],
|
|
735
|
+
method: str = "upsert",
|
|
736
|
+
) -> None:
|
|
737
|
+
"""Update (upsert) records into the resource datastore.
|
|
738
|
+
|
|
739
|
+
Args:
|
|
740
|
+
records: Sequence of record dicts to insert or update.
|
|
741
|
+
method: Datastore update method ('upsert', 'insert', or 'update'). Defaults to 'upsert'.
|
|
742
|
+
|
|
743
|
+
Returns:
|
|
744
|
+
None
|
|
745
|
+
"""
|
|
746
|
+
data = {
|
|
747
|
+
"resource_id": self.data["id"],
|
|
748
|
+
"force": True,
|
|
749
|
+
"method": method,
|
|
750
|
+
"records": records,
|
|
751
|
+
}
|
|
752
|
+
self._write_to_hdx("datastore_upsert", data, "resource_id")
|
|
753
|
+
|
|
704
754
|
def delete_datastore(self) -> None:
|
|
705
755
|
"""Delete a resource from the HDX datastore
|
|
706
756
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: hdx-python-api
|
|
3
|
-
Version: 6.6.
|
|
3
|
+
Version: 6.6.8
|
|
4
4
|
Summary: HDX Python API for interacting with the Humanitarian Data Exchange
|
|
5
5
|
Project-URL: Homepage, https://github.com/OCHA-DAP/hdx-python-api
|
|
6
6
|
Author: Michael Rans
|
|
@@ -25,7 +25,7 @@ Classifier: Programming Language :: Python :: 3.13
|
|
|
25
25
|
Classifier: Programming Language :: Python :: 3.14
|
|
26
26
|
Classifier: Topic :: Software Development :: Libraries :: Python Modules
|
|
27
27
|
Requires-Python: >=3.10
|
|
28
|
-
Requires-Dist: ckanapi>=4.
|
|
28
|
+
Requires-Dist: ckanapi>=4.11
|
|
29
29
|
Requires-Dist: defopt>=7.0.0
|
|
30
30
|
Requires-Dist: email-validator
|
|
31
31
|
Requires-Dist: hdx-python-country>=4.1.1
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
hdx/api/__init__.py,sha256=11ozJKiUsqDCZ3_mcAHhGYUyGK_Unl54djVSBBExFB4,59
|
|
2
|
-
hdx/api/_version.py,sha256=
|
|
2
|
+
hdx/api/_version.py,sha256=DuBvygFq7Ca-heE19aRqV-dGslR55qXsxEXRXjW5FNM,520
|
|
3
3
|
hdx/api/configuration.py,sha256=9WvuVI-3th2Dv70_t_4VoyrlJwB_9qUSN5_zUKbp4sQ,23805
|
|
4
4
|
hdx/api/hdx_base_configuration.yaml,sha256=9yJYroZwoyMQo6tcxGfWHWvYahnTma7Szx0J5Z378z4,2173
|
|
5
5
|
hdx/api/locations.py,sha256=blnqOjEASvh0mWgmo2iEE7ES_xOuRwQo3fOMqTPV_P0,4139
|
|
@@ -14,7 +14,7 @@ hdx/data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
|
14
14
|
hdx/data/dataset.py,sha256=0gS7tQSswTgG0g8YeXg0FL8pFVkocBQSRPFpQAurN00,99455
|
|
15
15
|
hdx/data/hdxobject.py,sha256=_jlwYjb_CcjaXsTXObknMfq-OiNOcpJfLJ9b1vKV1Zo,27494
|
|
16
16
|
hdx/data/organization.py,sha256=HGopFsCYOWrR7sUtZzZSXq6wLFw4djus2gzg6yNXOqc,12296
|
|
17
|
-
hdx/data/resource.py,sha256=
|
|
17
|
+
hdx/data/resource.py,sha256=YcxGzKuFduLZIOnCvo-zcwJfnTGOmnvtDeFr2xKeOM4,35647
|
|
18
18
|
hdx/data/resource_matcher.py,sha256=Yzk9pWa4zk1p09m6zcZMj0XZf5Y16Pa3KToOdUt7rP8,4247
|
|
19
19
|
hdx/data/resource_view.py,sha256=GcYkh0iDAe6_m2ErY_A6i3Z7ZFX949eGt1TLnLZv_8s,7346
|
|
20
20
|
hdx/data/showcase.py,sha256=vnRZ45xd9Ct65eFQkWZtMIJPFifZfKOrH4obO5D5Pvc,14062
|
|
@@ -24,7 +24,7 @@ hdx/facades/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
|
24
24
|
hdx/facades/infer_arguments.py,sha256=DvyDuozfOPmoaV7HjhQySojGIrMWW9nos31auQBVVl8,4032
|
|
25
25
|
hdx/facades/keyword_arguments.py,sha256=aVapHCfqBO6H7xxBgTdK9ISdgrBFsNypPDWihfQ3edU,1125
|
|
26
26
|
hdx/facades/simple.py,sha256=QWsBkaHG_UM6X3Zu2u3LWVOQzeR24q-EUClrfsL_mkM,1064
|
|
27
|
-
hdx_python_api-6.6.
|
|
28
|
-
hdx_python_api-6.6.
|
|
29
|
-
hdx_python_api-6.6.
|
|
30
|
-
hdx_python_api-6.6.
|
|
27
|
+
hdx_python_api-6.6.8.dist-info/METADATA,sha256=tRdOttf0O-eRc7iASB0HkCahGiC4dzf5SIVCCv8VHxw,4946
|
|
28
|
+
hdx_python_api-6.6.8.dist-info/WHEEL,sha256=QccIxa26bgl1E6uMy58deGWi-0aeIkkangHcxk2kWfw,87
|
|
29
|
+
hdx_python_api-6.6.8.dist-info/licenses/LICENSE,sha256=wc-4GpMn-ODs-U_bTe1YCiPVgvcjzrpYOx2wPuyAeII,1079
|
|
30
|
+
hdx_python_api-6.6.8.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|