Package: anaplanConnector
Simple Anaplan Connector PackageIntroductionThis is a simple Anaplan connector intended to be used as a quick and easy way to mainly integrate with Anaplan using Python. This package does not include all API options. It uses the main calls to push data to anaplan via files, call a process, and export data.Anaplan Integration OverviewThe method of pushing data to Anaplan is common in the data warehousing space. Instead of pushing data in a transaction api (i.e. record by record), Anaplan utilizes a bulk data API which includes pushing delimitted files to a file location, and then copying the file into an Anaplan database. This is similar to Postgres and Snowflake'sCOPY INTOcommand.Command SummaryImport anaplan connectorfrom anaplanConnector import ConnectionIntialize the connectionBasic authenticationanaplan = Connection(authType='basic',email='email@example.com',password='SecurePassword',workspaceId='anaplanWorkspaceID',modelId='AnaplanModelID')Certificate authenticationanaplan = Connection(authType='certificate', privateCertPath='./AnaplanPrivateKey.pem', publicCertPath='./AnaplanPublicKey.pem', workspaceId='anaplanWorkspaceID', modelId='AnaplanModelID')There are two auth types: "basic" and "certificate". If basic is supplied, then the fields "email" and "password" are required. If "certificate" is supplied, then the fields "privateCertPath" and "publicCertPath" are required.Multiple workspaceIds and modelIds can be used by doing one of the following:Change the ids directly:anaplan.workspaceId = 'NewWorkspaceId'anpalan.modelId = 'NewModelId'Make new initialization of the connector:anaplanModel1 = Connection(email='email@example.com',password='SecurePassword',workspaceId='anaplanWorkspaceID',modelId='AnaplanModelID')
    
anaplanModel2 = Connection(email='email@example.com',password='SecurePassword',workspaceId='anaplanWorkspaceID2',modelId='AnaplanModelID2')Get a list of Workspacesworkspaces = anaplan.getWorkspaces()Get a list of Modelsmodels = anaplan.getModels()Get a list of filesfiles = anaplan.getFiles()Get the fileId from a filenamefileId = anaplan.getFileIdByFilename(filename)Load a fileanaplan.loadFile(filepath,fileId)filepath = The local location and filename of the file to load (e.g. '/home/fileToLoad.csv')fileId = The Anaplan file ID which can be found by running one of the above commandsGet a list of processesprocesses = anaplan.getProcesses()Get a processId from a process nameprocessId = anaplan.getProcessIdByName(processName)Run a processanaplan.runProcess(processId)Get a list of exportsexports = anaplan.getExports()Get an exportId from an export nameexportId = anaplan.getExportIdByName(exportName)Export dataanaplan.export(exportId, filepath)exportId = is Anaplan's Export ID that can be found with the above commandsfilepath = is the location and filename of where you want to save the file (e.g. '/home/export.csv')encoding (optional) = is the character encoding of the export file (default is utf-8)Process ExamplesLoad data into Anaplanfrom anaplanConnector import Connection

anaplan = Connection(authType='basic',email='email@example.com',password='SecurePassword',workspaceId='anaplanWorkspaceID',modelId='AnaplanModelID')

filepath = '/tmp/dataToLoad.csv'

anaplan.loadFile(filepath,anaplan.getFileIdByFilename('ExampleFile.csv'))

anaplan.runProcess(anaplan.getProcessIdByName('Import Data'))Export data from Anaplanfrom anaplanConnector import Connection

anaplan = Connection(authType='basic',email='email@example.com',password='SecurePassword',workspaceId='anaplanWorkspaceID',modelId='AnaplanModelID')

filepath = '/tmp/LocalExportedData.csv'

anaplan.export(anaplan.getExportIdByName('ExportedData.csv'), filepath)List of features that are currently being developedScript to create the public and private pem keys from the .p12 file.