Where can I pass the fetch_size on a PreparedStatement in the Cassandra Python driver?

370 views Asked by At

I am trying to set the fetch_size on a PreparedStatement on Python for Cassandra driver 3.11.

I can see this is possible on SimpleStatement but I am having problems to find how to use it for PreparedStatement.

Since PreparedStatement is a result of Session.prepare(query) ... I don't know where to pass that param ... or it it's even possible.

1

There are 1 answers

0
Erick Ramirez On

You can simply set the fetch_size attribute on the PreparedStatement object. Here's an example:

    user_ps = session.prepare("SELECT * FROM users_by_email WHERE email = ?")
    user_ps.fetch_size = 100

Alternatively, it is possible to set a default for the session with:

    session.default_fetch_size = 100

For details, see the Session API Documentation. Cheers!