psql2csv

command module
v0.0.0-...-5ca05ed Latest Latest
Warning

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

Go to latest
Published: Sep 6, 2023 License: MIT Imports: 4 Imported by: 0

README

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.

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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