aepp 0.5.1.post1__py3-none-any.whl → 0.5.2.post1__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.
- aepp/__version__.py +1 -1
- aepp/classmanager.py +59 -29
- aepp/cli/__main__.py +198 -34
- aepp/datatypemanager.py +60 -27
- aepp/fieldgroupmanager.py +100 -65
- aepp/schemamanager.py +140 -78
- aepp/synchronizer.py +77 -57
- {aepp-0.5.1.post1.dist-info → aepp-0.5.2.post1.dist-info}/METADATA +2 -1
- {aepp-0.5.1.post1.dist-info → aepp-0.5.2.post1.dist-info}/RECORD +13 -13
- {aepp-0.5.1.post1.dist-info → aepp-0.5.2.post1.dist-info}/WHEEL +0 -0
- {aepp-0.5.1.post1.dist-info → aepp-0.5.2.post1.dist-info}/entry_points.txt +0 -0
- {aepp-0.5.1.post1.dist-info → aepp-0.5.2.post1.dist-info}/licenses/LICENSE +0 -0
- {aepp-0.5.1.post1.dist-info → aepp-0.5.2.post1.dist-info}/top_level.txt +0 -0
aepp/synchronizer.py
CHANGED
|
@@ -20,7 +20,7 @@ from .configs import ConnectObject
|
|
|
20
20
|
|
|
21
21
|
class Synchronizer:
|
|
22
22
|
## TO DO -> Add support for local environment
|
|
23
|
-
def __init__(self,targets:list=None,config:'ConnectObject'=None,baseSandbox:str=None,region:str='nld2',localFolder:str=None):
|
|
23
|
+
def __init__(self,targets:list=None,config:'ConnectObject'=None,baseSandbox:str=None,region:str='nld2',localFolder:str|list|None=None):
|
|
24
24
|
"""
|
|
25
25
|
Setup the synchronizor object with the base sandbox and target sandbox.
|
|
26
26
|
Arguments:
|
|
@@ -56,24 +56,30 @@ class Synchronizer:
|
|
|
56
56
|
self.baseSandbox = baseSandbox
|
|
57
57
|
elif localFolder is not None:
|
|
58
58
|
self.baseConfig = None
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
self.
|
|
64
|
-
self.
|
|
65
|
-
self.
|
|
66
|
-
self.
|
|
67
|
-
self.
|
|
68
|
-
self.
|
|
69
|
-
self.
|
|
70
|
-
self.
|
|
59
|
+
if isinstance(localFolder, str):
|
|
60
|
+
self.localfolder = [Path(localFolder)]
|
|
61
|
+
else:
|
|
62
|
+
self.localfolder = [Path(folder) for folder in localFolder]
|
|
63
|
+
self.classFolder = [folder / 'class' for folder in self.localfolder]
|
|
64
|
+
self.schemaFolder = [folder / 'schema' for folder in self.localfolder]
|
|
65
|
+
self.fieldgroupFolder = [folder / 'fieldgroup' for folder in self.localfolder]
|
|
66
|
+
self.fieldgroupGlobalFolder = [folder / 'global' for folder in self.fieldgroupFolder]
|
|
67
|
+
self.datatypeFolder = [folder / 'datatype' for folder in self.localfolder]
|
|
68
|
+
self.datatypeGlobalFolder = [folder / 'global' for folder in self.datatypeFolder]
|
|
69
|
+
self.identityFolder = [folder / 'identity' for folder in self.localfolder]
|
|
70
|
+
self.datasetFolder = [folder / 'dataset' for folder in self.localfolder]
|
|
71
|
+
self.descriptorFolder = [folder / 'descriptor' for folder in self.localfolder]
|
|
72
|
+
self.mergePolicyFolder = [folder / 'mergepolicy' for folder in self.localfolder]
|
|
73
|
+
self.audienceFolder = [folder / 'audience' for folder in self.localfolder]
|
|
71
74
|
if baseSandbox is not None:
|
|
72
75
|
self.baseSandbox = baseSandbox
|
|
73
76
|
else:
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
+
for folder in self.localfolder:
|
|
78
|
+
with open(folder / 'config.json','r') as f:
|
|
79
|
+
local_config = json.load(f)
|
|
80
|
+
if 'baseSandbox' in local_config.keys():
|
|
81
|
+
self.baseSandbox = local_config['baseSandbox']
|
|
82
|
+
break
|
|
77
83
|
self.dict_targetsConfig = {target: aepp.configure(org_id=config_object['org_id'],client_id=config_object['client_id'],scopes=config_object['scopes'],secret=config_object['secret'],sandbox=target,connectInstance=True) for target in targets}
|
|
78
84
|
self.region = region
|
|
79
85
|
self.dict_baseComponents = {'schema':{},'class':{},'fieldgroup':{},'datatype':{},'datasets':{},'identities':{},"schemaDescriptors":{},'mergePolicy':{},'audience':{}}
|
|
@@ -163,11 +169,12 @@ class Synchronizer:
|
|
|
163
169
|
if component in base_schema.data.schemas_altId.keys():## replacing name with altId
|
|
164
170
|
component = base_schema.data.schemas_altId[component]
|
|
165
171
|
if self.localfolder is not None:
|
|
166
|
-
for
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
component
|
|
170
|
-
|
|
172
|
+
for folder in self.schemaFolder:
|
|
173
|
+
for file in folder.glob('*.json'):
|
|
174
|
+
sc_file = json.load(FileIO(file))
|
|
175
|
+
if sc_file['title'] == component or sc_file['$id'] == component or sc_file['meta:altId'] == component:
|
|
176
|
+
component = sc_file
|
|
177
|
+
break
|
|
171
178
|
component = schemamanager.SchemaManager(component,config=self.baseConfig,localFolder=self.localfolder,sandbox=self.baseSandbox)
|
|
172
179
|
elif componentType == 'fieldgroup':
|
|
173
180
|
if base_schema is not None:
|
|
@@ -175,11 +182,12 @@ class Synchronizer:
|
|
|
175
182
|
if component in base_schema.data.fieldGroups_altId.keys():## replacing name with altId
|
|
176
183
|
component = base_schema.data.fieldGroups_altId[component]
|
|
177
184
|
if self.localfolder is not None:
|
|
178
|
-
for
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
component
|
|
182
|
-
|
|
185
|
+
for folder in self.fieldgroupFolder:
|
|
186
|
+
for file in folder.glob('*.json'):
|
|
187
|
+
fg_file = json.load(FileIO(file))
|
|
188
|
+
if fg_file['title'] == component or fg_file['$id'] == component or fg_file['meta:altId'] == component:
|
|
189
|
+
component = fg_file
|
|
190
|
+
break
|
|
183
191
|
component = fieldgroupmanager.FieldGroupManager(component,config=self.baseConfig,localFolder=self.localfolder,sandbox=self.baseSandbox)
|
|
184
192
|
elif componentType == 'datatypes':
|
|
185
193
|
datatypes = base_schema.getDataTypes()
|
|
@@ -187,11 +195,12 @@ class Synchronizer:
|
|
|
187
195
|
if component in base_schema.data.dataTypes_altId.keys():## replacing name with altId
|
|
188
196
|
component = base_schema.data.dataTypes_altId[component]
|
|
189
197
|
if self.localfolder is not None:
|
|
190
|
-
for
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
component
|
|
194
|
-
|
|
198
|
+
for folder in self.datatypeFolder:
|
|
199
|
+
for file in folder.glob('*.json'):
|
|
200
|
+
dt_file = json.load(FileIO(file))
|
|
201
|
+
if dt_file['title'] == component or dt_file['$id'] == component or dt_file['meta:altId'] == component:
|
|
202
|
+
component = dt_file
|
|
203
|
+
break
|
|
195
204
|
component = datatypemanager.DataTypeManager(component,config=self.baseConfig,localFolder=self.localfolder,sandbox=self.baseSandbox)
|
|
196
205
|
elif componentType == 'class':
|
|
197
206
|
classes = base_schema.getClasses()
|
|
@@ -204,9 +213,10 @@ class Synchronizer:
|
|
|
204
213
|
identities:list = id_base.getIdentities()
|
|
205
214
|
elif self.localfolder is not None:
|
|
206
215
|
identities = []
|
|
207
|
-
for
|
|
208
|
-
|
|
209
|
-
|
|
216
|
+
for folder in self.identityFolder:
|
|
217
|
+
for file in folder.glob('*.json'):
|
|
218
|
+
id_file = json.load(FileIO(file))
|
|
219
|
+
identities.append(id_file)
|
|
210
220
|
if component in [el['code'] for el in identities]:
|
|
211
221
|
component = [el for el in identities if el['code'] == component][0]
|
|
212
222
|
elif component in [el['name'] for el in identities]:
|
|
@@ -221,11 +231,12 @@ class Synchronizer:
|
|
|
221
231
|
component = cat_base.data.ids[component]
|
|
222
232
|
component = cat_base.getDataSet(component)
|
|
223
233
|
elif self.localfolder is not None:
|
|
224
|
-
for
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
component
|
|
228
|
-
|
|
234
|
+
for folder in self.datasetFolder:
|
|
235
|
+
for file in folder.glob('*.json'):
|
|
236
|
+
ds_file = json.load(FileIO(file))
|
|
237
|
+
if ds_file['id'] == component or ds_file['name'] == component:
|
|
238
|
+
component = ds_file
|
|
239
|
+
break
|
|
229
240
|
if len(component) == 1: ## if the component is the catalog API response {'key': {dataset definition}}
|
|
230
241
|
component = component[list(component.keys())[0]] ## accessing the real dataset definition
|
|
231
242
|
elif componentType == "mergepolicy":
|
|
@@ -235,11 +246,12 @@ class Synchronizer:
|
|
|
235
246
|
if component in [el.get('id','') for el in base_mergePolicies] or component in [el.get('name','') for el in base_mergePolicies]:
|
|
236
247
|
component = [el for el in base_mergePolicies if el.get('id','') == component or el.get('name','') == component][0]
|
|
237
248
|
elif self.localfolder is not None:
|
|
238
|
-
for
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
component
|
|
242
|
-
|
|
249
|
+
for folder in self.mergePolicyFolder:
|
|
250
|
+
for file in folder.glob('*.json'):
|
|
251
|
+
mp_file = json.load(FileIO(file))
|
|
252
|
+
if mp_file.get('id','') == component or mp_file.get('name','') == component:
|
|
253
|
+
component = mp_file
|
|
254
|
+
break
|
|
243
255
|
elif componentType == 'audience':
|
|
244
256
|
if self.baseConfig is not None:
|
|
245
257
|
seg_base = segmentation.Segmentation(config=self.baseConfig)
|
|
@@ -247,11 +259,12 @@ class Synchronizer:
|
|
|
247
259
|
if component in [el.get('id','') for el in base_audiences] or component in [el.get('name','') for el in base_audiences]:
|
|
248
260
|
component = [el for el in base_audiences if el.get('id','') == component or el.get('name','') == component][0]
|
|
249
261
|
elif self.localfolder is not None:
|
|
250
|
-
for
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
component
|
|
254
|
-
|
|
262
|
+
for folder in self.audienceFolder:
|
|
263
|
+
for file in folder.glob('*.json'):
|
|
264
|
+
au_file = json.load(FileIO(file))
|
|
265
|
+
if au_file.get('id','') == component or au_file.get('name','') == component:
|
|
266
|
+
component = au_file
|
|
267
|
+
break
|
|
255
268
|
elif type(component) == dict:
|
|
256
269
|
if 'meta:resourceType' in component.keys():
|
|
257
270
|
componentType = component['meta:resourceType']
|
|
@@ -708,8 +721,9 @@ class Synchronizer:
|
|
|
708
721
|
myschemas = baseSchemaAPI.getSchemas() ## to populate the data object
|
|
709
722
|
elif self.localfolder is not None:
|
|
710
723
|
myschemas = []
|
|
711
|
-
for
|
|
712
|
-
|
|
724
|
+
for folder in self.schemaFolder:
|
|
725
|
+
for json_file in folder.glob('*.json'):
|
|
726
|
+
myschemas.append(json.load(FileIO(json_file)))
|
|
713
727
|
target_descriptors = targetSchemaManager.getDescriptors()
|
|
714
728
|
list_descriptors = []
|
|
715
729
|
for baseDescriptor in base_descriptors:
|
|
@@ -761,10 +775,15 @@ class Synchronizer:
|
|
|
761
775
|
if self.baseConfig is not None and self.localfolder is None:
|
|
762
776
|
base_targetSchemaManager = schemamanager.SchemaManager(base_targetSchemaId,config=self.baseConfig)
|
|
763
777
|
elif self.localfolder is not None:
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
778
|
+
found = False
|
|
779
|
+
for folder in self.schemaFolder:
|
|
780
|
+
for file in folder.glob('*.json'):
|
|
781
|
+
base_targetSchema = json.load(FileIO(file))
|
|
782
|
+
if base_targetSchema['$id'] == base_targetSchemaId:
|
|
783
|
+
base_targetSchemaManager = schemamanager.SchemaManager(base_targetSchema,config=self.baseConfig,localFolder=self.localfolder,sandbox=self.baseSandbox)
|
|
784
|
+
found = True
|
|
785
|
+
break
|
|
786
|
+
if found:
|
|
768
787
|
break
|
|
769
788
|
self.__syncSchema__(base_targetSchemaManager,verbose=verbose)
|
|
770
789
|
target_targetSchemaId = self.dict_targetComponents[targetSchemaManager.sandbox]['schema'][base_targetSchemaName].id
|
|
@@ -903,8 +922,9 @@ class Synchronizer:
|
|
|
903
922
|
base_dataset_related_schemaName = [schemaName for schemaName,schemaId in baseSchemaAPI.data.schemas_id.items() if schemaId == base_dataset_related_schemaId][0]
|
|
904
923
|
elif self.localfolder is not None:
|
|
905
924
|
base_schemas = []
|
|
906
|
-
for
|
|
907
|
-
|
|
925
|
+
for folder in self.schemaFolder:
|
|
926
|
+
for json_file in folder.glob('*.json'):
|
|
927
|
+
base_schemas.append(json.load(FileIO(json_file)))
|
|
908
928
|
base_dataset_related_schemaName = [sc['title'] for sc in base_schemas if sc['$id'] == base_dataset_related_schemaId][0]
|
|
909
929
|
for target in self.dict_targetsConfig.keys():
|
|
910
930
|
targetCatalog = catalog.Catalog(config=self.dict_targetsConfig[target])
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: aepp
|
|
3
|
-
Version: 0.5.
|
|
3
|
+
Version: 0.5.2.post1
|
|
4
4
|
Summary: Package to manage AEP API endpoint and some helper functions
|
|
5
5
|
Author-email: Julien Piccini <piccini.julien@gmail.com>
|
|
6
6
|
License: Apache-2.0
|
|
@@ -22,6 +22,7 @@ Requires-Dist: tenacity
|
|
|
22
22
|
Requires-Dist: deprecation
|
|
23
23
|
Requires-Dist: datamodel-code-generator
|
|
24
24
|
Requires-Dist: rich
|
|
25
|
+
Requires-Dist: matplotlib
|
|
25
26
|
Dynamic: license-file
|
|
26
27
|
|
|
27
28
|
# Adobe Experience Platform API made for humans
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
aepp/__init__.py,sha256=rsU4OMu3pJIgy8emJAD6lhAfqH0-raZ6GyIMJanNBdM,27912
|
|
2
|
-
aepp/__version__.py,sha256=
|
|
2
|
+
aepp/__version__.py,sha256=AUsss0HkU-B8aUszp_T12nUU7w7iBuYD5ALVA6BTKYA,23
|
|
3
3
|
aepp/accesscontrol.py,sha256=PB3FcrO4bvDjdNxjHx7p_20hp4ahBXewoOSxuTGMXC8,17423
|
|
4
4
|
aepp/catalog.py,sha256=hK9m3SAP0fhgkYqu14Tcfq14qBhw54tLCOF0mH31b1M,68237
|
|
5
|
-
aepp/classmanager.py,sha256=
|
|
5
|
+
aepp/classmanager.py,sha256=16hx_hptg3PYwmezZCr9dLjvOkNSunih1PK3Q-iPoZY,66099
|
|
6
6
|
aepp/config.py,sha256=232fcO8JaYJnS4glf8Ebnx9rCdHshZBVaVUbhoOAXkc,2543
|
|
7
7
|
aepp/configs.py,sha256=5rRWJoUQDDaj3AAXWdKCZBZA_Xb7q1Hd58OkWhzwK34,16151
|
|
8
8
|
aepp/connector.py,sha256=-EskFJm8Ki8A7_gpuNrydBBhz1-jZZz8QMB6gHQTZeA,27262
|
|
@@ -10,13 +10,13 @@ aepp/customerprofile.py,sha256=1yz7piGsSbxM2GaHqkCV-117Es6D1SthrNgnsVxH3Y8,49344
|
|
|
10
10
|
aepp/dataaccess.py,sha256=oOERLSxMh2nYBFngPS1dFI_AG3W-DJXmMoUVUiKXJrw,16338
|
|
11
11
|
aepp/dataprep.py,sha256=vMT4OYO8y6wsGRSjbJNQmgM048BiP3t1-RvKKglSiN4,27586
|
|
12
12
|
aepp/datasets.py,sha256=hTioR0WyImB91mleCwDQ2FfunvqYi_RrxX_v-iW6N70,8778
|
|
13
|
-
aepp/datatypemanager.py,sha256=
|
|
13
|
+
aepp/datatypemanager.py,sha256=5nP9EbJHd-q58aLFWKT2YyjRjpzI9QjTAo7G3lbMEWY,83540
|
|
14
14
|
aepp/deletion.py,sha256=hzSWNPky7iVRUFEOrpKX72iKJO149Mxp2e3Q_JqN-Mk,11416
|
|
15
15
|
aepp/destination.py,sha256=_-Hrzb_LUNaRrqR4Y3EZZuTisIs0nF3KH_GZpFjryrs,24348
|
|
16
16
|
aepp/destinationinstanceservice.py,sha256=zEZbKi519cOOdxWMZ3mv9ccP6yjNAlNwqrQMlzW_gO4,5378
|
|
17
17
|
aepp/edge.py,sha256=F2QZApmITObXB8hRWXftHBZ82KNqVZ7iSNuovT8qnk4,16041
|
|
18
18
|
aepp/exportDatasetToDataLandingZone.py,sha256=C6jg3XttFC-0mswa3ypZb6qx3MCQ8_A_3kyKspurXJA,18629
|
|
19
|
-
aepp/fieldgroupmanager.py,sha256=
|
|
19
|
+
aepp/fieldgroupmanager.py,sha256=4A7u3tx63HzcDiMqyZs5TRy-LN0Xsf7VGLdt1_exw2Q,103591
|
|
20
20
|
aepp/flowservice.py,sha256=WizgwY6TYn1kiLxQt6Y3d7XgoLAb9imXrFXtt94hhog,107612
|
|
21
21
|
aepp/hygiene.py,sha256=VEspnyu9eUlcK3wLeJYclaFaOWl5G5I5MRwmVA-RnUg,15385
|
|
22
22
|
aepp/identity.py,sha256=E9MCIgntScMssduqKZqehT6FqSfTjWHcq7E7wESj3Zc,20833
|
|
@@ -27,18 +27,18 @@ aepp/privacyservice.py,sha256=V6BkJeZG1LDBCyEQm9Gx0i68iRHG6uxSJiVnXzkHapI,8790
|
|
|
27
27
|
aepp/queryservice.py,sha256=wB9GiaMwJszNjqkYjkfEDUhdT2IoI22jA3Kt_6ki4Hk,62373
|
|
28
28
|
aepp/sandboxes.py,sha256=UwlSFkO2OOmH--6ISz8rxwDu2LcLH1MPqoH7yOEAZHc,29363
|
|
29
29
|
aepp/schema.py,sha256=aLYDM5lCANNddk-NZPNxCxazg9HpELalKlFxQz55dRs,123111
|
|
30
|
-
aepp/schemamanager.py,sha256=
|
|
30
|
+
aepp/schemamanager.py,sha256=G3JhVikWkaT14F8vORDfGJGivarvU2AgKO1RB-1pzdM,54117
|
|
31
31
|
aepp/segmentation.py,sha256=oSgR2yx4nawYN5XAeHV_wefvmXEf0nb-bCguaDmp8F8,43555
|
|
32
32
|
aepp/sensei.py,sha256=oYNy5BSWAEqsDkEexcQso6NfA6ntGGMnCOyHri0pJs8,7761
|
|
33
33
|
aepp/som.py,sha256=XNm_Lu2wt2kpSSpldLptuER2eludFXeO9fI6i3iNCzo,34175
|
|
34
|
-
aepp/synchronizer.py,sha256=
|
|
34
|
+
aepp/synchronizer.py,sha256=3scwuimQJIBVdEqJ9fVsT1UgmFc9EkH3mpYxUwSoAOE,79363
|
|
35
35
|
aepp/tags.py,sha256=t2qBallTcWR4IOXcDBmrPpqjbSay1z3E2bcRijzVm1s,17641
|
|
36
36
|
aepp/utils.py,sha256=tG-YVXylm38-bynqfp5N_Mzyo7mhlZj-dLo7wLoO4tM,1200
|
|
37
37
|
aepp/cli/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
38
|
-
aepp/cli/__main__.py,sha256=
|
|
39
|
-
aepp-0.5.
|
|
40
|
-
aepp-0.5.
|
|
41
|
-
aepp-0.5.
|
|
42
|
-
aepp-0.5.
|
|
43
|
-
aepp-0.5.
|
|
44
|
-
aepp-0.5.
|
|
38
|
+
aepp/cli/__main__.py,sha256=B2W5iooeKlsWQdWrJr27Y72ibEIgBHZTTGlLe-YgOZU,77329
|
|
39
|
+
aepp-0.5.2.post1.dist-info/licenses/LICENSE,sha256=HjYTlfne3BbS5gNHzNqJ5COCiTQLUdf87QkzRyFbE4Y,10337
|
|
40
|
+
aepp-0.5.2.post1.dist-info/METADATA,sha256=mp5AAwkCCK-cruebhH-SMdo89di8CdHacoTi5H5BTdw,5344
|
|
41
|
+
aepp-0.5.2.post1.dist-info/WHEEL,sha256=wUyA8OaulRlbfwMtmQsvNngGrxQHAvkKcvRmdizlJi0,92
|
|
42
|
+
aepp-0.5.2.post1.dist-info/entry_points.txt,sha256=e7HAumUTymoUiCuVRzFlcchennUBLcjxvuiimySF98Y,48
|
|
43
|
+
aepp-0.5.2.post1.dist-info/top_level.txt,sha256=dtZJI8SzhWVgZRl68PHKZX_fD6amvDiFR-lqD9FSJvE,5
|
|
44
|
+
aepp-0.5.2.post1.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|