MCPcopy Index your code
hub / github.com/apache/cassandra-python-driver / execute

Method execute

cassandra/cluster.py:2599–2642  ·  view source on GitHub ↗

Execute the given query and synchronously wait for the response. If an error is encountered while executing the query, an Exception will be raised. `query` may be a query string or an instance of :class:`cassandra.query.Statement`. `parameters` may be a se

(self, query, parameters=None, timeout=_NOT_SET, trace=False,
                custom_payload=None, execution_profile=EXEC_PROFILE_DEFAULT,
                paging_state=None, host=None, execute_as=None)

Source from the content-addressed store, hash-verified

2597 self.session_id))
2598
2599 def execute(self, query, parameters=None, timeout=_NOT_SET, trace=False,
2600 custom_payload=None, execution_profile=EXEC_PROFILE_DEFAULT,
2601 paging_state=None, host=None, execute_as=None):
2602 """
2603 Execute the given query and synchronously wait for the response.
2604
2605 If an error is encountered while executing the query, an Exception
2606 will be raised.
2607
2608 `query` may be a query string or an instance of :class:`cassandra.query.Statement`.
2609
2610 `parameters` may be a sequence or dict of parameters to bind. If a
2611 sequence is used, ``%s`` should be used the placeholder for each
2612 argument. If a dict is used, ``%(name)s`` style placeholders must
2613 be used.
2614
2615 `timeout` should specify a floating-point timeout (in seconds) after
2616 which an :exc:`.OperationTimedOut` exception will be raised if the query
2617 has not completed. If not set, the timeout defaults to the request_timeout of the selected ``execution_profile``.
2618 If set to :const:`None`, there is no timeout. Please see :meth:`.ResponseFuture.result` for details on
2619 the scope and effect of this timeout.
2620
2621 If `trace` is set to :const:`True`, the query will be sent with tracing enabled.
2622 The trace details can be obtained using the returned :class:`.ResultSet` object.
2623
2624 `custom_payload` is a :ref:`custom_payload` dict to be passed to the server.
2625 If `query` is a Statement with its own custom_payload. The message payload
2626 will be a union of the two, with the values specified here taking precedence.
2627
2628 `execution_profile` is the execution profile to use for this request. It can be a key to a profile configured
2629 via :meth:`Cluster.add_execution_profile` or an instance (from :meth:`Session.execution_profile_clone_update`,
2630 for example
2631
2632 `paging_state` is an optional paging state, reused from a previous :class:`ResultSet`.
2633
2634 `host` is the :class:`cassandra.pool.Host` that should handle the query. If the host specified is down or
2635 not yet connected, the query will fail with :class:`NoHostAvailable`. Using this is
2636 discouraged except in a few cases, e.g., querying node-local tables and applying schema changes.
2637
2638 `execute_as` the user that will be used on the server to execute the request. This is only available
2639 on a DSE cluster.
2640 """
2641
2642 return self.execute_async(query, parameters, trace, custom_payload, timeout, execution_profile, paging_state, host, execute_as).result()
2643
2644 def execute_async(self, query, parameters=None, trace=False, custom_payload=None,
2645 timeout=_NOT_SET, execution_profile=EXEC_PROFILE_DEFAULT,

Callers 15

set_keyspaceMethod · 0.95
mainFunction · 0.45
get_server_versionsFunction · 0.45
execute_until_passFunction · 0.45
validate_ssl_optionsFunction · 0.45
_insertMethod · 0.45

Calls 2

execute_asyncMethod · 0.95
resultMethod · 0.80