Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Kseleven/psql2csv

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Psql2csv

A postgresql tool,support export psql data to csv and import csv back to psql.

Feature

Support dataType:

  • text
  • bigint
  • boolean
  • text[]
  • numeric
  • inet
  • timestamp

Usage

clone source:

git clone https://github.com/Kseleven/psql2csv.git
go run cmd/pg2csv.go --help

install

go install github.com/Kseleven/psql2csv@latest
pg2csv --help

export and import tables:

  1. configuration file is below examples path,copy and modify it,then execute command below:

    go run cmd/pg2csv.go -f {yourpath}/examples/example.json
  2. You wil get table.csv files in "exportPath" specified in example.json.

  3. Change parameter "action" in example.json to "import", and modify new database config

  4. Execute command to import csv to new database

        go run cmd/pg2csv.go -f {yourpath}/examples/example.json
  5. If new database column is diff with csv header, it will print different column. Then you should add or delete csv header to keep same with new database column.

  6. After modify csv header and data, execute import command again.

About

A postgresql data migration tool to export table to csv,and import csv to database.

Resources

License

Stars

0 stars

Watchers

1 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages