#qldb #amazon #database #driver #async

qldb

Driver for Amazon’s QLDB Database implemented in pure rust

14 releases (3 stable)

new 1.0.2 Jun 19, 2021
0.6.3 May 6, 2021
0.6.1 Mar 25, 2021
0.5.1 Dec 18, 2020
0.4.1 Nov 18, 2020

#123 in Database interfaces

Download history 32/week @ 2021-02-25 44/week @ 2021-03-04 84/week @ 2021-03-11 82/week @ 2021-03-18 90/week @ 2021-03-25 17/week @ 2021-04-01 68/week @ 2021-04-08 36/week @ 2021-04-15 55/week @ 2021-04-22 14/week @ 2021-04-29 57/week @ 2021-05-06 40/week @ 2021-05-13 52/week @ 2021-05-20 10/week @ 2021-05-27 15/week @ 2021-06-03 43/week @ 2021-06-10

191 downloads per month

Apache-2.0/MIT

51KB
998 lines

Amazon's QLDB Driver

Driver for Amazon's QLDB Database implemented in pure rust.

Documentation Crates.io

The driver is fairly tested and should be ready to test in real projects. We are using it internally, so we will keep it updated.

Example

use qldb::QldbClient;
use std::collections::HashMap;

let client = QldbClient::default("rust-crate-test", 200).await?;

let mut value_to_insert = HashMap::new();
// This will insert a documents with a key "test_column"
// with the value "IonValue::String(test_value)"
value_to_insert.insert("test_column", "test_value");

client
    .transaction_within(|client| async move {   
        client
            .query("INSERT INTO TestTable VALUE ?")
            .param(value_to_insert)
            .execute()
            .await?;
        Ok(())
    })
    .await?;

Session Pool

The driver has a session pool. The second parameter in the QldbClient::default is the maximun size of the connection pool.

The pool will be auto-populated as parallel transaction are being requested until it reaches the provided maximum.

Test

For tests you will need to have some AWS credentials in your PC (as env variables or in ~/.aws/credentials). There needs to be a QLDB database with the name "rust-crate-test" in the aws account. The tests need to be run sequentially, so in order to run the tests please run the following command:

RUST_TEST_THREADS=1 cargo test

Dependencies

~18MB
~409K SLoC