Query options

This type is global
Name Type Description
autoPage Boolean

Determines if the driver must retrieve the following result pages automatically.

This setting is only considered by the Client#eachRow() method. For more information, check the paging results documentation.

captureStackTrace Boolean

Determines if the stack trace before the query execution should be maintained.

Useful for debugging purposes, it should be set to false under production environment as it adds an unnecessary overhead to each execution.

Default: false.
consistency Number

Consistency level.

Defaults to localOne for Apache Cassandra and DSE deployments. For DataStax Apollo, it defaults to localQuorum.

customPayload Object

Key-value payload to be passed to the server. On the Cassandra side, implementations of QueryHandler can use this data.

executeAs String

The user or role name to act as when executing this statement.

When set, it executes as a different user/role than the one currently authenticated (a.k.a. proxy execution).

This feature is only available in DSE 5.1+.

executionProfile String or ExecutionProfile

Name or instance of the profile to be used for this execution. If not set, it will the use “default” execution profile.

fetchSize Number

Amount of rows to retrieve per page.

hints Array or Array<Array>

Type hints for parameters given in the query, ordered as for the parameters.

For batch queries, an array of such arrays, ordered as with the queries in the batch.

host Host

The host that should handle the query.

Use of this option is heavily discouraged and should only be used in the following cases:

  1. Querying node-local tables, such as tables in the system and system_views keyspaces.
  2. Applying a series of schema changes, where it may be advantageous to execute schema changes in sequence on the same node.

Configuring a specific host causes the configured LoadBalancingPolicy to be completely bypassed. However, if the load balancing policy dictates that the host is at a distance of ignored or there is no active connectivity to the host, the request will fail with a NoHostAvailableError.

isIdempotent Boolean

Defines whether the query can be applied multiple times without changing the result beyond the initial application.

The query execution idempotence can be used at RetryPolicy level to determine if an statement can be retried in case of request error or write timeout.

Default: false.

keyspace String

Specifies the keyspace for the query. It is used for the following:

  1. To indicate what keyspace the statement is applicable to (protocol V5+ only). This is useful when the query does not provide an explicit keyspace and you want to override the current keyspace.
  2. For query routing when the query operates on a different keyspace than the current keyspace.
logged Boolean

Determines if the batch should be written to the batchlog. Only valid for Client#batch(), it will be ignored by other methods. Default: true.

counter Boolean

Determines if its a counter batch. Only valid for Client#batch(), it will be ignored by other methods. Default: false.

pageState Buffer or String

Buffer or string token representing the paging state.

Useful for manual paging, if provided, the query will be executed starting from a given paging state.

prepare Boolean

Determines if the query must be executed as a prepared statement.

readTimeout Number

When defined, it overrides the default read timeout (socketOptions.readTimeout) in milliseconds for this execution per coordinator.

Suitable for statements for which the coordinator may allow a longer server-side timeout, for example aggregation queries.

A value of 0 disables client side read timeout for the execution. Default: undefined.

retry RetryPolicy

Retry policy for the query.

This property can be used to specify a different retry policy to the one specified in the ClientOptions.policies.

routingIndexes Array

Index of the parameters that are part of the partition key to determine the routing.

routingKey Buffer or Array

Partition key(s) to determine which coordinator should be used for the query.

routingNames Array

Array of the parameters names that are part of the partition key to determine the routing. Only valid for non-prepared requests, it’s recommended that you use the prepare flag instead.

serialConsistency Number

Serial consistency is the consistency level for the serial phase of conditional updates. This option will be ignored for anything else that a conditional update/insert.

timestamp Number or Long

The default timestamp for the query in microseconds from the unix epoch (00:00:00, January 1st, 1970).

If provided, this will replace the server side assigned timestamp as default timestamp.

Use generateTimestamp() utility method to generate a valid timestamp based on a Date and microseconds parts.

traceQuery Boolean

Enable query tracing for the execution. Use query tracing to diagnose performance problems related to query executions. Default: false.

To retrieve trace, you can call Metadata.getTrace() method.

graphOptions Object

Default options for graph query executions.

These options are meant to provide defaults for all graph query executions. Consider using execution profiles if you plan to reuse different set of options across different query executions.

graphOptions.language String

The graph language to use in graph queries. Default: 'gremlin-groovy'.

graphOptions.name String

The graph name to be used in all graph queries.

This property is required but there is no default value for it. This value can be overridden at query level.

graphOptions.readConsistency Number

Overrides the consistency level defined in the query options for graph read queries.

graphOptions.readTimeout Number

Overrides the default per-host read timeout (in milliseconds) for all graph queries. Default: 0.

Use null to reset the value and use the default on socketOptions.readTimeout .

graphOptions.source String

The graph traversal source name to use in graph queries. Default: 'g'.

graphOptions.writeConsistency Number

Overrides the [consistency level]consistencies defined in the query options for graph write queries.