You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@cassandra.apache.org by Alex Ott <al...@gmail.com> on 2020/01/05 10:01:32 UTC

Re: How to know execute_async correctly?

Hi

There are several things here:

1. When you're executing query via execute_async, instead of ResultSet
   you're getting ResponseFuture instead.  Then you can use .result on it
   to obtain results of execution, or error.  Another possibility is to
   attach callbacks to that Future object.  See
   https://docs.datastax.com/en/developer/python-driver/3.20/getting_started/#asynchronous-queries
   for more details & examples.

2. You need to be very careful with using batches - if you just putting
   different queries there, then you're making your Cassandra slower, not
   faster. Please read
   https://docs.datastax.com/en/dse/6.0/cql/cql/cql_using/useBatch.html to
   understand when you can use them effectively


I recommend first to go through "Developing applications with DataStax
drivers" guide
(https://docs.datastax.com/en/devapp/doc/devapp/aboutDrivers.html) to get
understanding how to work with Cassandra using drivers.

lampahome  at "Thu, 12 Dec 2019 12:17:42 +0800" wrote:
 l> I tried to execute async by batch in python-driver. But I don't know how to check query executing correctly.

 l> Code is like below:
 l> B = BatchStatement()
 l> for x in xxx:
 l>     B.add(query, (args))
 l> res = session.execute_async(B)
 l> B.clear() # for reusing
 l> r = res.result()
 l> ## Then how to know my query works correctly? print(r)?

 l> I found no doc about my question in the page of ResultSet.
 l> Can anyone explain?

 l> thx



-- 
With best wishes,                    Alex Ott
Principal Architect, DataStax
http://datastax.com/

---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@cassandra.apache.org
For additional commands, e-mail: user-help@cassandra.apache.org