Skip to content

Latest commit

 

History

History
 
 

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

README.md

Connecting Rust and MotherDuck with ADBC

Instructions

Prerequisites

  1. Create a MotherDuck account

  2. Install Rust

  3. Install dbc

  4. (Optional) Create an access token in MotherDuck and save it as the environment variable motherduck_token as 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.

Connect to MotherDuck

  1. Install the DuckDB ADBC driver:

    dbc install duckdb
  2. Customize src/main.rs as needed

    • Change the database arguments in opts
      • Set the path to the name of a MotherDuck database (prefixed with md:), or keep it set to md:sample_data to use MotherDuck's sample data
    • Change the SQL SELECT statement in statement.set_sql_query() to query the tables in your database
  3. 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"