title: How do I configure and execute BatchStatement in Cassandra correctly?
body: <p>In my <strong>Python</strong> (<em>3.8</em>) application, I make a request to the <strong>Cassandra</strong> database via <a href="https://docs.datastax.com/en/developer/python-driver/3.24/" rel="nofollow noreferrer">DataStax Python Driver 3.24</a>.</p>
  <p>I have several CQL operations that I am trying to execute with a single query via <a href="https://docs.datastax.com/en/developer/python-driver/3.24/api/cassandra/query/#cassandra.query.BatchStatement" rel="nofollow noreferrer">BatchStatement</a> according to the official documentation. Unfortunately, my code causes an error with the following content:</p>
  <pre><code>&quot;errorMessage&quot;: &quot;retry_policy should implement cassandra.policies.RetryPolicy&quot;
  &quot;errorType&quot;: &quot;ValueError&quot;
  </code></pre>
  <p>As you can see from my code I set the value for the <code>reply_policy</code> attribute inside <code>BatchStatement</code>. Anyway my code raise error which you see above. What kind of value must be inside the <code>reply_policy</code> property? What is the reason for the current conflict?</p>
  <p><strong>Code Snippet</strong>:</p>
  <pre><code>from cassandra.cluster import Cluster, ExecutionProfile, EXEC_PROFILE_DEFAULT
  from cassandra.auth import PlainTextAuthProvider
  from cassandra.policies import DCAwareRoundRobinPolicy
  from cassandra import ConsistencyLevel
  from cassandra.query import dict_factory
  from cassandra.query import BatchStatement, SimpleStatement
  from cassandra.policies import RetryPolicy
  
  
  auth_provider = PlainTextAuthProvider(username=db_username, password=db_password)
  default_profile = ExecutionProfile(
     load_balancing_policy=DCAwareRoundRobinPolicy(local_dc=db_local_dc),
     consistency_level=ConsistencyLevel.LOCAL_QUORUM,
     request_timeout=60,
     row_factory=dict_factory
  )
  cluster = Cluster(
     db_host,
     auth_provider=auth_provider,
     port=db_port,
     protocol_version=4,
     connect_timeout=60,
     idle_heartbeat_interval=0,
     execution_profiles={EXEC_PROFILE_DEFAULT: default_profile}
  )
  session = cluster.connect()
  
  name_1, name_2, name_3  = &quot;Bob&quot;, &quot;Jack&quot;, &quot;Alex&quot;
  age_1, age_2, age_3 = 25, 30, 18
  
  cql_statement = &quot;INSERT INTO users (name, age) VALUES (%s, %s)&quot;
  
  batch = BatchStatement(retry_policy=RetryPolicy)
  batch.add(SimpleStatement(cql_statement, (name_1, age_1)))
  batch.add(SimpleStatement(cql_statement, (name_2, age_2)))
  batch.add(SimpleStatement(cql_statement, (name_3, age_3)))
  session.execute(batch)
  </code></pre>