# How to avoid Rust driver's prepared values limit

**URL:** <https://forum.scylladb.com/t/how-to-avoid-rust-drivers-prepared-values-limit/988>\
**Category:** ScyllaDB\
**Created:** [November 8, 2023, 2:34pm UTC](https://forum.scylladb.com/t/how-to-avoid-rust-drivers-prepared-values-limit/988 "2023-11-08T14:34:04Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![veenroid](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.scylladb.com/veenroid/32/499_2.png) [@veenroid](https://forum.scylladb.com/u/veenroid)\
**Post date:** [November 8, 2023, 2:34pm UTC](https://forum.scylladb.com/t/how-to-avoid-rust-drivers-prepared-values-limit/988/1 "2023-11-08T14:34:04Z")

</div>

The Rust driver’s session.execute seems to have a prepared values limited of 16. How does one use prepared statements to insert/update tables with numerous columns? For reference please see the update function below which includes 16 values. If I add one additional column, error[E0277] is surfaced.

```auto
pub async fn create(session: &Session, user: &User) -> Result<()> {
    let query = "INSERT INTO users (user_id, username, default_group_id, email, first_name, is_deleted, is_email_verified, is_phone_verified, is_public_profile, is_vendor, last_name, phone, profile_image, time_zone_id, create_on, last_seen_on, updated_on) VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)";
    let prepared = session.prepare(query).await?;
    session
        .execute(
            &prepared,
            (
                user.user_id,
                &user.username,
                user.default_group_id,
                &user.email,
                &user.first_name,
                user.is_deleted,
                user.is_verified,
                user.is_public_profile,
                user.is_vendor,
                &user.last_name,
                &user.phone,
                &user.profile_image,
                user.time_zone_id,
                &user.create_on,
                &user.last_seen_on,
                &user.updated_on,
            ),
        )
        .await?;
    Ok(())
}

```

---

<div class="post-metadata">

**Author:** ![Lorak](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.scylladb.com/lorak/32/374_2.png) [@Lorak](https://forum.scylladb.com/u/Lorak)\
**Post date:** [November 12, 2023, 6:19pm UTC](https://forum.scylladb.com/t/how-to-avoid-rust-drivers-prepared-values-limit/988/2 "2023-11-12T18:19:27Z")

</div>

`Session::execute` accepts anything that implements `ValueList` (warning: there is ongoing refactor, so soon the trait will be a bit different - but it doesn’t really matter in this case).  
Apart from tuples (up to length 16), there are implementations for slice and Vec, so you could use an array and pass it as slice - the problem is that arrays, unlike tuples, need to have all elements of the same type. To solve it, use `CqlValue` enum.

Alternative solution would be to use our `ValueList` derive macro to implement `ValueList` trait for your struct - then you could just pass your struct to `execute`.

---

<div class="post-metadata">

**Author:** ![veenroid](https://sea2.discourse-cdn.com/flex016/user_avatar/forum.scylladb.com/veenroid/32/499_2.png) [@veenroid](https://forum.scylladb.com/u/veenroid)\
**Post date:** [November 14, 2023, 12:37am UTC](https://forum.scylladb.com/t/how-to-avoid-rust-drivers-prepared-values-limit/988/3 "2023-11-14T00:37:46Z")

</div>

That’s exactly the information this newby needed. With your instruction, I found the relevant information and examples in the driver documentation.  
[Query values | ScyllaDB Docs](https://rust-driver.docs.scylladb.com/stable/queries/values.html)  
Many thanks!
