In addition to tabular flat files, it is 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
Navigate to the "DEV" Environment of the "Sample Workspace for Anaplan".
💡 Workspaces is on the left-side navigation panel.
Select the "DEV" Environment.
Hover over the blue (+) icon near the lower-right corner. Click "Create a Chain".
Name the new Chain "Upload SQL Query to Anaplan".
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 BizApp. Then select Execute Query.
💡 Use the Find tool to search for the BizApp and then for "Execute Query".
Choose the EXECUTE QUERY Command by double-clicking the icon, which will auto-load the Command into the Chain Start circle.
📓 Alternatively, click-and-drag the icon onto the pallet. Then move the icon in the Chain Start circle. The Chain Start will show a plus (+) icon indicating that the command may be placed at the start of the Chain.
Double-click (or hover + click pencil icon) to edit the Execute Query Command.
Depending on the relational connection, add one of the SQL statements below:
SQL Server Query
select top 10 * from SAMPLE_DB.dbo.SIMPLE_FACT
Check "Preview Results".
Save the Command.
Step 3: Add a Command to Upload the Queried Data to Anaplan
Add a second command to the Chain.
Select the Anaplan "Upload File" Command.
💡 Use the Find tool to search for "Anaplan" and then for "Upload File".
Connect the "Execute Query" Command to the "Upload File".
Step 4: Configure the Command to Upload the Data to Anaplan
Double click (or hover + click pencil icon) to edit the Command "Upload File".
Name the Command "Upload to Anaplan"
Set the "Workspace" parameter by clicking the parameter box, then the 🔽 to the right of "Workspace" (on the left panel), and selecting "Anaplan-Workspace".
Set the "Model" parameter by clicking the parameter box, then the 🔽 to the right of "Workspace" (on the left panel), and selecting "Anaplan-Model".
Under "Server file" type "Sample SQL Query".
Set the "Source File" by clicking the parameter box, then the 🔽 to the right of "Execute Query" (on the left panel) and selecting "Result Set (CSV)".
Set the "Header records" parameter to "1".
Save the Command.
Step 5: Publish & Run the Chain
Publish ➡️ Execute ➡️ Run Chain.
To publish a Chain, click "Publish" near the upper-right corner.
Optionally, add a Publish Chain Comment. For this example, type "Added Transformations".
Once published, the "Execute" button becomes active. Click it.
Once executed, the "Run Chain" button is activated. Click it.
The Chain will animated when it is running.
Click on the Anaplan Upload File Command.
When the Chain has been run, the outputs will be available to view.
Step 6: Confirm the data in Anaplan
Login to Anaplan and find the Import Data Source "Sample SQL Query".
📚 Related Topics from this Section: