This page shows how to use Ultipa Manager and Ultipa Transporter-Importer to import data files into a GraphSet.
Graph data used in this article comply to the graph model as introduced in Prepare Graph
Data File
Prepare a CSV file for each schema in the graph model, which are CUSTOMER.csv, MERCHANT.csv and TRANSACTION.csv. (click to download)
- Columns led by headers
cust_no
in node file CUSTOMER.csv andmerchant_no
in node file MERCHANT.csv are system property_id
of node - The rest of columns are custom properties
- Columns led by headers
cust_no
andmerchant_no
in edge file TRANSACTION.csv are system properties_from
and_to
of edge - The rest of columns are custom properties
Import via Manager
- Create graphset and schemas before importing data
- Import nodes before importing edges
Step Breakdown (for node)
Take importing node file CUSTOMER.csv as an example, the operation includes 4 steps:
- Upload files
Use Import and '+ Node' to upload the CUSTOMER.csv from local path:
Use '+ Edge' in case of uploading edge file.
- Declare delimiter and header
Data files in this example use comma ',' as column delimiter and contain headers, use 'Preview' to check if the file is correctly parsed:
If your data file uses a different delimiter or has no headers, make sure they are properly configured in this step.
- Match header with graph model
- Select schema the data file represents, which is customer in this example
- In the header list, revise
cust_no
to_id
(the type becomes 'string' by itself)
(Below two steps are needed if some headers denote custom properties that are not created beforehand) - Select property type for the header
- Click the '+' in the bottom to create custom property for the header
A red triangle △ in front of a header indicates the header does not match with any property under this schema. This triangle will disappear if the header is renamed using an existing property, or a property is created for this header.
The header name will be blank if the file is configured as 'no header' in the previous step, hence the properties represented by headers should be filled one by one.
- Import
Choose import mode upsert or overwrite. As for importing new data, both modes work the same:
Repeat the above steps to import node file MERCHANT.csv. Make sure in step-3 select merchant as schema, and revise
merchant_no
to_id
.
Complete Demo (for edge)
Repeat the above steps to import edge file TRASACTION.csv. Make sure in step-1 click '+ Edge', in step-3 select transfer as schema, and revise cust_no
and merchant_no
to _from
and _to
.
Below is a complete demonstration of importing edge file TRASACTION.csv:
Verification
You should see a complete graph model with correct number of nodes and edges after a successful import:
Import via Transporter
Comparing with Manager, the import operation via Transporter-Importer has below highlights:
- is much faster
- allows importing multiple files in one command
- dose not require creating graphset or schema beforehand
- supports recognition of property types from file headers, such as:
The import operation via Transporter-Importer includes 2 steps:
- Prepare YML file
Declare information about Ultipa server and data files in a YML file. Below is part of the YML file:
nodeConfig:
- schema: "customer"
file: "./CUSTOMER2.csv"
- schema: "merchant"
file: "./MERCHANT2.csv"
edgeConfig:
- schema: "transfer"
file: "./TRANSACTION2.csv"
- Download the file package YML_CSV that contains the complete YML file and the data files with updated headers
- Extract this package and keep all the files in one folder
- Make sure you update the server information in the YML file with the one you deployed
See annotations about parameters in the YML file, or read more about the YML file in Import Config.
- Run Ultipa Importer in a command line tool
Place the Importer tool 'ultipa-importer' in the same folder with the extracted YML file and data files, run a command line tool under the same folder and execute command below:
./ultipa-importer --config ./import_retail.yml
Start a command line tool compatible with your system, e.g., right-click the blank space in the folder and click 'Open in Terminal' in an Ubantu system, or shift-right-click and 'Show More' and 'Open in Powershell' in a Windows system.
If message is received as
bash: ./ultipa-importer: Permission denied
when running the above command, it suggests that relevant execution privileges are not granted; runchmod +x ultipa-importer
to grant privileges required and run the command again.