-
(Optional) Create an access token in MotherDuck and save it as the environment variable
motherduck_tokenas described at Authenticating to MotherDuck. If you skip this step, a browser window will open each time you connect, asking you to log in or confirm access.
-
Install the DuckDB ADBC driver:
dbc install duckdb
-
Customize
src/main.rsas needed- Change the database arguments in
opts- Set the path to the name of a MotherDuck database (prefixed with
md:), or keep it set tomd:sample_datato use MotherDuck's sample data
- Set the path to the name of a MotherDuck database (prefixed with
- Change the SQL SELECT statement in
statement.set_sql_query()to query the tables in your database
- Change the database arguments in
-
Run the Rust program:
cargo run
Note
If MotherDuck reports that you are not using a compatible DuckDB version, you can install the specific version it requires by running:
dbc install "duckdb=X.Y.Z"