odbcsv

Crates.ioodbcsv
lib.rsodbcsv
version1.0.12
sourcesrc
created_at2020-08-15 12:52:07.076422
updated_at2024-11-19 18:16:50.221455
descriptionQuery an ODBC data source and print the result as csv.
homepage
repositoryhttps://github.com/pacman82/odbcsv/tree/main
max_upload_size
id276970
size2,340,835
Markus Klein (pacman82)

documentation

https://docs.rs/odbcsv/

README

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 prebuilt binaries

You can download the latest binaries here from the GitHub release: https://github.com/pacman82/odbcsv/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 18 for SQL Server};Server=localhost;UID=SA;PWD=My@Test@Password1;" \
"SELECT title, year from Movies"

Specify user and password independently

odbcsv query \
--output query.csv \
--connection-string "Driver={ODBC Driver 18 for SQL Server};Server=localhost;" \
--user "SA" \
--password "My@Test@Password1" \
"SELECT title, year from Movies"

Alternatively you may also specify the ODBC_USER and ODBC_PASSWORD environment variable.

Query using data source name

odbcsv query \
--output query.csv \
--dsn my_db \
--password "My@Test@Password1" \
--user "SA" \
"SELECT * FROM Birthdays"

Use parameters in query

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

Insert data from CSV to database

odbcsv insert \
--input birthdays.csv \
--connection-string "Driver={ODBC Driver 18 for SQL Server};Server=localhost;UID=SA;PWD=My@Test@Password1;" \
Birthdays \

Use --help to see all options.

Commit count: 0

cargo fmt