Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/jackc/csvtopg
csvtopg copies a CSV to a PostgreSQL database.
https://github.com/jackc/csvtopg
Last synced: 24 days ago
JSON representation
csvtopg copies a CSV to a PostgreSQL database.
- Host: GitHub
- URL: https://github.com/jackc/csvtopg
- Owner: jackc
- License: mit
- Created: 2020-03-31T18:42:57.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2024-08-21T21:01:04.000Z (3 months ago)
- Last Synced: 2024-08-22T18:21:56.694Z (3 months ago)
- Language: Go
- Size: 25.4 KB
- Stars: 4
- Watchers: 3
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 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)](https://github.com/jackc/pgtocsv) which simplifies exporting the result of a query as a CSV.