pitchmuc / aepp

Adobe Experience Platform API for humans

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support enabling dataset for profile with inserts

cmenguy opened this issue · comments

Currently it seems the only function to enable a dataset for profile with enableDatasetProfile is restricted to doing upserts. The tag for upserts should likely be optional so one can enable a dataset for inserts or upserts depending on the use case.

I have modified the method and upsert is now an additional parameter that, when enabled can be used to add the upsertOption.

Method signature now:

def enableDatasetProfile(self,datasetId:str=None,upsert:bool=False)->dict:
        """
        Enable a dataset for profile with upsert.
        Arguments:
            datasetId : REQUIRED : Dataset ID to be enabled for profile
            upsert : OPTIONAL : If you wish to enabled the dataset for upsert.
        """
        if datasetId is None:
            raise ValueError("Require a datasetId")
        if self.loggingEnabled:
            self.logger.debug(f"Starting enableDatasetProfile for datasetId: {datasetId}")
        path = f"/dataSets/{datasetId}"
        data = [
            { 
                "op": "add", 
                "path": "/tags/unifiedProfile",
                "value": ["enabled:true"] }
            ]
        if upsert:
            data[0]['value'] = ["enabled:true","isUpsert:true"]
        res = self.connector.patchData(self.endpoint+path, data=data)
        return res

Going to be release on the next iteration.

Release on 0.2.6 (now available on pypi)