Query (SQL++)
- class couchbase.n1ql.QueryError(record: _QueryProblemRecord)
An error the query service reported for a query.
- 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:
- 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:
- 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:
- 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:
- 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:
- 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:
- 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:
- 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:
- 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:
- 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:
- 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:
- 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.QueryProfileis deprecated, and will be removed in a future release. ImportQueryProfilefromcouchbase.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.QueryScanConsistencyis deprecated, and will be removed in a future release. ImportQueryScanConsistencyfromcouchbase.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'