https://github.com/inloop/sql-exporter
Command line utility to export data from SQL database
https://github.com/inloop/sql-exporter
Last synced: 6 months ago
JSON representation
Command line utility to export data from SQL database
- Host: GitHub
- URL: https://github.com/inloop/sql-exporter
- Owner: inloop
- License: mit
- Created: 2018-06-14T13:18:35.000Z (over 7 years ago)
- Default Branch: master
- Last Pushed: 2018-08-01T14:44:14.000Z (over 7 years ago)
- Last Synced: 2025-05-20T19:29:23.854Z (8 months ago)
- Language: Go
- Size: 13.7 KB
- Stars: 1
- Watchers: 7
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# sql-exporter
[](https://travis-ci.org/inloop/sql-exporter)
Command line utility to export data from SQL database
# Installation
Basically download binary, make it executable and that's it.
```
# macos example
# releases: https://github.com/inloop/sql-exporter/releases
curl -L https://github.com/inloop/sql-exporter/releases/download/0.1.4/sql-exporter-darwin-amd64 > /usr/local/bin/sql-exporter
chmod +x /usr/local/bin/sql-exporter
```
# Usage
```
sql-exporter dump -u postgres://username:password@hostname/database?sslmode=required -q "SELECT * FROM table" -o output.csv
# more info by running `sql-exporter dump -h`
USAGE:
sql-exporter dump [command options]
OPTIONS:
-u value, --db-url value database connection string ({type}://{username}:{password}@{host}/{db}) [$DATABASE_URL]
-q value, --query value SQL query as source for csv data [$QUERY]
-o value, --output value output file name (if not specified, stdout is used) [$OUTPUT]
```
You can also use pipes by omitting `-o` attribute:
```
sql-exporter dump -u postgres://username:password@hostname/database?sslmode=required -q "SELECT * FROM table" | grep "blah" > output.csv
```
## Docker usage
```
docker run --rm inloopx/sql-exporter sql-exporter dump -u postgres://username:password@hostname/database?sslmode=required -q "SELECT * FROM table" > output.csv
```