Batch data sync example
Overview
This example will take you through the creation and execution of a batch data sync where data will be loaded into the Cinchy via a CSV. In this example, we will be loading information into the People table in Cinchy. This is a self-contained example you can recreate in any Cinchy environment without dependencies.
Use Case: You have historically maintained a record of all your employees in a spreadsheet. Knowing that this significantly hinders your data and data management capabilities, you want to sync your file into Cinchy. Once synced, you can manage your employee information through the Cinchy data browser, instead of through a data silo.
For more information, see the documentation on Delimited File Sources.
Sample files and code
This section contains:
The People Table XML schema.
A sample source CSV data file to load into Cinchy.
Cinchy Table XML
To create the People table used in this example, you can use the below is the XML. You can also create the table manually, as shown in the section below.
Manual table creation
Log in to your Cinchy platform.
From under My Network, click the create button.
Select Table.
Select From Scratch.
Create a table with the following properties (Image 1):
Select Columns in the left hand navigation to create the columns for the table.
Select the "Click Here to Add" button and add the following columns:
Select Save to save your table.
Data file
You can download the sample CSV file used in this example below.
If you are downloading this file to recreate this exercise, the file path and the file name must be the following:
C:\Data\contacts.csv
You can also update the path
parameter in the data sync configuration to match the file path and name of your choosing.
The source file contains the following information which will sync into the target Cinchy table (Image 2).
As we can see, the file has the following columns:
First Name
Last Name
Email Address
Title
Company
The People table created only has the following columns:
Name
Title
Company
When syncing the data from the source (CSV file) to the target (Cinchy People table), the batch data sync must consider the following:
The first and last name from the source must merge into one column in the target (Name).
The email address from the sources isn't a column in the target, so this column won't sync into the target.
The title column will be an exact match from source to target.
The company column will also be an exact match from source to target.
Create the data sync
You have two options when you create a data sync in Cinchy:
You can input all of your necessary information through the intuitive Connections UI. Once saved, all of this data is uploaded as an XML into the Data Sync configurations table.
You can bypass the UI and upload your XML config directly into the Data Sync configuration table.
This example will walk you through option one.
Use the Connections UI
Within your Cinchy platform, navigate to the Connections Experience (Image 3).
In the Info tab, input the name of your data sync. This example uses "Contact Import" (Image 4).
Since this is a local file upload, we also need to set a Parameter. This value will be referenced in the "path" value of the Load Metadata box in step 5. For this example, we will set it to
filepath
(Image 5).
Navigate to the Source tab. This example uses the .CSV file you downloaded at the beginning of this example as our source.
Under Select a Source, select Delimited File (Image 6).
The "Load Metadata" box will appear; this is where you will define some important values about your source needed for the data sync to execute. Using the below table as your guide, fill in your metadata parameters (Image 7):
Click Load.
In the Available Columns pop-up, select all of the columns that you want to import from the CSV. For this example, we will select them all (noting, however, that we will only map a few of them later) (Image 8).
Click Load.
Once you load your source, the schema section of the page will auto populate with the columns that you selected in step 7 (Image 9). Review the schema to ensure it has the correct Name and Data Type. You may also choose to set any Aliases or add a Description.
Navigate to the Destination tab and select Cinchy Table from the drop down.
In the Load Metadata pop-up, input the Domain and Table name for your destination. This example uses the
Sandbox
domain and thePeople
table (Image 10).Select Load Metadata.
Select the columns that you wish to use in your data sync (Image 11). These will be the columns that your source syncs to. This example uses the Name, Title, and Company columns. Note that you will have many Cinchy system table available to use as well. Click Load.
The Connections experience will attempt to automatically map your source and destination columns based on matching names. In the below screenshot, it matched the "Company" and "Title" columns (Image 12). The "Name" target column isn't an exact match for any of the source columns, so you must match that one manually.
Select "First Name" from the Source Column drop down to finish mapping our data sync (Image 13).
Navigate to the Sync Actions tab. Sync actions have two options: Full File and Delta. In this example, select Full File.
Full load processing means that the entire amount of data is imported iteratively the first time a data source is loaded into the data studio. Delta processing means loading the data incrementally, loading the source data at specific pre-established intervals.
Set the following parameters (Image 14):
Navigate to the Permissions tab. Here you will define your group access controls for your data sync (Image 15). You can set this how you like. This example gives all users access to Execute, Write, and Read our sync.
Any groups given Admin Access will have the ability to Execute, Write, and Read the data sync.
Navigate to the Jobs tab. Here you will see a record of all successful or failed jobs for this data sync.
Select "Start a Job" (Image 16).
Load your sample .CSV file in the pop-up window (Image 17).
The job will commence. The Execution window that pops up will help you to verify that your data sync is progressing (Image 18).
Navigate to your destination table to ensure that your data populated correctly (Image 19).
Use a data sync XML
Instead of the Connections UI, you can also set up a data sync by uploading a formatted XML into the Data Sync Configs table within Cinchy.
We recommend only doing so once you have an understanding of how data syncs work. Not all sources/targets follow the same XML pattern.
The example below is the completed batch data sync configuration. Review the XML and then refer to the filled XML example.
Blank XML example
The below XML shows a blank data sync for a Delimited File source to a Cinchy Table target.
Filled XML example
The below filled XML example matches the Connections UI configuration made in Use the Connections UI. You can review the parameters used in the table below.
Using the data sync XML
Once you have completed your Data Sync XML, navigate to the Data Sync Configurations table in Cinchy (Image 20).
In a new row, paste the Data Sync XML into the Config XML column (Image 21).
Define your group permissions in the applicable columns. This example gives all Users the Admin Access*.*
The Name and Config Version columns will be auto populated as they values are coming from the Config XML.
Tip: Click on the below image to enlarge it.
Be sure when you are pasting into the Config XML column that you double click into the column before pasting, otherwise each line of the XML will appear as an individual record in the Data Sync Configurations table.
To execute your Data Sync you will use the CLI. If you don't have this downloaded, refer to the CLI commands list page.
In this example we will be using the following Data Sync Commands, however, for the full list of commands click here.
Launch PowerShell and navigate to the Cinchy CLI directory.
Enter and execute the following into PowerShell:
Once executed, navigate to your destination table to validate that your data synced correctly (Image 22).
Appendix
Password encryption
The following tables show the necesary information to encrypt a password from the CLI.
Actions
Arguments
Example
Execution Log table
The Execution Log table is a system table in Cinchy that logs the outputs of all data syncs (Image 23). You can always review the entries in this table for information on the progression of your syncs.
Execution Error table
The Execution Errors table is a system table in Cinchy that logs any errors that may occur in a data sync (Image 24). Any data sync errors log to the temp directory outlined in the data sync execution command. For example, -d "C:\Cinchy\temp"
.
Last updated