File tree Expand file tree Collapse file tree 1 file changed +42
-0
lines changed
Expand file tree Collapse file tree 1 file changed +42
-0
lines changed Original file line number Diff line number Diff line change 11# sql-exporter
2+
3+ [ ![ Build Status] ( https://travis-ci.org/inloop/sql-exporter.svg?branch=master )] ( https://travis-ci.org/inloop/sql-exporter )
4+
25Command line utility to export data from SQL database
6+
7+ # Installation
8+
9+ Basically download binary, make it executable and that's it.
10+
11+ ```
12+ # macos example
13+ # releases: https://github.com/inloop/sql-exporter/releases
14+ curl -L https://github.com/inloop/sql-exporter/releases/download/0.1.3/sql-exporter-darwin-amd64 > /usr/local/bin/sql-exporter
15+ chmod +x /usr/local/bin/sql-exporter
16+ ```
17+
18+ # Usage
19+
20+ ```
21+ sql-exporter dump -u postgres://username:password@hostname/database?sslmode=required -q "SELECT * FROM table" -o output.csv
22+
23+ # more info by running `sql-exporter dump -h`
24+
25+ USAGE:
26+ sql-exporter dump [command options]
27+
28+ OPTIONS:
29+ -u value, --db-url value database connection string ({type}://{username}:{password}@{host}/{db}) [$DATABASE_URL]
30+ -q value, --query value SQL query as source for csv data [$QUERY]
31+ -o value, --output value output file name (if not specified, stdout is used) [$OUTPUT]
32+ ```
33+
34+ You can also use pipes by omitting ` -o ` attribute:
35+
36+ ```
37+ sql-exporter dump -u postgres://username:password@hostname/database?sslmode=required -q "SELECT * FROM table" | grep "blah" > output.csv
38+ ```
39+
40+ ## Docker usage
41+
42+ ```
43+ docker run --rm inloopx/sql-exporter sql-exporter dump -u postgres://username:password@hostname/database?sslmode=required -q "SELECT * FROM table" > output.csv
44+ ```
You can’t perform that action at this time.
0 commit comments