In addition to tabular flat files, it is also common to load data to Anaplan from relational databases. This tutorial will demonstrate how to create a Chain to query a live sample relational database via a SQL query and load the data to Anaplan as an Import Data Source.
Step 1: Create a New OneCloud Chain
From OneCloud Home select the DEV environment.
Add a new Chain and name it "Upload SQL Query to Anaplan".
Save the Chain.
Step 2: Add a Command to query a database
Depending on the connection created in the previous tutorial, use the BizApp selector on the left to select either the Microsoft SQL Server or Oracle RDBMS | ADW BizApp and then select Execute Query. (Hint: use the Find tool to search for the BizApp and then search for "Execute Query".)
Add the Command Execute Query by dragging on to the pallet.
Select the new Command and drag it to the Start. The Chain Start will show a plus icon indicating that you can use that command as the start of the Chain.
Edit the Command and depending on the relational connection created, add one of the following SQL statements:
Use the copy command for the following syntax and only select one query depending on your selected relational connection.
Step 3: Add a command to upload the queried data to Anaplan
Add a second command to the Chain.
Select the Anaplan Upload Command. (Hint: use the Find tool to search for "Anaplan" and then search for "Upload File".)
Connect the "Execute Query" Command to the "Upload File".
Step 4: Configure the Command to upload the data to Anaplan
Edit the Command "Upload File".
Name the Command "Upload to Anaplan"
Set the Workspace parameter to the variable "anaplan-workspace". (select from variable list)
Set the Model parameter to the variable "anaplan-model". (select from variable list)
Set the Server file parameter to "Sample SQL Query".
Set the Source file parameter to the Response from the "Execute Query" Command "Result Set (CSV)". (select from variable list)
Set the Header records to "1".
Save the Command.
Step 5: Publish and Run the Chain
Before the Chain can be run, it needs to be published. Publishing is an import feature in OneCloud that enables Chains to be edited and only when they are ready are they actually published to run the commands.
Publish the chain and then click Execute to run the Chain. Learn more about publishing a Chain.
View the interactive outputs.
Step 6: Confirm the data in Anaplan
Login to Anaplan and find the Import Data Source "Sample SQL Query".