Skip to content

Commit d8fa031

Browse files
committed
PYCBC-1693: Add CollectionQueryIndexManager to API reference
Motivation ========== CollectionQueryIndexManager is the preferred API to manage query indexes in clusters with collection support (which is now all supported server versions). We should include that API in the reference. Changes ======= * Add CollectionQueryIndexManager to the API reference. * Update options docs to link to CollectionQueryIndexManager in collection_name/scope_name deprecation notices. Change-Id: Ib74459b6b25d9e7ac4c504c7d4510d28d5f640a9 Reviewed-on: https://review.couchbase.org/c/couchbase-python-client/+/230505 Reviewed-by: Jared Casey <jared.casey@couchbase.com> Tested-by: Build Bot <build@couchbase.com>
1 parent 079fc07 commit d8fa031

3 files changed

Lines changed: 35 additions & 15 deletions

File tree

couchbase/management/options.py

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -531,9 +531,9 @@ class GetAllQueryIndexOptions(dict):
531531
All management options should be imported from `couchbase.management.options`.
532532
533533
Args:
534-
collection_name (str, optional): ** DEPRECATED ** - use `~couchbase.management.queries.CollectionQueryIndexManager`.
534+
collection_name (str, optional): **DEPRECATED** - use :class:`~couchbase.management.queries.CollectionQueryIndexManager`.
535535
Specifies the collection of the indexes.
536-
scope_name (str, optional): ** DEPRECATED ** - use `~couchbase.management.queries.CollectionQueryIndexManager`.
536+
scope_name (str, optional): **DEPRECATED** - use :class:`~couchbase.management.queries.CollectionQueryIndexManager`.
537537
Specifies the scope of the indexes.
538538
timeout (timedelta, optional): The timeout for this operation. Defaults to global
539539
management operation timeout.
@@ -559,15 +559,15 @@ class CreateQueryIndexOptions(dict):
559559
All management options should be imported from `couchbase.management.options`.
560560
561561
Args:
562-
collection_name (str, optional): ** DEPRECATED ** - use `~couchbase.management.queries.CollectionQueryIndexManager`.
562+
collection_name (str, optional): **DEPRECATED** - use :class:`~couchbase.management.queries.CollectionQueryIndexManager`.
563563
Specifies the collection of the index.
564564
condition (str, optional): Specifies the 'where' condition for partial index creation.
565565
deferred (bool, optional): Specifies whether this index creation should be deferred until
566566
a later point in time when they can be explicitly built together.
567567
ignore_if_exists (bool, optional): Whether or not the call should ignore the
568568
index already existing when determining whether the call was successful.
569569
num_replicas (int, optional): The number of replicas of this index that should be created.
570-
scope_name (str, optional): ** DEPRECATED ** - use `~couchbase.management.queries.CollectionQueryIndexManager`.
570+
scope_name (str, optional): **DEPRECATED** - use :class:`~couchbase.management.queries.CollectionQueryIndexManager`.
571571
Specifies the scope of the index.
572572
timeout (timedelta, optional): The timeout for this operation. Defaults to global
573573
management operation timeout.
@@ -599,7 +599,7 @@ class CreatePrimaryQueryIndexOptions(dict):
599599
All management options should be imported from `couchbase.management.options`.
600600
601601
Args:
602-
collection_name (str, optional): ** DEPRECATED ** - use `~couchbase.management.queries.CollectionQueryIndexManager`.
602+
collection_name (str, optional): **DEPRECATED** - use :class:`~couchbase.management.queries.CollectionQueryIndexManager`.
603603
Specifies the collection of the index.
604604
condition (str, optional): Specifies the 'where' condition for partial index creation.
605605
deferred (bool, optional): Specifies whether this index creation should be deferred until
@@ -608,7 +608,7 @@ class CreatePrimaryQueryIndexOptions(dict):
608608
index already existing when determining whether the call was successful.
609609
index_name (str, optional): Specifies the name of the primary index.
610610
num_replicas (int, optional): The number of replicas of this index that should be created.
611-
scope_name (str, optional): ** DEPRECATED ** - use `~couchbase.management.queries.CollectionQueryIndexManager`.
611+
scope_name (str, optional): **DEPRECATED** - use :class:`~couchbase.management.queries.CollectionQueryIndexManager`.
612612
Specifies the scope of the index.
613613
timeout (timedelta, optional): The timeout for this operation. Defaults to global
614614
management operation timeout.
@@ -641,11 +641,11 @@ class DropQueryIndexOptions(dict):
641641
All management options should be imported from `couchbase.management.options`.
642642
643643
Args:
644-
collection_name (str, optional): ** DEPRECATED ** - use `~couchbase.management.queries.CollectionQueryIndexManager`.
644+
collection_name (str, optional): **DEPRECATED** - use :class:`~couchbase.management.queries.CollectionQueryIndexManager`.
645645
Specifies the collection of the index.
646646
ignore_if_not_exists (bool, optional): Whether or not the call should ignore the
647647
index not existing when determining whether the call was successful.
648-
scope_name (str, optional): ** DEPRECATED ** - use `~couchbase.management.queries.CollectionQueryIndexManager`.
648+
scope_name (str, optional): **DEPRECATED** - use :class:`~couchbase.management.queries.CollectionQueryIndexManager`.
649649
Specifies the scope of the index.
650650
timeout (timedelta, optional): The timeout for this operation. Defaults to global
651651
management operation timeout.
@@ -672,12 +672,12 @@ class DropPrimaryQueryIndexOptions(dict):
672672
All management options should be imported from `couchbase.management.options`.
673673
674674
Args:
675-
collection_name (str, optional): ** DEPRECATED ** - use `~couchbase.management.queries.CollectionQueryIndexManager`.
675+
collection_name (str, optional): **DEPRECATED** - use :class:`~couchbase.management.queries.CollectionQueryIndexManager`.
676676
Specifies the collection of the index.
677677
ignore_if_not_exists (bool, optional): Whether or not the call should ignore the
678678
index not existing when determining whether the call was successful.
679679
index_name (str, optional): Specifies the name of the primary index.
680-
scope_name (str, optional): ** DEPRECATED ** - use `~couchbase.management.queries.CollectionQueryIndexManager`.
680+
scope_name (str, optional): **DEPRECATED** - use :class:`~couchbase.management.queries.CollectionQueryIndexManager`.
681681
Specifies the scope of the index.
682682
timeout (timedelta, optional): The timeout for this operation. Defaults to global
683683
management operation timeout.
@@ -705,9 +705,9 @@ class WatchQueryIndexOptions(dict):
705705
All management options should be imported from `couchbase.management.options`.
706706
707707
Args:
708-
collection_name (str, optional): ** DEPRECATED ** - use `~couchbase.management.queries.CollectionQueryIndexManager`.
708+
collection_name (str, optional): **DEPRECATED** - use :class:`~couchbase.management.queries.CollectionQueryIndexManager`.
709709
Specifies the collection of the index.
710-
scope_name (str, optional): ** DEPRECATED ** - use `~couchbase.management.queries.CollectionQueryIndexManager`.
710+
scope_name (str, optional): **DEPRECATED** - use :class:`~couchbase.management.queries.CollectionQueryIndexManager`.
711711
Specifies the scope of the index.
712712
timeout (timedelta, optional): The timeout for this operation. Defaults to global
713713
management operation timeout.
@@ -736,9 +736,9 @@ class BuildDeferredQueryIndexOptions(dict):
736736
All management options should be imported from `couchbase.management.options`.
737737
738738
Args:
739-
collection_name (str, optional): ** DEPRECATED ** - use `~couchbase.management.queries.CollectionQueryIndexManager`.
739+
collection_name (str, optional): **DEPRECATED** - use :class:`~couchbase.management.queries.CollectionQueryIndexManager`.
740740
Specifies the collection of the index.
741-
scope_name (str, optional): ** DEPRECATED ** - use `~couchbase.management.queries.CollectionQueryIndexManager`.
741+
scope_name (str, optional): **DEPRECATED** - use :class:`~couchbase.management.queries.CollectionQueryIndexManager`.
742742
Specifies the scope of the index.
743743
timeout (timedelta, optional): The timeout for this operation. Defaults to global
744744
management operation timeout.

