Query (SQL++)

class couchbase.n1ql.QueryError(record: _QueryProblemRecord)

An error the query service reported for a query.

code() → int

Get the service’s code for the problem.

Returns:

The service’s code for the problem.

Return type:

int

message() → str

Get the service’s description of the problem.

Returns:

The service’s description of the problem.

Return type:

str

class couchbase.n1ql.QueryMetaData(record: _QueryMetaDataRecord)

The metadata the query service returned with a query’s rows.

client_context_id() → str

Get the client context ID which is associated with the executed query.

Returns:

The client context ID which is associated with the executed query.

Return type:

str

errors() → list[QueryError]

Get errors that occurred during the execution of the query.

Returns:

Any errors that occurred during the execution of the query.

Return type:

list[QueryError]

metrics() → QueryMetrics | None

Get the various metrics which are made available by the query engine.

Returns:

The query’s metrics, if the service sent them.

Return type:

QueryMetrics | None

profile() → str | int | float | bool | None | Mapping[str, Any] | Sequence[Any]

Get the various profiling details that were generated during execution of the query.

Returns:

Profiling details.

Return type:

JSONType | None

request_id() → str

Get the request ID which is associated with the executed query.

Returns:

The request ID which is associated with the executed query.

Return type:

str

signature() → str | int | float | bool | None | Mapping[str, Any] | Sequence[Any]

Get the signature of the query.

Returns:

The signature of the query.

Return type:

JSONType | None

status() → QueryStatus

Get the status of the query at the time the query metadata was generated.

Returns:

The status of the query at the time the query metadata was generated.

Return type:

QueryStatus

warnings() → list[QueryWarning]

Get warnings that occurred during the execution of the query.

Returns:

Any warnings that occurred during the execution of the query.

Return type:

list[QueryWarning]

class couchbase.n1ql.QueryMetrics(record: _QueryMetricsRecord)

The metrics the query service reported for a query.

elapsed_time() → timedelta

Get the total amount of time spent running the query.

Returns:

The total amount of time spent running the query.

Return type:

timedelta

error_count() → UnsignedInt64

Get the total number of errors which were encountered during the execution of the query.

Returns:

The total number of errors which were encountered during the execution of the query.

Return type:

UnsignedInt64

execution_time() → timedelta

Get the total amount of time spent executing the query.

Returns:

The total amount of time spent executing the query.

Return type:

timedelta

mutation_count() → UnsignedInt64

Get the total number of rows which were altered by the query.

Returns:

The total number of rows which were altered by the query.

Return type:

UnsignedInt64

result_count() → UnsignedInt64

Get the total number of rows which were part of the result set.

Returns:

The total number of rows which were part of the result set.

Return type:

UnsignedInt64

result_size() → UnsignedInt64

Get the total number of bytes which were generated as part of the result set.

Returns:

The total number of bytes which were generated as part of the result set.

Return type:

UnsignedInt64

sort_count() → UnsignedInt64

Get the total number of rows which were part of the sorting for the query.

Returns:

The total number of rows which were part of the sorting for the query.

Return type:

UnsignedInt64

warning_count() → UnsignedInt64

Get the total number of warnings which were encountered during the execution of the query.

Returns:

The total number of warnings which were encountered during the execution of the query.

Return type:

UnsignedInt64

class couchbase.n1ql.QueryProfile(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Specifies the profiling mode for a query.

Warning

couchbase.cluster.QueryProfile is deprecated, and will be removed in a future release. Import QueryProfile from couchbase.n1ql.

OFF = 'off'
PHASES = 'phases'
TIMINGS = 'timings'
class couchbase.n1ql.QueryScanConsistency(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Represents the various scan consistency options that are available when querying against the query service.

Warning

couchbase.cluster.QueryScanConsistency is deprecated, and will be removed in a future release. Import QueryScanConsistency from couchbase.n1ql.

AT_PLUS = 'at_plus'
NOT_BOUNDED = 'not_bounded'
REQUEST_PLUS = 'request_plus'
class couchbase.n1ql.QueryStatus(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)

Represents the status of a query.

ABORTED = 'aborted'
CLOSED = 'closed'
COMPLETED = 'completed'
ERRORS = 'errors'
FATAL = 'fatal'
RUNNING = 'running'
STOPPED = 'stopped'
SUCCESS = 'success'
TIMEOUT = 'timeout'
UNKNOWN = 'unknown'
class couchbase.n1ql.QueryWarning(record: _QueryProblemRecord)

A warning the query service reported for a query.

code() → int

Get the service’s code for the problem.

Returns:

The service’s code for the problem.

Return type:

int

message() → str

Get the service’s description of the problem.

Returns:

The service’s description of the problem.

Return type:

str