udata 10.3.3.dev35125__py2.py3-none-any.whl → 10.4.0__py2.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.
Potentially problematic release.
This version of udata might be problematic. Click here for more details.
- udata/__init__.py +1 -1
- udata/core/dataset/apiv2.py +45 -0
- udata/tests/api/test_datasets_api.py +31 -0
- {udata-10.3.3.dev35125.dist-info → udata-10.4.0.dist-info}/METADATA +3 -2
- {udata-10.3.3.dev35125.dist-info → udata-10.4.0.dist-info}/RECORD +9 -9
- {udata-10.3.3.dev35125.dist-info → udata-10.4.0.dist-info}/LICENSE +0 -0
- {udata-10.3.3.dev35125.dist-info → udata-10.4.0.dist-info}/WHEEL +0 -0
- {udata-10.3.3.dev35125.dist-info → udata-10.4.0.dist-info}/entry_points.txt +0 -0
- {udata-10.3.3.dev35125.dist-info → udata-10.4.0.dist-info}/top_level.txt +0 -0
udata/__init__.py
CHANGED
udata/core/dataset/apiv2.py
CHANGED
|
@@ -426,6 +426,51 @@ class ResourcesAPI(API):
|
|
|
426
426
|
}
|
|
427
427
|
|
|
428
428
|
|
|
429
|
+
@ns.route("/<dataset:dataset>/schemas/", endpoint="dataset_schemas", doc=common_doc)
|
|
430
|
+
@apiv2.response(404, "Dataset not found")
|
|
431
|
+
@apiv2.response(410, "Dataset has been deleted")
|
|
432
|
+
class DatasetSchemasAPI(API):
|
|
433
|
+
@apiv2.doc("get_dataset_schemas")
|
|
434
|
+
@apiv2.marshal_with(schema_fields)
|
|
435
|
+
def get(self, dataset):
|
|
436
|
+
"""Get a dataset schemas given its identifier"""
|
|
437
|
+
if not DatasetEditPermission(dataset).can():
|
|
438
|
+
if dataset.private:
|
|
439
|
+
apiv2.abort(404)
|
|
440
|
+
elif dataset.deleted:
|
|
441
|
+
apiv2.abort(410, "Dataset has been deleted")
|
|
442
|
+
|
|
443
|
+
pipeline = [
|
|
444
|
+
{
|
|
445
|
+
"$match": {"_id": dataset.id} # Sélection du document
|
|
446
|
+
},
|
|
447
|
+
{
|
|
448
|
+
"$project": {
|
|
449
|
+
"resources": {
|
|
450
|
+
"$filter": {
|
|
451
|
+
"input": "$resources",
|
|
452
|
+
"as": "res",
|
|
453
|
+
"cond": {"$ne": ["$$res.schema", None]},
|
|
454
|
+
}
|
|
455
|
+
}
|
|
456
|
+
}
|
|
457
|
+
},
|
|
458
|
+
]
|
|
459
|
+
|
|
460
|
+
dataset = next(Dataset.objects.aggregate(*pipeline))
|
|
461
|
+
return list(
|
|
462
|
+
{
|
|
463
|
+
(
|
|
464
|
+
r.get("schema").get("url"),
|
|
465
|
+
r.get("schema").get("name"),
|
|
466
|
+
r.get("schema").get("version"),
|
|
467
|
+
): r.get("schema")
|
|
468
|
+
for r in dataset.get("resources", [])
|
|
469
|
+
if r.get("schema")
|
|
470
|
+
}.values()
|
|
471
|
+
)
|
|
472
|
+
|
|
473
|
+
|
|
429
474
|
@ns.route("/resources/<uuid:rid>/", endpoint="resource")
|
|
430
475
|
class ResourceAPI(API):
|
|
431
476
|
@apiv2.doc("get_resource")
|
|
@@ -1186,6 +1186,37 @@ class DatasetAPITest(APITestCase):
|
|
|
1186
1186
|
assert dataset.resources[0].schema["url"] is None
|
|
1187
1187
|
assert dataset.resources[0].schema["version"] is None
|
|
1188
1188
|
|
|
1189
|
+
def test_get_schemas(self):
|
|
1190
|
+
resources = []
|
|
1191
|
+
resources.append(ResourceFactory(schema={"name": "etalab/schema-irve-statique"}))
|
|
1192
|
+
resources.append(
|
|
1193
|
+
ResourceFactory(
|
|
1194
|
+
schema={"name": "etalab/schema-irve-statique", "url": "http://example.org"}
|
|
1195
|
+
)
|
|
1196
|
+
)
|
|
1197
|
+
resources.append(ResourceFactory(schema={"name": "etalab/schema-irve-dynamique"}))
|
|
1198
|
+
resources.append(ResourceFactory(schema={"name": "etalab/schema-irve-dynamique"}))
|
|
1199
|
+
resources.append(ResourceFactory(schema=None))
|
|
1200
|
+
dataset = DatasetFactory(resources=resources)
|
|
1201
|
+
|
|
1202
|
+
response = self.get(url_for("apiv2.dataset_schemas", dataset=dataset))
|
|
1203
|
+
assert len(response.json) == 3
|
|
1204
|
+
assert response.json[0] == {
|
|
1205
|
+
"name": "etalab/schema-irve-statique",
|
|
1206
|
+
"url": None,
|
|
1207
|
+
"version": None,
|
|
1208
|
+
}
|
|
1209
|
+
assert response.json[1] == {
|
|
1210
|
+
"name": "etalab/schema-irve-statique",
|
|
1211
|
+
"url": "http://example.org",
|
|
1212
|
+
"version": None,
|
|
1213
|
+
}
|
|
1214
|
+
assert response.json[2] == {
|
|
1215
|
+
"name": "etalab/schema-irve-dynamique",
|
|
1216
|
+
"url": None,
|
|
1217
|
+
"version": None,
|
|
1218
|
+
}
|
|
1219
|
+
|
|
1189
1220
|
|
|
1190
1221
|
class DatasetBadgeAPITest(APITestCase):
|
|
1191
1222
|
@classmethod
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: udata
|
|
3
|
-
Version: 10.
|
|
3
|
+
Version: 10.4.0
|
|
4
4
|
Summary: Open data portal
|
|
5
5
|
Home-page: https://github.com/opendatateam/udata
|
|
6
6
|
Author: Opendata Team
|
|
@@ -139,12 +139,13 @@ It is collectively taken care of by members of the
|
|
|
139
139
|
|
|
140
140
|
# Changelog
|
|
141
141
|
|
|
142
|
-
##
|
|
142
|
+
## 10.4.0 (2025-05-15)
|
|
143
143
|
|
|
144
144
|
- Improve reuse api perfs by adding a mask on datasets [#3309](https://github.com/opendatateam/udata/pull/3309)
|
|
145
145
|
- Private objects should return 404 by api [#3311](https://github.com/opendatateam/udata/pull/3311) [#3316](https://github.com/opendatateam/udata/pull/3316)
|
|
146
146
|
- Allow returning full sub-objects (license, frequency, zones and granularity) for datasets APIv2 [#3310](https://github.com/opendatateam/udata/pull/3310)
|
|
147
147
|
- Add `featured` to dataset default mask [#3313](https://github.com/opendatateam/udata/pull/3313)
|
|
148
|
+
- Add endpoint to get all schemas for a dataset without fetching resources [#3314](https://github.com/opendatateam/udata/pull/3314)
|
|
148
149
|
|
|
149
150
|
## 10.3.2 (2025-05-06)
|
|
150
151
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
tasks/__init__.py,sha256=nfgZ5nkcoluXMIk52P4-8Rj6xL0Qlm_xSUfWW2aHZfI,8161
|
|
2
2
|
tasks/helpers.py,sha256=70fS9tI_m0DTWmKx9Zl5-LG-nxdz_ZaPyvvsFkN2r48,1091
|
|
3
|
-
udata/__init__.py,sha256=
|
|
3
|
+
udata/__init__.py,sha256=9s_K6HS4Auik4z8CvyR1lvvu0ik3M9VAnV8dF587kzs,98
|
|
4
4
|
udata/api_fields.py,sha256=nv_Nl1Mi-XQ8V08fxmscer13jsNNJgSOOIQEh1itsLQ,30679
|
|
5
5
|
udata/app.py,sha256=xjk2D3EgboYBpTwBwdIxd2klt2yMoWMyCrkry5fz0LA,7292
|
|
6
6
|
udata/assets.py,sha256=H5Hrc2vnKM0IFLyWfLXmJ2Kj35w1i8W1D8Cgy8_cUj4,657
|
|
@@ -96,7 +96,7 @@ udata/core/dataset/actions.py,sha256=mX6xox0PiMrbcAPZ3VZsI26rfM-ciYfEXxN6sqqImKA
|
|
|
96
96
|
udata/core/dataset/activities.py,sha256=v8k1jwhdx62Z2ARZq8Q-x86OWSsBK99hRloPl74OCgA,1502
|
|
97
97
|
udata/core/dataset/api.py,sha256=jElQZuguc514Eb0cWdquEfosP1yB79hEQ52SV_SvLx8,33282
|
|
98
98
|
udata/core/dataset/api_fields.py,sha256=SLuzWoPdMLPX28WQ9DRGUPKS27vlltiFeiTo6jXa55Q,17549
|
|
99
|
-
udata/core/dataset/apiv2.py,sha256=
|
|
99
|
+
udata/core/dataset/apiv2.py,sha256=zrqln8hYxYgOJdorL-gDX67W8iVBKAn8YDYY9wAY00c,20730
|
|
100
100
|
udata/core/dataset/commands.py,sha256=__hPAk_6iHtgMnEG51ux0vbNWJHxUjXhi1ukH4hF5jY,3714
|
|
101
101
|
udata/core/dataset/constants.py,sha256=fKn21GzRShZv6pzKy3TvEK1cevQ9H3dOFE-xTRuE0lA,2971
|
|
102
102
|
udata/core/dataset/csv.py,sha256=aNJOytbFbH8OCYr6hyaSaqFSa94Xb3dvBd3QGZHJRsA,3633
|
|
@@ -626,7 +626,7 @@ udata/tests/api/test_auth_api.py,sha256=OMRlY0OQt60j5N4A-N3HdWTuffOjRlFHkz5a3jJF
|
|
|
626
626
|
udata/tests/api/test_base_api.py,sha256=2w_vz0eEuq3P3aN-ByvxGc3VZAo7XtgatFfcrzf2uEU,2244
|
|
627
627
|
udata/tests/api/test_contact_points.py,sha256=X_RWD_xCfR8WchhHfKEt5mxMHY77OmTyguNKCsZftdE,5337
|
|
628
628
|
udata/tests/api/test_dataservices_api.py,sha256=fNpeHl4SMvci3QrC414X6KGorv7NS1y8LsGxcSMjjZY,25729
|
|
629
|
-
udata/tests/api/test_datasets_api.py,sha256=
|
|
629
|
+
udata/tests/api/test_datasets_api.py,sha256=3EQdnP0DX-6mmPP-1hQrMTOPE1ZxLFIgB5Y4bKvH27k,97751
|
|
630
630
|
udata/tests/api/test_fields.py,sha256=OW85Z5MES5HeWOpapeem8OvR1cIcrqW-xMWpdZO4LZ8,1033
|
|
631
631
|
udata/tests/api/test_follow_api.py,sha256=XP6I96JUNT6xjGcQOF7pug_T_i67HzCiOGLaPdpfpEQ,4912
|
|
632
632
|
udata/tests/api/test_me_api.py,sha256=YPd8zmR3zwJKtpSqz8nY1nOOMyXs66INeBwyhg5D0Us,13846
|
|
@@ -726,9 +726,9 @@ udata/translations/pt/LC_MESSAGES/udata.mo,sha256=ViV14tUmjSydHS0TWG_mFikKQfyUaT
|
|
|
726
726
|
udata/translations/pt/LC_MESSAGES/udata.po,sha256=rzAD_MVoV54TmN3w1ECz3H2Ru5pM7hWMVH03SkY28Q8,47250
|
|
727
727
|
udata/translations/sr/LC_MESSAGES/udata.mo,sha256=EHX1_D-Uglj38832G7BrA0QC5IuY3p8dKqi9T0DgPmE,29169
|
|
728
728
|
udata/translations/sr/LC_MESSAGES/udata.po,sha256=3PMnbVhKVJh6Q8ABi1ZTZ8Dcf-sMjngLJZqLbonJoec,54225
|
|
729
|
-
udata-10.
|
|
730
|
-
udata-10.
|
|
731
|
-
udata-10.
|
|
732
|
-
udata-10.
|
|
733
|
-
udata-10.
|
|
734
|
-
udata-10.
|
|
729
|
+
udata-10.4.0.dist-info/LICENSE,sha256=V8j_M8nAz8PvAOZQocyRDX7keai8UJ9skgmnwqETmdY,34520
|
|
730
|
+
udata-10.4.0.dist-info/METADATA,sha256=rQ_hAThkecUmXeKvQo2a2RMy-Nm54lCvHFKL9FFpJRg,146016
|
|
731
|
+
udata-10.4.0.dist-info/WHEEL,sha256=Kh9pAotZVRFj97E15yTA4iADqXdQfIVTHcNaZTjxeGM,110
|
|
732
|
+
udata-10.4.0.dist-info/entry_points.txt,sha256=ETvkR4r6G1duBsh_V_fGWENQy17GTFuobi95MYBAl1A,498
|
|
733
|
+
udata-10.4.0.dist-info/top_level.txt,sha256=39OCg-VWFWOq4gCKnjKNu-s3OwFlZIu_dVH8Gl6ndHw,12
|
|
734
|
+
udata-10.4.0.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|