csvcommit

package module
v0.0.0-...-90784e3 Latest Latest
Warning

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

Go to latest
Published: Sep 9, 2020 License: BSD-2-Clause Imports: 6 Imported by: 0

README

csvcommit

A simple program to import csv files into an existing Oracle table. The input database table is compared to the input csv. If there are fields names in the csv that match field names in the database table, those fields are imported.

Much easier than SQL*Loader 😄

Be aware that this truncates the original database table

Usage

The csv needs to have a field list as the first row.

You need to set the flags in the below example. The autoincrementfield flag is optional.

csvcommit \
    -csv "./import_table.csv" \
    -conn "user/password@host/service" \
    -schema "my_schema" \
    -table "my_table" \
    -autoincrementfield "ID"

Installation

Install go and make sure you add $GOPATH/bin to your PATH.

Then build and install

go get github.com/andygarfield/csvcommit/...

Limitations

This is currently only working with VARCHAR, NVARCHAR2 and NUMBER types. Hoping to add more in the future.

Documentation

Index

Constants

View Source
const COMMITLEN = 500

COMMITLEN is the number of rows to be written per database transaction

Variables

This section is empty.

Functions

func Commit

func Commit(csv *csv.Reader, db *sql.DB, schema, table, autoIncrementField string)

Commit takes a CSV and imports it into an Oracle table. If the table needs a field to be auto-incrementing, include that field in autoIncrementField, otherwise use a blank string for that argument.

Types

This section is empty.

Directories

Path Synopsis
cmd

Jump to

Keyboard shortcuts

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