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

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.



Solution 1:[1]

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!

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Erick Ramirez