Skip to content
/ csvtopg Public

csvtopg copies a CSV to a PostgreSQL database.

License

Notifications You must be signed in to change notification settings

jackc/csvtopg

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

5 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

csvtopg

csvtopg copies a CSV to a PostgreSQL database.

Why not just use psql and \copy?

  • csvtopg has easier syntax than \copy.
  • csvtopg will automatically create a table for the CSV data.
  • csvtopg will automatically detect common data types.

Installation

The Go tool chain must be installed.

$ go install github.com/jackc/csvtopg@latest

Configuring Database Connection

csvtopg supports the standard PG* environment variables. In addition, the -d flag can be used to specify a database URL.

Example usage

$ csvtocsv foo.csv

This will create a new table foo_csv and copy foo.csv to it.

Related

See also the sibling project pgtocsv) which simplifies exporting the result of a query as a CSV.

About

csvtopg copies a CSV to a PostgreSQL database.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages