Query an ODBC data source and output the result as CSV or to insert from CSV into an ODBC data source.
Several installation options are available.
You can download the latest binaries here from the odbc-api
GitHub release: https://github.com/pacman82/odbc-api/releases/latest.
shell
cargo install odbcsv
shell
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"
bash
odbcsv query \
--output query.csv \
--dsn my_db \
--password "<YourStrong@Passw0rd>" \
--user "SA" \
"SELECT * FROM Birthdays"
shell
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
shell
odbcsv insert \
--input birthdays.csv \
--connection-string "Driver={ODBC Driver 17 for SQL Server};Server=localhost;UID=SA;PWD=<YourStrong@Passw0rd>;" \
Birthdays \
Use --help
to see all options.