Skip to content

Commit 1932362

Browse files
committed
working on this, need a better way to check what collections a dataset is contained in
1 parent 5a84349 commit 1932362

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

scripts/migration/migrate.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,9 +153,19 @@ def get_clowder_v1_user_collections(headers, user_v1):
153153
# TODO this is too slow, we need to optimize it
154154
def get_clowder_v1_dataset_collections(headers, user_v1, dataset_id):
155155
matching_collections = []
156-
endpoint = f"{CLOWDER_V1}/api/collections/allCollections"
157-
response = requests.get(endpoint, headers=headers)
156+
endpoint1 = f"{CLOWDER_V1}/api/collections/rootCollections?superAdmin=true"
157+
endpint2 = f"{CLOWDER_V1}/api/collections/topLevelCollections?superAdmin=true"
158+
response = requests.get(endpoint1, headers=headers)
159+
response2 = requests.get(endpint2, headers=headers)
158160
user_collections = response.json()
161+
user_collections_ids = []
162+
user_collections_ids_2 = []
163+
user_collections_2 = response2.json()
164+
for collection in user_collections_2:
165+
id = collection['id']
166+
user_collections_ids_2.append(id)
167+
for collection in user_collections:
168+
user_collections_ids.append(collection['id'])
159169
for collection in user_collections:
160170
collection_id = collection["id"]
161171
collection_dataset_endpoint = (

0 commit comments

Comments
 (0)