couchbase/management/queries.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,14 +38,20 @@
3838

3939

4040
class QueryIndexManager(QueryIndexManagerLogic):
41+
"""
42+
Performs management operations on query indexes.
43+
44+
For managing query indexes at the collection level, :class:`.CollectionQueryIndexManager` should be used.
45+
"""
46+
4147
def __init__(self, connection):
4248
super().__init__(connection)
4349

4450
@BlockingMgmtWrapper.block(None, ManagementType.QueryIndexMgmt, QueryIndexManagerLogic._ERROR_MAPPING)
4551
def create_index(self,
4652
bucket_name, # type: str
4753
index_name, # type: str
48-
keys, # type: Iterable[str]
54+
keys, # type: Iterable[str]
4955
*options, # type: CreateQueryIndexOptions
5056
**kwargs # type: Dict[str, Any]
5157
) -> None:
@@ -288,6 +294,10 @@ def check_indexes(index_names, indexes):
288294

289295

290296
class CollectionQueryIndexManager(QueryIndexManagerLogic):
297+
"""
298+
Performs management operations on query indexes at the collection level.
299+
"""
300+
291301
def __init__(self, connection, bucket_name, scope_name, collection_name):
292302
self._bucket_name = bucket_name
293303
self._scope_name = scope_name

docs/couchbase_api/couchbase_management.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -100,6 +100,16 @@ Query Index Management
100100

101101
.. module:: couchbase.management.queries
102102

103+
.. autoclass:: CollectionQueryIndexManager
104+
105+
.. automethod:: build_deferred_indexes
106+
.. automethod:: create_index
107+
.. automethod:: create_primary_index
108+
.. automethod:: drop_index
109+
.. automethod:: drop_primary_index
110+
.. automethod:: get_all_indexes
111+
.. automethod:: watch_indexes
112+
103113
.. autoclass:: QueryIndexManager
104114

105115
.. automethod:: build_deferred_indexes

0 commit comments

Comments
 (0)