import

command
v0.0.0-...-bcc76fe Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 15, 2019 License: MIT Imports: 11 Imported by: 0

README

Importing OneKey data from CSV to MongoDB

The script imports the data from the CSV file provided by the OneKy to a MongoDB instance. Before you run the import please double check the column standards below and change them if required!
The script can be run many times because on every run the data in MongoDB will be truncated

Dependency

This script requires a CSV file named file.csv located in data/static/file.csv. If you want to run the script against a new extraction simply replace the file.csv and re-run this script. Of course the other two scripts would have to be re-run as well.

Usage example

go run import.go

SRC_CUST_ID CUST_NAME FIRST_NAME LAST_NAME CITY CNTRY
WDEM01384440 MARY BOROWA MARY BOROWA HALSBRÜCKE GERMANY
WDEM00555739 LINA SCHMITZ LINA SCHMITZ HEINSBERG GERMANY
WDEM00555720 URLICH DARMOUL URLICH DARMOUL SENFTENBERG GERMANY

The order of the columns doesn't matter but the column naming matters! The above example contains all needed columns and it's a MUST! There can be more columns attached but they will be simply ignored by the script.

WARNING!

REMEMBER TO NORMALIZE THE COUNTRIES IN THE CSV FILE TO FOLLOW THE COUNTRIES IN THE MYSQL DATABASE (location.country_name table)! FOR EXAMPLE CHANGE 'DEU' TO 'GERMANY', 'PL' TO 'POLAND', ETC

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL