#odbc #csv #sql

app odbcsv

Query an ODBC data source and print the result as csv

16 releases

new 0.3.6 Dec 3, 2020
0.3.5 Dec 2, 2020
0.3.4 Nov 21, 2020
0.2.4 Nov 11, 2020
0.1.4 Aug 30, 2020

#508 in Command line utilities

Download history 33/week @ 2020-08-13 16/week @ 2020-08-20 34/week @ 2020-08-27 34/week @ 2020-09-03 11/week @ 2020-09-10 2/week @ 2020-09-17 12/week @ 2020-09-24 7/week @ 2020-10-01 21/week @ 2020-10-15 7/week @ 2020-10-22 23/week @ 2020-10-29 57/week @ 2020-11-05 26/week @ 2020-11-12 45/week @ 2020-11-19 31/week @ 2020-11-26

94 downloads per month

MIT license

190KB
3K SLoC

ODBCSV

Query an ODBC data source and output the result as CSV or to insert from CSV into an ODBC data source.

Installation

Several installation options are available.

Download prebuild binaries

You can download the latest binaries here from the odbc-api GitHub release: https://github.com/pacman82/odbc-api/releases/latest.

Install using cargo

cargo install odbcsv

Usage

Querying an Microsoft SQL Database and storing the result in a file

odbcsv query \
--output query.csv \
--connection-string "Driver={ODBC Driver 17 for SQL Server};Server=localhost;UID=SA;PWD=<YourStrong@Passw0rd>;" \
"SELECT title, year from Movies"

Query using data source name

odbcsv query \
--output query.csv \
--dsn my_db \
--password "<YourStrong@Passw0rd>" \
--user "SA" \
"SELECT * FROM Birthdays"

Use parameters in query

odbcsv query \
--output query.csv \
--connection-string "Driver={ODBC Driver 17 for SQL Server};Server=localhost;UID=SA;PWD=<YourStrong@Passw0rd>;" \
"SELECT * FROM Birthdays WHERE year > ? and year < ?" \
1990 2010

Use --help to see all options.

Dependencies

~5.5MB
~82K SLoC