Skip to content
This repository was archived by the owner on Jun 16, 2022. It is now read-only.
23primePublic archive

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

9 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

db-csv

Import/Export DB table <-> CSV file.

Usage

Prepare

Install dependecies.

bundle config set path vendor/bundle
bundle install

Make .env and add DB_URL.

e.g.

DB_URL='postgres://<user>:<password>@<host>:<port>/<DB>'

DB table -> CSV file

bundle exec ruby src/db2csv.rb <table name>

If the table under a schema:

bundle exec ruby src/db2csv.rb <schema name>.<table name>

CSV file -> DB table

bundle exec ruby src/csv2db.rb <table name>

If the table under a schema:

bundle exec ruby src/csv2db.rb <schema name>.<table name>

Sync mode

If delete all and insert, add --sync option:

bundle exec ruby src/db2csv.rb <table name> --sync
bundle exec ruby src/csv2db.rb <table name> --sync

Note

CSV file must include column names.
And, exported CSV file include column names.

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Used by

Contributors

Languages