Migrate from CSV file to Oracle NoSQL Database
This example shows the usage of Oracle NoSQL Database Migrator to copy data from a CSV file to Oracle NoSQL Database.
Example
After evaluating multiple options, an organization finalizes Oracle NoSQL Database as its NoSQL Database platform. As its source contents are in CSV file format, they are looking for a way to migrate them to Oracle NoSQL Database.
In this example, you will learn to migrate the data from a CSV file called course.csv
, which contains information about various courses offered by a university. You generate the configuration file from the runMigrator
utility.
You can also prepare the configuration file with the identified source and sink details. See Sources and Sinks.
- Identify the source and sink for the migration.
- Source: CSV file
In this example, the source file is
course.csv
cat [~/nosql-migrator-1.5.0]/course.csv 1,"Computer Science", "San Francisco", "2500" 2,"Bio-Technology", "Los Angeles", "1200" 3,"Journalism", "Las Vegas", "1500" 4,"Telecommunication", "San Francisco", "2500"
- Sink: Oracle NoSQL Database
- Source: CSV file
- The CSV file must conform to the
RFC4180
format. - Create a file containing the DDL commands for the schema of the target table,
course
. The table definition must match the CSV data file concerning the number of columns and their types.In this example, the DDL file is
mytable_schema.ddl
cat [~/nosql-migrator-1.5.0]/mytable_schema.ddl create table course (id INTEGER, name STRING, location STRING, fees INTEGER, PRIMARY KEY(id));
course.csv
to Oracle NoSQL Database Service, perform the following steps:
java -jar lib/sql.jar -helper-hosts localhost:5000 -store kvstore
sql-> select * from course;
{"id":4,"name":"Telecommunication","location":"San Francisco","fees":2500}
{"id":1,"name":"Computer Science","location":"San Francisco","fees":2500}
{"id":2,"name":"Bio-Technology","location":"Los Angeles","fees":1200}
{"id":3,"name":"Journalism","location":"Las Vegas","fees":1500}
4 rows returned