A simple, un-prepared query.
| 330 | |
| 331 | |
| 332 | class SimpleStatement(Statement): |
| 333 | """ |
| 334 | A simple, un-prepared query. |
| 335 | """ |
| 336 | |
| 337 | def __init__(self, query_string, retry_policy=None, consistency_level=None, routing_key=None, |
| 338 | serial_consistency_level=None, fetch_size=FETCH_SIZE_UNSET, keyspace=None, |
| 339 | custom_payload=None, is_idempotent=False): |
| 340 | """ |
| 341 | `query_string` should be a literal CQL statement with the exception |
| 342 | of parameter placeholders that will be filled through the |
| 343 | `parameters` argument of :meth:`.Session.execute()`. |
| 344 | |
| 345 | See :class:`Statement` attributes for a description of the other parameters. |
| 346 | """ |
| 347 | Statement.__init__(self, retry_policy, consistency_level, routing_key, |
| 348 | serial_consistency_level, fetch_size, keyspace, custom_payload, is_idempotent) |
| 349 | self._query_string = query_string |
| 350 | |
| 351 | @property |
| 352 | def query_string(self): |
| 353 | return self._query_string |
| 354 | |
| 355 | def __str__(self): |
| 356 | consistency = ConsistencyLevel.value_to_name.get(self.consistency_level, 'Not Set') |
| 357 | return (u'<SimpleStatement query="%s", consistency=%s>' % |
| 358 | (self.query_string, consistency)) |
| 359 | __repr__ = __str__ |
| 360 | |
| 361 | |
| 362 | class PreparedStatement(object): |
no outgoing calls