ibmcloudant package¶
Submodules¶
ibmcloudant.cloudant_v1 module¶
NoSQL database based on Apache CouchDB
See: https://cloud.ibm.com/docs/services/Cloudant/
- class ibmcloudant.cloudant_v1.ActiveTask(database: str, node: str, pid: str, started_on: int, type: str, updated_on: int, *, bulk_get_attempts: int = None, bulk_get_docs: int = None, changes_done: int = None, changes_pending: int = None, checkpoint_interval: int = None, checkpointed_source_seq: str = None, continuous: bool = None, design_document: str = None, doc_id: str = None, doc_write_failures: int = None, docs_read: int = None, docs_written: int = None, index: str = None, indexer_pid: str = None, missing_revisions_found: int = None, phase: str = None, process_status: str = None, progress: int = None, replication_id: str = None, retry: bool = None, revisions_checked: int = None, source: str = None, source_seq: str = None, target: str = None, through_seq: str = None, total_changes: int = None, user: str = None, view: int = None)¶
Bases:
object
Schema for information about a running task.
- Attr int bulk_get_attempts:
(optional) The total count of attempted doc revisions fetched with _bulk_get. Available for replication type tasks.
- Attr int bulk_get_docs:
(optional) The total count of successful docs fetched with _bulk_get. Available for replication type tasks.
- Attr int changes_done:
(optional) Processed changes. Available for database_compaction, indexer, search_indexer, view_compaction type tasks.
- Attr int changes_pending:
(optional) The count of changes not yet replicated. Available for replication type tasks.
- Attr int checkpoint_interval:
(optional) Specifies the checkpoint interval in ms. Available for replication type tasks.
- Attr str checkpointed_source_seq:
(optional) The source sequence id which was last successfully replicated. Available for replication type tasks.
- Attr bool continuous:
(optional) The replication configured to be continuous. Available for replication type tasks.
- Attr str database:
Source database.
- Attr str design_document:
(optional) The design document that belongs to this task. Available for indexer, search_indexer, view_compaction type tasks.
- Attr str doc_id:
(optional) Replication document ID. Available for replication type tasks.
- Attr int doc_write_failures:
(optional) Number of document write failures. Available for replication type tasks.
- Attr int docs_read:
(optional) Number of documents read. Available for replication type tasks.
- Attr int docs_written:
(optional) Number of documents written to target. Available for replication type tasks.
- Attr str index:
(optional) The search index that belongs to this task. Available for search_indexer type tasks.
- Attr str indexer_pid:
(optional) Indexer process ID. Available for indexer type tasks.
- Attr int missing_revisions_found:
(optional) The count of docs which have been read from the source. Available for replication type tasks.
- Attr str node:
Cluster node where the task is running.
- Attr str phase:
(optional) The phase the active task is in. docid_sort, docid_copy, document_copy phases are available for database_compaction, while ids and view phases are available for view_compaction type tasks.
- Attr str pid:
Process ID.
- Attr str process_status:
(optional) Process status.
- Attr int progress:
(optional) Current percentage progress. Available for database_compaction, indexer, search_indexer, view_compaction type tasks.
- Attr str replication_id:
(optional) Replication ID. Available for replication type tasks.
- Attr bool retry:
(optional) Indicates whether a compaction retry is currently running on the database. Available for database_compaction type tasks.
- Attr int revisions_checked:
(optional) The count of revisions which have been checked since this replication began. Available for replication type tasks.
- Attr str source:
(optional) Replication source. Available for replication type tasks.
- Attr str source_seq:
(optional) The last sequence number obtained from the source database changes feed. Available for replication type tasks.
- Attr int started_on:
Schema for a Unix epoch timestamp.
- Attr str target:
(optional) Replication target. Available for replication type tasks.
- Attr str through_seq:
(optional) The last sequence number processed by the replicator. Available for replication type tasks.
- Attr int total_changes:
(optional) Total changes to process. Available for database_compaction, indexer, search_indexer, view_compaction type tasks.
- Attr str type:
Operation type.
- Attr int updated_on:
Schema for a Unix epoch timestamp.
- Attr str user:
(optional) Name of user running replication or owning the indexer. Available for indexer, replication type tasks.
- Attr int view:
(optional) Number of view indexes. Available for view_compaction type tasks.
- class PhaseEnum(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
str
,Enum
The phase the active task is in. docid_sort, docid_copy, document_copy phases are available for database_compaction, while ids and view phases are available for view_compaction type tasks.
- DOCID_COPY = 'docid_copy'¶
- DOCID_SORT = 'docid_sort'¶
- DOCUMENT_COPY = 'document_copy'¶
- IDS = 'ids'¶
- VIEW = 'view'¶
- class ProcessStatusEnum(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
str
,Enum
Process status.
- EXITING = 'exiting'¶
- GARBAGE_COLLECTING = 'garbage_collecting'¶
- RUNNABLE = 'runnable'¶
- RUNNING = 'running'¶
- SUSPENDED = 'suspended'¶
- WAITING = 'waiting'¶
- class TypeEnum(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
str
,Enum
Operation type.
- DATABASE_COMPACTION = 'database_compaction'¶
- INDEXER = 'indexer'¶
- REPLICATION = 'replication'¶
- SEARCH_INDEXER = 'search_indexer'¶
- VIEW_COMPACTION = 'view_compaction'¶
- classmethod from_dict(_dict: Dict) ActiveTask ¶
Initialize a ActiveTask object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.ActivityTrackerEvents(types: List[str])¶
Bases:
object
Schema for Activity Tracker events.
- Attr List[str] types:
An array of event types that are being sent to IBM Cloud Activity Tracker for the IBM Cloudant instance. “management” is a required element of this array.
- class TypesEnum(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
str
,Enum
types.
- DATA = 'data'¶
- MANAGEMENT = 'management'¶
- classmethod from_dict(_dict: Dict) ActivityTrackerEvents ¶
Initialize a ActivityTrackerEvents object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.AllDocsQueriesResult(results: List[AllDocsResult])¶
Bases:
object
Schema for the result of an all documents queries operation.
- Attr List[AllDocsResult] results:
An array of result objects - one for each query. Each result object contains the same fields as the response to a regular /_all_docs request.
- classmethod from_dict(_dict: Dict) AllDocsQueriesResult ¶
Initialize a AllDocsQueriesResult object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.AllDocsQuery(*, att_encoding_info: bool = None, attachments: bool = None, conflicts: bool = None, descending: bool = None, include_docs: bool = None, inclusive_end: bool = None, limit: int = None, skip: int = None, update_seq: bool = None, end_key: str = None, key: str = None, keys: List[str] = None, start_key: str = None)¶
Bases:
object
Schema for an all documents query operation.
- Attr bool att_encoding_info:
(optional) Parameter to specify whether to include the encoding information in attachment stubs if the particular attachment is compressed.
- Attr bool attachments:
(optional) Parameter to specify whether to include attachments bodies in a response.
- Attr bool conflicts:
(optional) Parameter to specify whether to include a list of conflicted revisions in each returned document. Active only when include_docs is true.
- Attr bool descending:
(optional) Parameter to specify whether to return the documents in descending by key order.
- Attr bool include_docs:
(optional) Parameter to specify whether to include the full content of the documents in the response.
- Attr bool inclusive_end:
(optional) Parameter to specify whether the specified end key should be included in the result.
- Attr int limit:
(optional) Parameter to specify the number of returned documents to limit the result to.
- Attr int skip:
(optional) Parameter to specify the number of records before starting to return the results.
- Attr bool update_seq:
(optional) Parameter to specify whether to include in the response an update_seq value indicating the sequence id of the database the view reflects.
- Attr str end_key:
(optional) Schema for a document ID.
- Attr str key:
(optional) Schema for a document ID.
- Attr List[str] keys:
(optional) Schema for a list of document IDs.
- Attr str start_key:
(optional) Schema for a document ID.
- classmethod from_dict(_dict: Dict) AllDocsQuery ¶
Initialize a AllDocsQuery object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.AllDocsResult(total_rows: int, rows: List[DocsResultRow], *, update_seq: str = None)¶
Bases:
object
Schema for the result of an all documents operation.
- Attr int total_rows:
Number of total rows.
- Attr List[DocsResultRow] rows:
List of doc results.
- Attr str update_seq:
(optional) Current update sequence for the database.
- classmethod from_dict(_dict: Dict) AllDocsResult ¶
Initialize a AllDocsResult object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.Analyzer(*, name: str = None, stopwords: List[str] = None)¶
Bases:
object
Schema for a full text search analyzer.
- Attr str name:
(optional) Schema for the name of the Apache Lucene analyzer to use for text indexing. The default value varies depending on the analyzer usage: * For search indexes the default is standard * For query text indexes the default is keyword * For a query text index default_field the default is standard.
- Attr List[str] stopwords:
(optional) Custom stopwords to use with the named analyzer.
- class NameEnum(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
str
,Enum
Schema for the name of the Apache Lucene analyzer to use for text indexing. The default value varies depending on the analyzer usage: * For search indexes the default is standard * For query text indexes the default is keyword * For a query text index default_field the default is standard.
- ARABIC = 'arabic'¶
- ARMENIAN = 'armenian'¶
- BASQUE = 'basque'¶
- BRAZILIAN = 'brazilian'¶
- BULGARIAN = 'bulgarian'¶
- CATALAN = 'catalan'¶
- CHINESE = 'chinese'¶
- CJK = 'cjk'¶
- CLASSIC = 'classic'¶
- CZECH = 'czech'¶
- DANISH = 'danish'¶
- DUTCH = 'dutch'¶
- EMAIL = 'email'¶
- ENGLISH = 'english'¶
- FINNISH = 'finnish'¶
- FRENCH = 'french'¶
- GALICIAN = 'galician'¶
- GERMAN = 'german'¶
- GREEK = 'greek'¶
- HINDI = 'hindi'¶
- HUNGARIAN = 'hungarian'¶
- INDONESIAN = 'indonesian'¶
- IRISH = 'irish'¶
- ITALIAN = 'italian'¶
- JAPANESE = 'japanese'¶
- KEYWORD = 'keyword'¶
- LATVIAN = 'latvian'¶
- NORWEGIAN = 'norwegian'¶
- PERFIELD = 'perfield'¶
- PERSIAN = 'persian'¶
- POLISH = 'polish'¶
- PORTUGUESE = 'portuguese'¶
- ROMANIAN = 'romanian'¶
- RUSSIAN = 'russian'¶
- SIMPLE = 'simple'¶
- SPANISH = 'spanish'¶
- STANDARD = 'standard'¶
- SWEDISH = 'swedish'¶
- THAI = 'thai'¶
- TURKISH = 'turkish'¶
- WHITESPACE = 'whitespace'¶
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.AnalyzerConfiguration(*, name: str = None, stopwords: List[str] = None, fields: dict = None)¶
Bases:
object
Schema for a search analyzer configuration.
- Attr str name:
(optional) Schema for the name of the Apache Lucene analyzer to use for text indexing. The default value varies depending on the analyzer usage: * For search indexes the default is standard * For query text indexes the default is keyword * For a query text index default_field the default is standard.
- Attr List[str] stopwords:
(optional) Custom stopwords to use with the named analyzer.
- Attr dict fields:
(optional) Schema for mapping a field name to a per field analyzer.
- class NameEnum(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
str
,Enum
Schema for the name of the Apache Lucene analyzer to use for text indexing. The default value varies depending on the analyzer usage: * For search indexes the default is standard * For query text indexes the default is keyword * For a query text index default_field the default is standard.
- ARABIC = 'arabic'¶
- ARMENIAN = 'armenian'¶
- BASQUE = 'basque'¶
- BRAZILIAN = 'brazilian'¶
- BULGARIAN = 'bulgarian'¶
- CATALAN = 'catalan'¶
- CHINESE = 'chinese'¶
- CJK = 'cjk'¶
- CLASSIC = 'classic'¶
- CZECH = 'czech'¶
- DANISH = 'danish'¶
- DUTCH = 'dutch'¶
- EMAIL = 'email'¶
- ENGLISH = 'english'¶
- FINNISH = 'finnish'¶
- FRENCH = 'french'¶
- GALICIAN = 'galician'¶
- GERMAN = 'german'¶
- GREEK = 'greek'¶
- HINDI = 'hindi'¶
- HUNGARIAN = 'hungarian'¶
- INDONESIAN = 'indonesian'¶
- IRISH = 'irish'¶
- ITALIAN = 'italian'¶
- JAPANESE = 'japanese'¶
- KEYWORD = 'keyword'¶
- LATVIAN = 'latvian'¶
- NORWEGIAN = 'norwegian'¶
- PERFIELD = 'perfield'¶
- PERSIAN = 'persian'¶
- POLISH = 'polish'¶
- PORTUGUESE = 'portuguese'¶
- ROMANIAN = 'romanian'¶
- RUSSIAN = 'russian'¶
- SIMPLE = 'simple'¶
- SPANISH = 'spanish'¶
- STANDARD = 'standard'¶
- SWEDISH = 'swedish'¶
- THAI = 'thai'¶
- TURKISH = 'turkish'¶
- WHITESPACE = 'whitespace'¶
- classmethod from_dict(_dict: Dict) AnalyzerConfiguration ¶
Initialize a AnalyzerConfiguration object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.ApiKeysResult(ok: bool, key: str, password: str)¶
Bases:
object
Schema for api keys.
- Attr bool ok:
ok.
- Attr str key:
The generated api key.
- Attr str password:
The password associated with the api key.
- classmethod from_dict(_dict: Dict) ApiKeysResult ¶
Initialize a ApiKeysResult object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.Attachment(*, content_type: str = None, data: bytes = None, digest: str = None, encoded_length: int = None, encoding: str = None, follows: bool = None, length: int = None, revpos: int = None, stub: bool = None)¶
Bases:
object
Schema for an attachment.
- Attr str content_type:
(optional) Attachment MIME type.
- Attr bytes data:
(optional) Base64-encoded content. Available if attachment content is requested by using the query parameters attachments=true or atts_since. Note that when used with a view or changes feed include_docs must also be true.
- Attr str digest:
(optional) Content hash digest. It starts with prefix which announce hash type (e.g. md5-) and continues with Base64-encoded hash digest.
- Attr int encoded_length:
(optional) Compressed attachment size in bytes. Available if content_type was in list of compressible types when the attachment was added and the query parameter att_encoding_info is true. Note that when used with a view or changes feed include_docs must also be true.
- Attr str encoding:
(optional) Compression codec. Available if content_type was in list of compressible types when the attachment was added and the and the query parameter att_encoding_info is true. Note that when used with a view or changes feed include_docs must also be true.
- Attr bool follows:
(optional) True if the attachment follows in a multipart request or response.
- Attr int length:
(optional) Real attachment size in bytes. Not available if inline attachment content requested.
- Attr int revpos:
(optional) Revision number when attachment was added.
- Attr bool stub:
(optional) Has true value if object contains stub info and no content. Otherwise omitted in response.
- classmethod from_dict(_dict: Dict) Attachment ¶
Initialize a Attachment object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.BulkDocs(docs: List[Document], *, new_edits: bool = None)¶
Bases:
object
Schema for submitting documents for bulk modifications.
- Attr List[Document] docs:
Array of documents.
- Attr bool new_edits:
(optional) If false, prevents the database from assigning them new revision IDs. Default is true.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.BulkGetQueryDocument(id: str, *, atts_since: List[str] = None, rev: str = None)¶
Bases:
object
Schema for a document item in a bulk get query.
- Attr List[str] atts_since:
(optional) Includes attachments only since specified revisions.
- Attr str id:
Schema for a document ID.
- Attr str rev:
(optional) Schema for a document revision identifier.
- classmethod from_dict(_dict: Dict) BulkGetQueryDocument ¶
Initialize a BulkGetQueryDocument object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.BulkGetResult(results: List[BulkGetResultItem])¶
Bases:
object
Schema for the results object of a bulk get operation.
- Attr List[BulkGetResultItem] results:
Results.
- classmethod from_dict(_dict: Dict) BulkGetResult ¶
Initialize a BulkGetResult object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.BulkGetResultDocument(*, error: DocumentResult = None, ok: Document = None)¶
Bases:
object
Schema for BulkGetResult object containing a successfully retrieved document or error information.
- Attr DocumentResult error:
(optional) Schema for the result of a document modification.
- Attr Document ok:
(optional) Schema for a document.
- classmethod from_dict(_dict: Dict) BulkGetResultDocument ¶
Initialize a BulkGetResultDocument object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.BulkGetResultItem(docs: List[BulkGetResultDocument], id: str)¶
Bases:
object
Schema for the document revisions information from a bulk get operation.
- Attr List[BulkGetResultDocument] docs:
Array of document revisions or error information.
- Attr str id:
Schema for a document ID.
- classmethod from_dict(_dict: Dict) BulkGetResultItem ¶
Initialize a BulkGetResultItem object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.CapacityThroughputInformation(current: CapacityThroughputInformationCurrent, *, target: CapacityThroughputInformationTarget = None)¶
Bases:
object
Schema for information about the currently provisioned and target throughput capacity.
- Attr CapacityThroughputInformationCurrent current:
Detailed information about provisioned throughput capacity.
- Attr CapacityThroughputInformationTarget target:
(optional) Detailed information about target throughput capacity.
- classmethod from_dict(_dict: Dict) CapacityThroughputInformation ¶
Initialize a CapacityThroughputInformation object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.CapacityThroughputInformationCurrent(throughput: ThroughputInformation)¶
Bases:
object
Detailed information about provisioned throughput capacity.
- Attr ThroughputInformation throughput:
Schema for detailed information about throughput capacity with breakdown by specific throughput requests classes.
- classmethod from_dict(_dict: Dict) CapacityThroughputInformationCurrent ¶
Initialize a CapacityThroughputInformationCurrent object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.CapacityThroughputInformationTarget(throughput: ThroughputInformation)¶
Bases:
object
Detailed information about target throughput capacity.
- Attr ThroughputInformation throughput:
Schema for detailed information about throughput capacity with breakdown by specific throughput requests classes.
- classmethod from_dict(_dict: Dict) CapacityThroughputInformationTarget ¶
Initialize a CapacityThroughputInformationTarget object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.Change(rev: str)¶
Bases:
object
Schema for a document leaf with single field rev.
- Attr str rev:
Schema for a document revision identifier.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.ChangesResult(last_seq: str, pending: int, results: List[ChangesResultItem])¶
Bases:
object
Schema for normal changes feed result.
- Attr str last_seq:
last_seq.
- Attr int pending:
pending.
- Attr List[ChangesResultItem] results:
results.
- classmethod from_dict(_dict: Dict) ChangesResult ¶
Initialize a ChangesResult object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.ChangesResultItem(changes: List[Change], id: str, seq: str, *, deleted: bool = None, doc: Document = None)¶
Bases:
object
Schema for an item in the changes results array.
- Attr List[Change] changes:
List of document’s leaves with single field rev.
- Attr bool deleted:
(optional) if true then the document is deleted.
- Attr Document doc:
(optional) Schema for a document.
- Attr str id:
Schema for a document ID.
- Attr str seq:
Update sequence.
- classmethod from_dict(_dict: Dict) ChangesResultItem ¶
Initialize a ChangesResultItem object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.CloudantV1(authenticator: Authenticator = None)¶
Bases:
BaseService
The Cloudant V1 service.
- delete_attachment(db: str, doc_id: str, attachment_name: str, *, if_match: str = None, rev: str = None, batch: str = None, **kwargs) DetailedResponse ¶
Delete an attachment.
Deletes the attachment with the filename, {attachment_name}, from the specified doc. You must supply the rev query parameter or If-Match header with the current revision to delete the attachment.
- Parameters:
db (str) – Path parameter to specify the database name.
doc_id (str) – Path parameter to specify the document ID.
attachment_name (str) – Path parameter to specify the attachment name.
if_match (str) – (optional) Header parameter to specify the document revision. Alternative to rev query parameter.
rev (str) – (optional) Query parameter to specify a document revision.
batch (str) – (optional) Query parameter to specify whether to store in batch mode. The server will respond with a HTTP 202 Accepted response code immediately.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with dict result representing a DocumentResult object
- delete_database(db: str, **kwargs) DetailedResponse ¶
Delete a database.
Deletes the specified database and all documents and attachments contained within it. To avoid deleting a database, the server responds with a 400 HTTP status code when the request URL includes a ?rev= parameter. This response suggests that a user wanted to delete a document but forgot to add the document ID to the URL.
- Parameters:
db (str) – Path parameter to specify the database name.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with dict result representing a Ok object
- delete_design_document(db: str, ddoc: str, *, if_match: str = None, batch: str = None, rev: str = None, **kwargs) DetailedResponse ¶
Delete a design document.
Marks the specified design document as deleted by adding a _deleted field with the value true. Documents with this field are not returned with requests but stay in the database. You must supply the current (latest) revision, either by using the rev parameter or by using the If-Match header to specify the revision.
- Parameters:
db (str) – Path parameter to specify the database name.
ddoc (str) – Path parameter to specify the design document name. The design document name is the design document ID excluding the _design/ prefix.
if_match (str) – (optional) Header parameter to specify the document revision. Alternative to rev query parameter.
batch (str) – (optional) Query parameter to specify whether to store in batch mode. The server will respond with a HTTP 202 Accepted response code immediately.
rev (str) – (optional) Query parameter to specify a document revision.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with dict result representing a DocumentResult object
- delete_document(db: str, doc_id: str, *, if_match: str = None, batch: str = None, rev: str = None, **kwargs) DetailedResponse ¶
Delete a document.
Marks the specified document as deleted by adding a _deleted field with the value true. Documents with this field are not returned within requests anymore but stay in the database. You must supply the current (latest) revision, either by using the rev parameter or by using the If-Match header to specify the revision.
- Parameters:
db (str) – Path parameter to specify the database name.
doc_id (str) – Path parameter to specify the document ID.
if_match (str) – (optional) Header parameter to specify the document revision. Alternative to rev query parameter.
batch (str) – (optional) Query parameter to specify whether to store in batch mode. The server will respond with a HTTP 202 Accepted response code immediately.
rev (str) – (optional) Query parameter to specify a document revision.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with dict result representing a DocumentResult object
- delete_index(db: str, ddoc: str, type: str, index: str, **kwargs) DetailedResponse ¶
Delete an index.
- Parameters:
db (str) – Path parameter to specify the database name.
ddoc (str) – Path parameter to specify the design document name. The design document name is the design document ID excluding the _design/ prefix.
type (str) – Path parameter to specify the index type.
index (str) – Path parameter to specify the index name.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with dict result representing a Ok object
- delete_local_document(db: str, doc_id: str, *, batch: str = None, **kwargs) DetailedResponse ¶
Delete a local document.
Deletes the specified local document. The semantics are identical to deleting a standard document in the specified database, except that the document is not replicated.
- Parameters:
db (str) – Path parameter to specify the database name.
doc_id (str) – Path parameter to specify the document ID.
batch (str) – (optional) Query parameter to specify whether to store in batch mode. The server will respond with a HTTP 202 Accepted response code immediately.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with dict result representing a DocumentResult object
- delete_replication_document(doc_id: str, *, if_match: str = None, batch: str = None, rev: str = None, **kwargs) DetailedResponse ¶
Cancel a replication.
Cancels a replication by deleting the document that describes it from the _replicator database.
- Parameters:
doc_id (str) – Path parameter to specify the document ID.
if_match (str) – (optional) Header parameter to specify the document revision. Alternative to rev query parameter.
batch (str) – (optional) Query parameter to specify whether to store in batch mode. The server will respond with a HTTP 202 Accepted response code immediately.
rev (str) – (optional) Query parameter to specify a document revision.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with dict result representing a DocumentResult object
- get_active_tasks(**kwargs) DetailedResponse ¶
Retrieve list of running tasks.
Lists running tasks, including the task type, name, status, and process ID. The result includes a JSON array of the currently running tasks, with each task described as a single object. Depending on the operation type, the set of response object fields might be different.
- Parameters:
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with List[ActiveTask] result
- get_activity_tracker_events(**kwargs) DetailedResponse ¶
Retrieve Activity Tracker events information.
Check event types that are being sent to IBM Cloud Activity Tracker for the IBM Cloudant instance.
- Parameters:
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with dict result representing a ActivityTrackerEvents object
- get_all_dbs(*, descending: bool = None, end_key: str = None, limit: int = None, skip: int = None, start_key: str = None, **kwargs) DetailedResponse ¶
Query a list of all database names in the instance.
- Parameters:
descending (bool) – (optional) Query parameter to specify whether to return the documents in descending by key order.
end_key (str) – (optional) Query parameter to specify to stop returning records when the specified key is reached. String representation of any JSON type that matches the key type emitted by the view function.
limit (int) – (optional) Query parameter to specify the number of returned documents to limit the result to.
skip (int) – (optional) Query parameter to specify the number of records before starting to return the results.
start_key (str) – (optional) Query parameter to specify to start returning records from the specified key. String representation of any JSON type that matches the key type emitted by the view function.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with List[str] result
- get_attachment(db: str, doc_id: str, attachment_name: str, *, if_match: str = None, if_none_match: str = None, range: str = None, rev: str = None, **kwargs) DetailedResponse ¶
Retrieve an attachment.
Returns the file attachment that is associated with the document. The raw data of the associated attachment is returned, just as if you were accessing a static file. The returned Content-Type header is the same as the content type set when the document attachment was submitted to the database.
- Parameters:
db (str) – Path parameter to specify the database name.
doc_id (str) – Path parameter to specify the document ID.
attachment_name (str) – Path parameter to specify the attachment name.
if_match (str) – (optional) Header parameter to specify the document revision. Alternative to rev query parameter.
if_none_match (str) – (optional) Header parameter to specify a double quoted document revision token for cache control.
range (str) – (optional) Header parameter to specify the byte range for a request. This allows the implementation of resumable downloads and skippable streams. This is available for all attachments inside CouchDB.
rev (str) – (optional) Query parameter to specify a document revision.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with BinaryIO result
- get_capacity_throughput_information(**kwargs) DetailedResponse ¶
Retrieve provisioned throughput capacity information.
View the amount of provisioned throughput capacity that is allocated to an IBM Cloudant instance and what is the target provisioned throughput capacity.
- Parameters:
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with dict result representing a CapacityThroughputInformation object
- get_cors_information(**kwargs) DetailedResponse ¶
Retrieve CORS configuration information.
Lists all Cross-origin resource sharing (CORS) configuration. CORS defines a way in which the browser and the server interact to determine whether or not to allow the request.
- Parameters:
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with dict result representing a CorsInformation object
- get_current_throughput_information(**kwargs) DetailedResponse ¶
Retrieve the current provisioned throughput capacity consumption.
View the current consumption of provisioned throughput capacity for an IBM Cloudant instance. The current consumption shows the quantities of reads, writes, and global queries conducted against the instance for a given second.
- Parameters:
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with dict result representing a CurrentThroughputInformation object
- get_database_information(db: str, **kwargs) DetailedResponse ¶
Retrieve information about a database.
- Parameters:
db (str) – Path parameter to specify the database name.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with dict result representing a DatabaseInformation object
- get_db_updates(*, feed: str = None, heartbeat: int = None, timeout: int = None, since: str = None, **kwargs) DetailedResponse ¶
Retrieve change events for all databases.
Lists changes to databases, like a global changes feed. Types of changes include updating the database and creating or deleting a database. Like the changes feed, the feed is not guaranteed to return changes in the correct order and might repeat changes. Polling modes for this method work like polling modes for the changes feed. Note: This endpoint requires _admin or _db_updates role and is only available on dedicated clusters..
- Parameters:
feed (str) – (optional) Query parameter to specify the changes feed type.
heartbeat (int) – (optional) Query parameter to specify the period in milliseconds after which an empty line is sent in the results. Only applicable for longpoll, continuous, and eventsource feeds. Overrides any timeout to keep the feed alive indefinitely. May also be true to use default value of 60000.
timeout (int) – (optional) Query parameter to specify the maximum period in milliseconds to wait for a change before the response is sent, even if there are no results. Only applicable for longpoll or continuous feeds. Default value is specified by httpd/changes_timeout configuration option. Note that 60000 value is also the default maximum timeout to prevent undetected dead connections.
since (str) – (optional) Query parameter to specify to start the results from the change immediately after the given update sequence. Can be a valid update sequence or now value. Default is 0 i.e. all changes.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with dict result representing a DbUpdates object
- get_design_document(db: str, ddoc: str, *, if_none_match: str = None, attachments: bool = None, att_encoding_info: bool = None, conflicts: bool = None, deleted_conflicts: bool = None, latest: bool = None, local_seq: bool = None, meta: bool = None, rev: str = None, revs: bool = None, revs_info: bool = None, **kwargs) DetailedResponse ¶
Retrieve a design document.
Returns design document with the specified doc_id from the specified database. Unless you request a specific revision, the current revision of the design document is always returned.
- Parameters:
db (str) – Path parameter to specify the database name.
ddoc (str) – Path parameter to specify the design document name. The design document name is the design document ID excluding the _design/ prefix.
if_none_match (str) – (optional) Header parameter to specify a double quoted document revision token for cache control.
attachments (bool) – (optional) Query parameter to specify whether to include attachments bodies in a response.
att_encoding_info (bool) – (optional) Query parameter to specify whether to include the encoding information in attachment stubs if the particular attachment is compressed.
conflicts (bool) – (optional) Query parameter to specify whether to include a list of conflicted revisions in each returned document. Active only when include_docs is true.
deleted_conflicts (bool) – (optional) Query parameter to specify whether to include a list of deleted conflicted revisions in the _deleted_conflicts property of the returned document.
latest (bool) – (optional) Query parameter to specify whether to force retrieving latest leaf revision, no matter what rev was requested.
local_seq (bool) – (optional) Query parameter to specify whether to include the last update sequence for the document.
meta (bool) – (optional) Query parameter to specify whether to include document meta information. Acts the same as specifying all of the conflicts, deleted_conflicts and open_revs query parameters.
rev (str) – (optional) Query parameter to specify a document revision.
revs (bool) – (optional) Query parameter to specify whether to include a list of all known document revisions.
revs_info (bool) – (optional) Query parameter to specify whether to includes detailed information for all known document revisions.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with dict result representing a DesignDocument object
- get_design_document_information(db: str, ddoc: str, **kwargs) DetailedResponse ¶
Retrieve information about a design document.
Retrieves information about the specified design document, including the index, index size, and current status of the design document and associated index information.
- Parameters:
db (str) – Path parameter to specify the database name.
ddoc (str) – Path parameter to specify the design document name. The design document name is the design document ID excluding the _design/ prefix.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with dict result representing a DesignDocumentInformation object
- get_document(db: str, doc_id: str, *, if_none_match: str = None, attachments: bool = None, att_encoding_info: bool = None, conflicts: bool = None, deleted_conflicts: bool = None, latest: bool = None, local_seq: bool = None, meta: bool = None, rev: str = None, revs: bool = None, revs_info: bool = None, **kwargs) DetailedResponse ¶
Retrieve a document.
Returns document with the specified doc_id from the specified database. Unless you request a specific revision, the latest revision of the document is always returned.
- Parameters:
db (str) – Path parameter to specify the database name.
doc_id (str) – Path parameter to specify the document ID.
if_none_match (str) – (optional) Header parameter to specify a double quoted document revision token for cache control.
attachments (bool) – (optional) Query parameter to specify whether to include attachments bodies in a response.
att_encoding_info (bool) – (optional) Query parameter to specify whether to include the encoding information in attachment stubs if the particular attachment is compressed.
conflicts (bool) – (optional) Query parameter to specify whether to include a list of conflicted revisions in each returned document. Active only when include_docs is true.
deleted_conflicts (bool) – (optional) Query parameter to specify whether to include a list of deleted conflicted revisions in the _deleted_conflicts property of the returned document.
latest (bool) – (optional) Query parameter to specify whether to force retrieving latest leaf revision, no matter what rev was requested.
local_seq (bool) – (optional) Query parameter to specify whether to include the last update sequence for the document.
meta (bool) – (optional) Query parameter to specify whether to include document meta information. Acts the same as specifying all of the conflicts, deleted_conflicts and open_revs query parameters.
rev (str) – (optional) Query parameter to specify a document revision.
revs (bool) – (optional) Query parameter to specify whether to include a list of all known document revisions.
revs_info (bool) – (optional) Query parameter to specify whether to includes detailed information for all known document revisions.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with dict result representing a Document object
- get_document_as_mixed(db: str, doc_id: str, *, if_none_match: str = None, attachments: bool = None, att_encoding_info: bool = None, conflicts: bool = None, deleted_conflicts: bool = None, latest: bool = None, local_seq: bool = None, meta: bool = None, rev: str = None, revs: bool = None, revs_info: bool = None, **kwargs) DetailedResponse ¶
Retrieve a document as mixed.
Returns document with the specified doc_id from the specified database. Unless you request a specific revision, the latest revision of the document is always returned.
- Parameters:
db (str) – Path parameter to specify the database name.
doc_id (str) – Path parameter to specify the document ID.
if_none_match (str) – (optional) Header parameter to specify a double quoted document revision token for cache control.
attachments (bool) – (optional) Query parameter to specify whether to include attachments bodies in a response.
att_encoding_info (bool) – (optional) Query parameter to specify whether to include the encoding information in attachment stubs if the particular attachment is compressed.
conflicts (bool) – (optional) Query parameter to specify whether to include a list of conflicted revisions in each returned document. Active only when include_docs is true.
deleted_conflicts (bool) – (optional) Query parameter to specify whether to include a list of deleted conflicted revisions in the _deleted_conflicts property of the returned document.
latest (bool) – (optional) Query parameter to specify whether to force retrieving latest leaf revision, no matter what rev was requested.
local_seq (bool) – (optional) Query parameter to specify whether to include the last update sequence for the document.
meta (bool) – (optional) Query parameter to specify whether to include document meta information. Acts the same as specifying all of the conflicts, deleted_conflicts and open_revs query parameters.
rev (str) – (optional) Query parameter to specify a document revision.
revs (bool) – (optional) Query parameter to specify whether to include a list of all known document revisions.
revs_info (bool) – (optional) Query parameter to specify whether to includes detailed information for all known document revisions.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with BinaryIO result
Retrieve a document as related.
Returns document with the specified doc_id from the specified database. Unless you request a specific revision, the latest revision of the document is always returned.
- Parameters:
db (str) – Path parameter to specify the database name.
doc_id (str) – Path parameter to specify the document ID.
if_none_match (str) – (optional) Header parameter to specify a double quoted document revision token for cache control.
attachments (bool) – (optional) Query parameter to specify whether to include attachments bodies in a response.
att_encoding_info (bool) – (optional) Query parameter to specify whether to include the encoding information in attachment stubs if the particular attachment is compressed.
conflicts (bool) – (optional) Query parameter to specify whether to include a list of conflicted revisions in each returned document. Active only when include_docs is true.
deleted_conflicts (bool) – (optional) Query parameter to specify whether to include a list of deleted conflicted revisions in the _deleted_conflicts property of the returned document.
latest (bool) – (optional) Query parameter to specify whether to force retrieving latest leaf revision, no matter what rev was requested.
local_seq (bool) – (optional) Query parameter to specify whether to include the last update sequence for the document.
meta (bool) – (optional) Query parameter to specify whether to include document meta information. Acts the same as specifying all of the conflicts, deleted_conflicts and open_revs query parameters.
rev (str) – (optional) Query parameter to specify a document revision.
revs (bool) – (optional) Query parameter to specify whether to include a list of all known document revisions.
revs_info (bool) – (optional) Query parameter to specify whether to includes detailed information for all known document revisions.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with BinaryIO result
- get_document_as_stream(db: str, doc_id: str, *, if_none_match: str = None, attachments: bool = None, att_encoding_info: bool = None, conflicts: bool = None, deleted_conflicts: bool = None, latest: bool = None, local_seq: bool = None, meta: bool = None, rev: str = None, revs: bool = None, revs_info: bool = None, **kwargs) DetailedResponse ¶
Retrieve a document as stream.
Returns document with the specified doc_id from the specified database. Unless you request a specific revision, the latest revision of the document is always returned.
- Parameters:
db (str) – Path parameter to specify the database name.
doc_id (str) – Path parameter to specify the document ID.
if_none_match (str) – (optional) Header parameter to specify a double quoted document revision token for cache control.
attachments (bool) – (optional) Query parameter to specify whether to include attachments bodies in a response.
att_encoding_info (bool) – (optional) Query parameter to specify whether to include the encoding information in attachment stubs if the particular attachment is compressed.
conflicts (bool) – (optional) Query parameter to specify whether to include a list of conflicted revisions in each returned document. Active only when include_docs is true.
deleted_conflicts (bool) – (optional) Query parameter to specify whether to include a list of deleted conflicted revisions in the _deleted_conflicts property of the returned document.
latest (bool) – (optional) Query parameter to specify whether to force retrieving latest leaf revision, no matter what rev was requested.
local_seq (bool) – (optional) Query parameter to specify whether to include the last update sequence for the document.
meta (bool) – (optional) Query parameter to specify whether to include document meta information. Acts the same as specifying all of the conflicts, deleted_conflicts and open_revs query parameters.
rev (str) – (optional) Query parameter to specify a document revision.
revs (bool) – (optional) Query parameter to specify whether to include a list of all known document revisions.
revs_info (bool) – (optional) Query parameter to specify whether to includes detailed information for all known document revisions.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with BinaryIO result
- get_document_shards_info(db: str, doc_id: str, **kwargs) DetailedResponse ¶
Retrieve shard information for a specific document.
Retrieves information about a specific shard where a particular document is stored, along with information about the nodes where that shard has a replica.
- Parameters:
db (str) – Path parameter to specify the database name.
doc_id (str) – Path parameter to specify the document ID.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with dict result representing a DocumentShardInfo object
- get_indexes_information(db: str, **kwargs) DetailedResponse ¶
Retrieve information about all indexes.
When you make a GET request to /db/_index, you get a list of all indexes used by Cloudant Query in the database, including the primary index. In addition to the information available through this API, indexes are also stored in the indexes property of design documents.
- Parameters:
db (str) – Path parameter to specify the database name.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with dict result representing a IndexesInformation object
- get_local_document(db: str, doc_id: str, *, accept: str = None, if_none_match: str = None, attachments: bool = None, att_encoding_info: bool = None, local_seq: bool = None, **kwargs) DetailedResponse ¶
Retrieve a local document.
Retrieves the specified local document. The semantics are identical to accessing a standard document in the specified database, except that the document is not replicated.
- Parameters:
db (str) – Path parameter to specify the database name.
doc_id (str) – Path parameter to specify the document ID.
accept (str) – (optional) The type of the response: application/json, multipart/mixed, multipart/related, or application/octet-stream.
if_none_match (str) – (optional) Header parameter to specify a double quoted document revision token for cache control.
attachments (bool) – (optional) Query parameter to specify whether to include attachments bodies in a response.
att_encoding_info (bool) – (optional) Query parameter to specify whether to include the encoding information in attachment stubs if the particular attachment is compressed.
local_seq (bool) – (optional) Query parameter to specify whether to include the last update sequence for the document.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with dict result representing a Document object
- get_membership_information(**kwargs) DetailedResponse ¶
Retrieve cluster membership information.
Displays the nodes that are part of the cluster as cluster_nodes. The field, all_nodes, displays all nodes this node knows about, including the ones that are part of the cluster. This endpoint is useful when you set up a cluster.
- Parameters:
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with dict result representing a MembershipInformation object
- get_partition_information(db: str, partition_key: str, **kwargs) DetailedResponse ¶
Retrieve information about a database partition.
Given a partition key, return the database name, sizes, partition, doc count, and doc delete count.
- Parameters:
db (str) – Path parameter to specify the database name.
partition_key (str) – Path parameter to specify the database partition key.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with dict result representing a PartitionInformation object
- get_replication_document(doc_id: str, *, if_none_match: str = None, attachments: bool = None, att_encoding_info: bool = None, conflicts: bool = None, deleted_conflicts: bool = None, latest: bool = None, local_seq: bool = None, meta: bool = None, rev: str = None, revs: bool = None, revs_info: bool = None, **kwargs) DetailedResponse ¶
Retrieve a replication document.
Retrieves a replication document from the _replicator database to view the configuration of the replication. The status of the replication is no longer recorded in the document but can be checked via the replication scheduler.
- Parameters:
doc_id (str) – Path parameter to specify the document ID.
if_none_match (str) – (optional) Header parameter to specify a double quoted document revision token for cache control.
attachments (bool) – (optional) Query parameter to specify whether to include attachments bodies in a response.
att_encoding_info (bool) – (optional) Query parameter to specify whether to include the encoding information in attachment stubs if the particular attachment is compressed.
conflicts (bool) – (optional) Query parameter to specify whether to include a list of conflicted revisions in each returned document. Active only when include_docs is true.
deleted_conflicts (bool) – (optional) Query parameter to specify whether to include a list of deleted conflicted revisions in the _deleted_conflicts property of the returned document.
latest (bool) – (optional) Query parameter to specify whether to force retrieving latest leaf revision, no matter what rev was requested.
local_seq (bool) – (optional) Query parameter to specify whether to include the last update sequence for the document.
meta (bool) – (optional) Query parameter to specify whether to include document meta information. Acts the same as specifying all of the conflicts, deleted_conflicts and open_revs query parameters.
rev (str) – (optional) Query parameter to specify a document revision.
revs (bool) – (optional) Query parameter to specify whether to include a list of all known document revisions.
revs_info (bool) – (optional) Query parameter to specify whether to includes detailed information for all known document revisions.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with dict result representing a ReplicationDocument object
- get_scheduler_docs(*, limit: int = None, skip: int = None, states: List[str] = None, **kwargs) DetailedResponse ¶
Retrieve replication scheduler documents.
Lists replication documents, including information about all documents, even the ones in a completed or failed state. For each document, the endpoint returns the document ID, database, replication ID, source and target, and other information.
- Parameters:
limit (int) – (optional) Query parameter to specify the number of returned documents to limit the result to.
skip (int) – (optional) Query parameter to specify the number of records before starting to return the results.
states (List[str]) – (optional) Query parameter to include only replication documents in the specified states. String must be a comma-delimited string.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with dict result representing a SchedulerDocsResult object
- get_scheduler_document(doc_id: str, **kwargs) DetailedResponse ¶
Retrieve a replication scheduler document.
Retrieves information about a replication document from the replicator database. The endpoint returns the document ID, database, replication ID, source and target, and other information.
- Parameters:
doc_id (str) – Path parameter to specify the document ID.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with dict result representing a SchedulerDocument object
- get_scheduler_job(job_id: str, **kwargs) DetailedResponse ¶
Retrieve a replication scheduler job.
Retrieves the state of a single replication task based on its replication ID.
- Parameters:
job_id (str) – Path parameter to specify the replication job id.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with dict result representing a SchedulerJob object
- get_scheduler_jobs(*, limit: int = None, skip: int = None, **kwargs) DetailedResponse ¶
Retrieve replication scheduler jobs.
Retrieves information about replications that were created via /_replicate endpoint, as well as those created from replication documents. It doesn’t include replications that completed or failed to start because replication documents were malformed. Each job description includes source and target information, replication ID, history of recent events, and other information.
- Parameters:
limit (int) – (optional) Query parameter to specify the number of returned jobs to limit the result to.
skip (int) – (optional) Query parameter to specify the number of records before starting to return the results.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with dict result representing a SchedulerJobsResult object
- get_search_info(db: str, ddoc: str, index: str, **kwargs) DetailedResponse ¶
Retrieve information about a search index.
Retrieve search index metadata information, such as the size of the index on disk.
- Parameters:
db (str) – Path parameter to specify the database name.
ddoc (str) – Path parameter to specify the design document name. The design document name is the design document ID excluding the _design/ prefix.
index (str) – Path parameter to specify the index name.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with dict result representing a SearchInfoResult object
- get_security(db: str, **kwargs) DetailedResponse ¶
Retrieve database permissions information.
See who has permission to read, write, and manage the database. The credentials you use to log in to the dashboard automatically include _admin permissions to all databases you create. Everyone and everything else, including users you share databases with and API keys you create, must be given a permission level explicitly.
- Parameters:
db (str) – Path parameter to specify the database name.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with dict result representing a Security object
- get_server_information(**kwargs) DetailedResponse ¶
Retrieve server instance information.
When you access the root of an instance, IBM Cloudant returns meta-information about the instance. The response includes a JSON structure that contains information about the server, including a welcome message and the server’s version. Tip: The authentication for this endpoint is only enforced when using IAM.
- Parameters:
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with dict result representing a ServerInformation object
- get_session_information(**kwargs) DetailedResponse ¶
Retrieve current session cookie information.
Retrieves information about the authenticated user’s session.
- Parameters:
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with dict result representing a SessionInformation object
- get_shards_information(db: str, **kwargs) DetailedResponse ¶
Retrieve shard information.
List each shard range and the corresponding replicas for a specified database.
- Parameters:
db (str) – Path parameter to specify the database name.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with dict result representing a ShardsInformation object
- get_up_information(**kwargs) DetailedResponse ¶
Retrieve information about whether the server is up.
Confirms that the server is up, running, and ready to respond to requests. If maintenance_mode is true or nolb, the endpoint returns a 404 response. Tip: The authentication for this endpoint is only enforced when using IAM.
- Parameters:
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with dict result representing a UpInformation object
- get_uuids(*, count: int = None, **kwargs) DetailedResponse ¶
Retrieve one or more UUIDs.
Requests one or more Universally Unique Identifiers (UUIDs) from the instance. The response is a JSON object that provides a list of UUIDs. Tip: The authentication for this endpoint is only enforced when using IAM.
- Parameters:
count (int) – (optional) Query parameter to specify the number of UUIDs to return.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with dict result representing a UuidsResult object
- head_attachment(db: str, doc_id: str, attachment_name: str, *, if_match: str = None, if_none_match: str = None, rev: str = None, **kwargs) DetailedResponse ¶
Retrieve the HTTP headers for an attachment.
Returns the HTTP headers that contain a minimal amount of information about the specified attachment. This method supports the same query arguments as the GET /{db}/{doc_id}/{attachment_name} method, but only the header information (including attachment size, encoding, and the MD5 hash as an ETag), is returned.
- Parameters:
db (str) – Path parameter to specify the database name.
doc_id (str) – Path parameter to specify the document ID.
attachment_name (str) – Path parameter to specify the attachment name.
if_match (str) – (optional) Header parameter to specify the document revision. Alternative to rev query parameter.
if_none_match (str) – (optional) Header parameter to specify a double quoted document revision token for cache control.
rev (str) – (optional) Query parameter to specify a document revision.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse
- head_database(db: str, **kwargs) DetailedResponse ¶
Retrieve the HTTP headers for a database.
Returns the HTTP headers that contain a minimal amount of information about the specified database. Since the response body is empty, using the HEAD method is a lightweight way to check if the database exists or not.
- Parameters:
db (str) – Path parameter to specify the database name.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse
- head_design_document(db: str, ddoc: str, *, if_none_match: str = None, **kwargs) DetailedResponse ¶
Retrieve the HTTP headers for a design document.
This method supports the same query arguments as the GET /{db}/_design/{ddoc} method, but the results include only the header information (including design document size, and the revision as an ETag). The ETag header shows the current revision for the requested design document, and if you requested the design document in full, the Content-Length specifies the length of the data. If you add any of the query arguments, then the resulting HTTP headers correspond to what is returned for the equivalent GET request.
- Parameters:
db (str) – Path parameter to specify the database name.
ddoc (str) – Path parameter to specify the design document name. The design document name is the design document ID excluding the _design/ prefix.
if_none_match (str) – (optional) Header parameter to specify a double quoted document revision token for cache control.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse
- head_document(db: str, doc_id: str, *, if_none_match: str = None, latest: bool = None, rev: str = None, **kwargs) DetailedResponse ¶
Retrieve the HTTP headers for the document.
This method supports the same query arguments as the GET /{db}/{docid} method, but only the header information (including document size and the revision as an ETag) is returned. The ETag header shows the current revision for the requested document, and the Content-Length specifies the length of the data if the document was requested in full. Add any of the query arguments, then the resulting HTTP headers that correspond to it are returned.
- Parameters:
db (str) – Path parameter to specify the database name.
doc_id (str) – Path parameter to specify the document ID.
if_none_match (str) – (optional) Header parameter to specify a double quoted document revision token for cache control.
latest (bool) – (optional) Query parameter to specify whether to force retrieving latest leaf revision, no matter what rev was requested.
rev (str) – (optional) Query parameter to specify a document revision.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse
- head_local_document(db: str, doc_id: str, *, if_none_match: str = None, **kwargs) DetailedResponse ¶
Retrieve HTTP headers for a local document.
Retrieves the HTTP headers containing minimal amount of information about the specified local document. Since the response body is empty, using the HEAD method is a lightweight way to check if the local document exists or not.
- Parameters:
db (str) – Path parameter to specify the database name.
doc_id (str) – Path parameter to specify the document ID.
if_none_match (str) – (optional) Header parameter to specify a double quoted document revision token for cache control.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse
- head_replication_document(doc_id: str, *, if_none_match: str = None, **kwargs) DetailedResponse ¶
Retrieve the HTTP headers for a replication document.
Retrieves the HTTP headers containing minimal amount of information about the specified replication document from the _replicator database. The method supports the same query arguments as the GET /_replicator/{doc_id} method, but only headers like content length and the revision (ETag header) are returned.
- Parameters:
doc_id (str) – Path parameter to specify the document ID.
if_none_match (str) – (optional) Header parameter to specify a double quoted document revision token for cache control.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse
- head_scheduler_document(doc_id: str, **kwargs) DetailedResponse ¶
Retrieve HTTP headers for a replication scheduler document.
Retrieves the HTTP headers containing minimal amount of information about the specified replication scheduler document. Since the response body is empty, using the HEAD method is a lightweight way to check if the replication scheduler document exists or not.
- Parameters:
doc_id (str) – Path parameter to specify the document ID.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse
- head_scheduler_job(job_id: str, **kwargs) DetailedResponse ¶
Retrieve the HTTP headers for a replication scheduler job.
Returns the HTTP headers that contain a minimal amount of information about the specified replication task. Only the header information is returned.
- Parameters:
job_id (str) – Path parameter to specify the replication job id.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse
- head_up_information(**kwargs) DetailedResponse ¶
Retrieve HTTP headers about whether the server is up.
Retrieves the HTTP headers about whether the server is up.
- Parameters:
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse
- classmethod new_instance(service_name: str = 'cloudant') CloudantV1 ¶
- Return a new client for the Cloudant service using the specified parameters
and external configuration.
- post_activity_tracker_events(types: List[str], **kwargs) DetailedResponse ¶
Modify Activity Tracker events configuration.
Configure event types that are being sent to IBM Cloud Activity Tracker for the IBM Cloudant instance.
- Parameters:
types (List[str]) – An array of event types that are being sent to IBM Cloud Activity Tracker for the IBM Cloudant instance. “management” is a required element of this array.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with dict result representing a Ok object
- post_all_docs(db: str, *, att_encoding_info: bool = None, attachments: bool = None, conflicts: bool = None, descending: bool = None, include_docs: bool = None, inclusive_end: bool = None, limit: int = None, skip: int = None, update_seq: bool = None, end_key: str = None, key: str = None, keys: List[str] = None, start_key: str = None, **kwargs) DetailedResponse ¶
Query a list of all documents in a database.
Queries the primary index (all document IDs). The results that match the request body parameters are returned in a JSON object, including a list of matching documents with basic contents, such as the ID and revision. When no request body parameters are specified, results for all documents in the database are returned. Optionally, document content or additional metadata can be included in the response.
- Parameters:
db (str) – Path parameter to specify the database name.
att_encoding_info (bool) – (optional) Parameter to specify whether to include the encoding information in attachment stubs if the particular attachment is compressed.
attachments (bool) – (optional) Parameter to specify whether to include attachments bodies in a response.
conflicts (bool) – (optional) Parameter to specify whether to include a list of conflicted revisions in each returned document. Active only when include_docs is true.
descending (bool) – (optional) Parameter to specify whether to return the documents in descending by key order.
include_docs (bool) – (optional) Parameter to specify whether to include the full content of the documents in the response.
inclusive_end (bool) – (optional) Parameter to specify whether the specified end key should be included in the result.
limit (int) – (optional) Parameter to specify the number of returned documents to limit the result to.
skip (int) – (optional) Parameter to specify the number of records before starting to return the results.
update_seq (bool) – (optional) Parameter to specify whether to include in the response an update_seq value indicating the sequence id of the database the view reflects.
end_key (str) – (optional) Schema for a document ID.
key (str) – (optional) Schema for a document ID.
keys (List[str]) – (optional) Schema for a list of document IDs.
start_key (str) – (optional) Schema for a document ID.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with dict result representing a AllDocsResult object
- post_all_docs_as_stream(db: str, *, att_encoding_info: bool = None, attachments: bool = None, conflicts: bool = None, descending: bool = None, include_docs: bool = None, inclusive_end: bool = None, limit: int = None, skip: int = None, update_seq: bool = None, end_key: str = None, key: str = None, keys: List[str] = None, start_key: str = None, **kwargs) DetailedResponse ¶
Query a list of all documents in a database as stream.
Queries the primary index (all document IDs). The results that match the request body parameters are returned in a JSON object, including a list of matching documents with basic contents, such as the ID and revision. When no request body parameters are specified, results for all documents in the database are returned. Optionally, document content or additional metadata can be included in the response.
- Parameters:
db (str) – Path parameter to specify the database name.
att_encoding_info (bool) – (optional) Parameter to specify whether to include the encoding information in attachment stubs if the particular attachment is compressed.
attachments (bool) – (optional) Parameter to specify whether to include attachments bodies in a response.
conflicts (bool) – (optional) Parameter to specify whether to include a list of conflicted revisions in each returned document. Active only when include_docs is true.
descending (bool) – (optional) Parameter to specify whether to return the documents in descending by key order.
include_docs (bool) – (optional) Parameter to specify whether to include the full content of the documents in the response.
inclusive_end (bool) – (optional) Parameter to specify whether the specified end key should be included in the result.
limit (int) – (optional) Parameter to specify the number of returned documents to limit the result to.
skip (int) – (optional) Parameter to specify the number of records before starting to return the results.
update_seq (bool) – (optional) Parameter to specify whether to include in the response an update_seq value indicating the sequence id of the database the view reflects.
end_key (str) – (optional) Schema for a document ID.
key (str) – (optional) Schema for a document ID.
keys (List[str]) – (optional) Schema for a list of document IDs.
start_key (str) – (optional) Schema for a document ID.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with BinaryIO result
- post_all_docs_queries(db: str, queries: List[AllDocsQuery], **kwargs) DetailedResponse ¶
Multi-query the list of all documents in a database.
Runs multiple queries using the primary index (all document IDs). Returns a JSON object that contains a list of result objects, one for each query, with a structure equivalent to that of a single _all_docs request. This enables you to request multiple queries in a single request, in place of multiple POST /{db}/_all_docs requests.
- Parameters:
db (str) – Path parameter to specify the database name.
queries (List[AllDocsQuery]) – An array of query objects with fields for the parameters of each individual view query to be executed. The field names and their meaning are the same as the query parameters of a regular /_all_docs request.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with dict result representing a AllDocsQueriesResult object
- post_all_docs_queries_as_stream(db: str, queries: List[AllDocsQuery], **kwargs) DetailedResponse ¶
Multi-query the list of all documents in a database as stream.
Runs multiple queries using the primary index (all document IDs). Returns a JSON object that contains a list of result objects, one for each query, with a structure equivalent to that of a single _all_docs request. This enables you to request multiple queries in a single request, in place of multiple POST /{db}/_all_docs requests.
- Parameters:
db (str) – Path parameter to specify the database name.
queries (List[AllDocsQuery]) – An array of query objects with fields for the parameters of each individual view query to be executed. The field names and their meaning are the same as the query parameters of a regular /_all_docs request.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with BinaryIO result
- post_api_keys(**kwargs) DetailedResponse ¶
Generates API keys for apps or persons to enable database access.
Generates API keys to enable database access for a person or application, but without creating a new IBM Cloudant account for that person or application. An API key is a randomly generated username and password. The key is given the wanted access permissions for a database.
- Parameters:
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with dict result representing a ApiKeysResult object
- post_bulk_docs(db: str, bulk_docs: Union[BulkDocs, BinaryIO], **kwargs) DetailedResponse ¶
Bulk modify multiple documents in a database.
The bulk document API allows you to create, update, and delete multiple documents at the same time within a single request. The basic operation is similar to creating, updating, or deleting a single document, except that you batch the document structure and information.
- Parameters:
db (str) – Path parameter to specify the database name.
bulk_docs (BulkDocs) – HTTP request body for postBulkDocs.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with List[DocumentResult] result
- post_bulk_get(db: str, docs: List[BulkGetQueryDocument], *, attachments: bool = None, att_encoding_info: bool = None, latest: bool = None, revs: bool = None, **kwargs) DetailedResponse ¶
Bulk query revision information for multiple documents.
Fetch specific revisions or revision histories for multiple documents in bulk as replicators do.
- Parameters:
db (str) – Path parameter to specify the database name.
docs (List[BulkGetQueryDocument]) – List of document items to get in bulk.
attachments (bool) – (optional) Query parameter to specify whether to include attachments bodies in a response.
att_encoding_info (bool) – (optional) Query parameter to specify whether to include the encoding information in attachment stubs if the particular attachment is compressed.
latest (bool) – (optional) Query parameter to specify whether to force retrieving latest leaf revision, no matter what rev was requested.
revs (bool) – (optional) Query parameter to specify whether to include a list of all known document revisions.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with dict result representing a BulkGetResult object
- post_bulk_get_as_mixed(db: str, docs: List[BulkGetQueryDocument], *, attachments: bool = None, att_encoding_info: bool = None, latest: bool = None, revs: bool = None, **kwargs) DetailedResponse ¶
Bulk query revision information for multiple documents as mixed.
Fetch specific revisions or revision histories for multiple documents in bulk as replicators do.
- Parameters:
db (str) – Path parameter to specify the database name.
docs (List[BulkGetQueryDocument]) – List of document items to get in bulk.
attachments (bool) – (optional) Query parameter to specify whether to include attachments bodies in a response.
att_encoding_info (bool) – (optional) Query parameter to specify whether to include the encoding information in attachment stubs if the particular attachment is compressed.
latest (bool) – (optional) Query parameter to specify whether to force retrieving latest leaf revision, no matter what rev was requested.
revs (bool) – (optional) Query parameter to specify whether to include a list of all known document revisions.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with BinaryIO result
Bulk query revision information for multiple documents as related.
Fetch specific revisions or revision histories for multiple documents in bulk as replicators do.
- Parameters:
db (str) – Path parameter to specify the database name.
docs (List[BulkGetQueryDocument]) – List of document items to get in bulk.
attachments (bool) – (optional) Query parameter to specify whether to include attachments bodies in a response.
att_encoding_info (bool) – (optional) Query parameter to specify whether to include the encoding information in attachment stubs if the particular attachment is compressed.
latest (bool) – (optional) Query parameter to specify whether to force retrieving latest leaf revision, no matter what rev was requested.
revs (bool) – (optional) Query parameter to specify whether to include a list of all known document revisions.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with BinaryIO result
- post_bulk_get_as_stream(db: str, docs: List[BulkGetQueryDocument], *, attachments: bool = None, att_encoding_info: bool = None, latest: bool = None, revs: bool = None, **kwargs) DetailedResponse ¶
Bulk query revision information for multiple documents as stream.
Fetch specific revisions or revision histories for multiple documents in bulk as replicators do.
- Parameters:
db (str) – Path parameter to specify the database name.
docs (List[BulkGetQueryDocument]) – List of document items to get in bulk.
attachments (bool) – (optional) Query parameter to specify whether to include attachments bodies in a response.
att_encoding_info (bool) – (optional) Query parameter to specify whether to include the encoding information in attachment stubs if the particular attachment is compressed.
latest (bool) – (optional) Query parameter to specify whether to force retrieving latest leaf revision, no matter what rev was requested.
revs (bool) – (optional) Query parameter to specify whether to include a list of all known document revisions.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with BinaryIO result
- post_changes(db: str, *, doc_ids: List[str] = None, fields: List[str] = None, selector: dict = None, last_event_id: str = None, att_encoding_info: bool = None, attachments: bool = None, conflicts: bool = None, descending: bool = None, feed: str = None, filter: str = None, heartbeat: int = None, include_docs: bool = None, limit: int = None, seq_interval: int = None, since: str = None, style: str = None, timeout: int = None, view: str = None, **kwargs) DetailedResponse ¶
Query the database document changes feed.
Requests the database changes feed in the same way as GET /{db}/_changes does. It is widely used with the filter query parameter because it allows one to pass more information to the filter. ### Note Before using the changes feed we recommend reading the [FAQs](https://cloud.ibm.com/docs/Cloudant?topic=Cloudant-faq-using-changes-feed) to understand the limitations and appropriate use cases.
- Parameters:
db (str) – Path parameter to specify the database name.
doc_ids (List[str]) – (optional) Schema for a list of document IDs.
fields (List[str]) – (optional) JSON array that uses the field syntax. Use this parameter to specify which fields of a document must be returned. If it is omitted, the entire document is returned.
selector (dict) –
(optional) JSON object describing criteria used to select documents. The selector specifies fields in the document, and provides an expression to evaluate with the field content or other data. The selector object must:
Be structured as valid JSON.
Contain a valid query expression.
Using a selector is significantly more efficient than using a JavaScript filter function, and is the recommended option if filtering on document attributes only. Elementary selector syntax requires you to specify one or more fields, and the corresponding values required for those fields. You can create more complex selector expressions by combining operators. Operators are identified by the use of a dollar sign $ prefix in the name field. There are two core types of operators in the selector syntax: * Combination operators: applied at the topmost level of selection. They are used to combine selectors. In addition to the common boolean operators ($and, $or, $not, $nor) there are three combination operators: $all, $elemMatch, and $allMatch. A combination operator takes a single argument. The argument is either another selector, or an array of selectors. * Condition operators: are specific to a field, and are used to evaluate the value stored in that field. For instance, the basic $eq operator matches when the specified field contains a value that is equal to the supplied argument. * Only equality operators such as $eq, $gt, $gte, $lt, and $lte (but not $ne) can be used as the basis of a query. You should include at least one of these in a selector. For further reference see [selector syntax](https://cloud.ibm.com/docs/Cloudant?topic=Cloudant-query#selector-syntax).
last_event_id (str) – (optional) Header parameter to specify the ID of the last events received by the server on a previous connection. Overrides since query parameter.
att_encoding_info (bool) – (optional) Query parameter to specify whether to include the encoding information in attachment stubs if the particular attachment is compressed.
attachments (bool) – (optional) Query parameter to specify whether to include attachments bodies in a response.
conflicts (bool) – (optional) Query parameter to specify whether to include a list of conflicted revisions in each returned document. Active only when include_docs is true.
descending (bool) – (optional) Query parameter to specify whether to return the documents in descending by key order.
feed (str) – (optional) Query parameter to specify the changes feed type.
filter (str) –
(optional) Query parameter to specify a filter function from a design document that will filter the changes stream emitting only filtered events. For example: design_doc/filtername. Additionally, some keywords are reserved for built-in filters:
_design - Returns only changes to design documents.
_doc_ids - Returns changes for documents with an ID matching one
- specified in
doc_ids request body parameter.
- _selector - Returns changes for documents that match the selector
request body parameter. The selector syntax is the same as used for _find.
- _view - Returns changes for documents that match an existing map
function in the view specified by the query parameter view.
heartbeat (int) – (optional) Query parameter to specify the period in milliseconds after which an empty line is sent in the results. Only applicable for longpoll, continuous, and eventsource feeds. Overrides any timeout to keep the feed alive indefinitely. May also be true to use default value of 60000.
include_docs (bool) – (optional) Query parameter to specify whether to include the full content of the documents in the response.
limit (int) – (optional) Query parameter to specify the number of returned documents to limit the result to.
seq_interval (int) – (optional) Query parameter to specify that the update seq should only be calculated with every Nth result returned. When fetching changes in a batch, setting <code>seq_interval=<batch size></code>, where <batch size> is the number of results requested per batch, load can be reduced on the source database as computing the seq value across many shards (especially in highly-sharded databases) is expensive.
since (str) – (optional) Query parameter to specify to start the results from the change immediately after the given update sequence. Can be a valid update sequence or now value. Default is 0 i.e. all changes.
style (str) – (optional) Query parameter to specify how many revisions are returned in the changes array. The default, main_only, will only return the current “winning” revision; all_docs will return all leaf revisions (including conflicts and deleted former conflicts).
timeout (int) – (optional) Query parameter to specify the maximum period in milliseconds to wait for a change before the response is sent, even if there are no results. Only applicable for longpoll or continuous feeds. Default value is specified by httpd/changes_timeout configuration option. Note that 60000 value is also the default maximum timeout to prevent undetected dead connections.
view (str) – (optional) Query parameter to specify a view function as a filter. Documents pass the filter if the view’s map function emits at least one record for them.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with dict result representing a ChangesResult object
- post_changes_as_stream(db: str, *, doc_ids: List[str] = None, fields: List[str] = None, selector: dict = None, last_event_id: str = None, att_encoding_info: bool = None, attachments: bool = None, conflicts: bool = None, descending: bool = None, feed: str = None, filter: str = None, heartbeat: int = None, include_docs: bool = None, limit: int = None, seq_interval: int = None, since: str = None, style: str = None, timeout: int = None, view: str = None, **kwargs) DetailedResponse ¶
Query the database document changes feed as stream.
Requests the database changes feed in the same way as GET /{db}/_changes does. It is widely used with the filter query parameter because it allows one to pass more information to the filter. ### Note Before using the changes feed we recommend reading the [FAQs](https://cloud.ibm.com/docs/Cloudant?topic=Cloudant-faq-using-changes-feed) to understand the limitations and appropriate use cases.
- Parameters:
db (str) – Path parameter to specify the database name.
doc_ids (List[str]) – (optional) Schema for a list of document IDs.
fields (List[str]) – (optional) JSON array that uses the field syntax. Use this parameter to specify which fields of a document must be returned. If it is omitted, the entire document is returned.
selector (dict) –
(optional) JSON object describing criteria used to select documents. The selector specifies fields in the document, and provides an expression to evaluate with the field content or other data. The selector object must:
Be structured as valid JSON.
Contain a valid query expression.
Using a selector is significantly more efficient than using a JavaScript filter function, and is the recommended option if filtering on document attributes only. Elementary selector syntax requires you to specify one or more fields, and the corresponding values required for those fields. You can create more complex selector expressions by combining operators. Operators are identified by the use of a dollar sign $ prefix in the name field. There are two core types of operators in the selector syntax: * Combination operators: applied at the topmost level of selection. They are used to combine selectors. In addition to the common boolean operators ($and, $or, $not, $nor) there are three combination operators: $all, $elemMatch, and $allMatch. A combination operator takes a single argument. The argument is either another selector, or an array of selectors. * Condition operators: are specific to a field, and are used to evaluate the value stored in that field. For instance, the basic $eq operator matches when the specified field contains a value that is equal to the supplied argument. * Only equality operators such as $eq, $gt, $gte, $lt, and $lte (but not $ne) can be used as the basis of a query. You should include at least one of these in a selector. For further reference see [selector syntax](https://cloud.ibm.com/docs/Cloudant?topic=Cloudant-query#selector-syntax).
last_event_id (str) – (optional) Header parameter to specify the ID of the last events received by the server on a previous connection. Overrides since query parameter.
att_encoding_info (bool) – (optional) Query parameter to specify whether to include the encoding information in attachment stubs if the particular attachment is compressed.
attachments (bool) – (optional) Query parameter to specify whether to include attachments bodies in a response.
conflicts (bool) – (optional) Query parameter to specify whether to include a list of conflicted revisions in each returned document. Active only when include_docs is true.
descending (bool) – (optional) Query parameter to specify whether to return the documents in descending by key order.
feed (str) – (optional) Query parameter to specify the changes feed type.
filter (str) –
(optional) Query parameter to specify a filter function from a design document that will filter the changes stream emitting only filtered events. For example: design_doc/filtername. Additionally, some keywords are reserved for built-in filters:
_design - Returns only changes to design documents.
_doc_ids - Returns changes for documents with an ID matching one
- specified in
doc_ids request body parameter.
- _selector - Returns changes for documents that match the selector
request body parameter. The selector syntax is the same as used for _find.
- _view - Returns changes for documents that match an existing map
function in the view specified by the query parameter view.
heartbeat (int) – (optional) Query parameter to specify the period in milliseconds after which an empty line is sent in the results. Only applicable for longpoll, continuous, and eventsource feeds. Overrides any timeout to keep the feed alive indefinitely. May also be true to use default value of 60000.
include_docs (bool) – (optional) Query parameter to specify whether to include the full content of the documents in the response.
limit (int) – (optional) Query parameter to specify the number of returned documents to limit the result to.
seq_interval (int) – (optional) Query parameter to specify that the update seq should only be calculated with every Nth result returned. When fetching changes in a batch, setting <code>seq_interval=<batch size></code>, where <batch size> is the number of results requested per batch, load can be reduced on the source database as computing the seq value across many shards (especially in highly-sharded databases) is expensive.
since (str) – (optional) Query parameter to specify to start the results from the change immediately after the given update sequence. Can be a valid update sequence or now value. Default is 0 i.e. all changes.
style (str) – (optional) Query parameter to specify how many revisions are returned in the changes array. The default, main_only, will only return the current “winning” revision; all_docs will return all leaf revisions (including conflicts and deleted former conflicts).
timeout (int) – (optional) Query parameter to specify the maximum period in milliseconds to wait for a change before the response is sent, even if there are no results. Only applicable for longpoll or continuous feeds. Default value is specified by httpd/changes_timeout configuration option. Note that 60000 value is also the default maximum timeout to prevent undetected dead connections.
view (str) – (optional) Query parameter to specify a view function as a filter. Documents pass the filter if the view’s map function emits at least one record for them.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with BinaryIO result
- post_dbs_info(keys: List[str], **kwargs) DetailedResponse ¶
Query information about multiple databases.
This operation enables you to request information about multiple databases in a single request, instead of issuing multiple GET /{db} requests. It returns a list that contains an information object for each database specified in the request.
- Parameters:
keys (List[str]) – A list of database names.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with List[DbsInfoResult] result
- post_design_docs(db: str, *, att_encoding_info: bool = None, attachments: bool = None, conflicts: bool = None, descending: bool = None, include_docs: bool = None, inclusive_end: bool = None, limit: int = None, skip: int = None, update_seq: bool = None, end_key: str = None, key: str = None, keys: List[str] = None, start_key: str = None, accept: str = None, **kwargs) DetailedResponse ¶
Query a list of all design documents in a database.
Queries the index of all design document IDs. The results matching the request body parameters are returned in a JSON object, including a list of matching design documents with basic contents, such as the ID and revision. When no request body parameters are specified, results for all design documents in the database are returned. Optionally, the design document content or additional metadata can be included in the response.
- Parameters:
db (str) – Path parameter to specify the database name.
att_encoding_info (bool) – (optional) Parameter to specify whether to include the encoding information in attachment stubs if the particular attachment is compressed.
attachments (bool) – (optional) Parameter to specify whether to include attachments bodies in a response.
conflicts (bool) – (optional) Parameter to specify whether to include a list of conflicted revisions in each returned document. Active only when include_docs is true.
descending (bool) – (optional) Parameter to specify whether to return the documents in descending by key order.
include_docs (bool) – (optional) Parameter to specify whether to include the full content of the documents in the response.
inclusive_end (bool) – (optional) Parameter to specify whether the specified end key should be included in the result.
limit (int) – (optional) Parameter to specify the number of returned documents to limit the result to.
skip (int) – (optional) Parameter to specify the number of records before starting to return the results.
update_seq (bool) – (optional) Parameter to specify whether to include in the response an update_seq value indicating the sequence id of the database the view reflects.
end_key (str) – (optional) Schema for a document ID.
key (str) – (optional) Schema for a document ID.
keys (List[str]) – (optional) Schema for a list of document IDs.
start_key (str) – (optional) Schema for a document ID.
accept (str) – (optional) The type of the response: application/json or application/octet-stream.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with dict result representing a AllDocsResult object
- post_design_docs_queries(db: str, queries: List[AllDocsQuery], *, accept: str = None, **kwargs) DetailedResponse ¶
Multi-query the list of all design documents.
This operation runs multiple view queries of all design documents in the database. This operation enables you to request numerous queries in a single request, in place of multiple POST /{db}/_design_docs requests.
- Parameters:
db (str) – Path parameter to specify the database name.
queries (List[AllDocsQuery]) – An array of query objects with fields for the parameters of each individual view query to be executed. The field names and their meaning are the same as the query parameters of a regular /_all_docs request.
accept (str) – (optional) The type of the response: application/json or application/octet-stream.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with dict result representing a AllDocsQueriesResult object
- post_document(db: str, document: Union[Document, BinaryIO], *, content_type: str = None, batch: str = None, **kwargs) DetailedResponse ¶
Create or modify a document in a database.
Creates or modifies a document in the specified database by using the supplied JSON document. For creation, you may specify the document ID but you should not specify the revision. If you don’t specify the document ID, then the server generates an ID for your document. For modification, you must specify the document ID and a revision identifier in the JSON document. If your document ID includes the _local/ or _design/ prefix, then this operation creates or modifies a local or a design document respectively.
- Parameters:
db (str) – Path parameter to specify the database name.
document (Document) – HTTP request body for Document operations.
content_type (str) – (optional) The type of the input.
batch (str) – (optional) Query parameter to specify whether to store in batch mode. The server will respond with a HTTP 202 Accepted response code immediately.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with dict result representing a DocumentResult object
- post_explain(db: str, selector: dict, *, bookmark: str = None, conflicts: bool = None, execution_stats: bool = None, fields: List[str] = None, limit: int = None, skip: int = None, sort: List[dict] = None, stable: bool = None, update: str = None, use_index: List[str] = None, r: int = None, **kwargs) DetailedResponse ¶
Retrieve information about which index is used for a query.
Shows which index is being used by the query. Parameters are the same as the [_find endpoint](#query-an-index-by-using-selector-syntax).
- Parameters:
db (str) – Path parameter to specify the database name.
selector (dict) –
JSON object describing criteria used to select documents. The selector specifies fields in the document, and provides an expression to evaluate with the field content or other data. The selector object must:
Be structured as valid JSON.
Contain a valid query expression.
Using a selector is significantly more efficient than using a JavaScript filter function, and is the recommended option if filtering on document attributes only. Elementary selector syntax requires you to specify one or more fields, and the corresponding values required for those fields. You can create more complex selector expressions by combining operators. Operators are identified by the use of a dollar sign $ prefix in the name field. There are two core types of operators in the selector syntax: * Combination operators: applied at the topmost level of selection. They are used to combine selectors. In addition to the common boolean operators ($and, $or, $not, $nor) there are three combination operators: $all, $elemMatch, and $allMatch. A combination operator takes a single argument. The argument is either another selector, or an array of selectors. * Condition operators: are specific to a field, and are used to evaluate the value stored in that field. For instance, the basic $eq operator matches when the specified field contains a value that is equal to the supplied argument. * Only equality operators such as $eq, $gt, $gte, $lt, and $lte (but not $ne) can be used as the basis of a query. You should include at least one of these in a selector. For further reference see [selector syntax](https://cloud.ibm.com/docs/Cloudant?topic=Cloudant-query#selector-syntax).
bookmark (str) – (optional) Opaque bookmark token used when paginating results.
conflicts (bool) – (optional) A boolean value that indicates whether or not to include information about existing conflicts in the document.
execution_stats (bool) – (optional) Use this option to find information about the query that was run. This information includes total key lookups, total document lookups (when include_docs=true is used), and total quorum document lookups (when each document replica is fetched).
fields (List[str]) – (optional) JSON array that uses the field syntax. Use this parameter to specify which fields of a document must be returned. If it is omitted, the entire document is returned.
limit (int) – (optional) Maximum number of results returned. The type: text indexes are limited to 200 results when queried.
skip (int) – (optional) Skip the first ‘n’ results, where ‘n’ is the value that is specified.
sort (List[dict]) – (optional) The sort field contains a list of pairs, each mapping a field name to a sort direction (asc or desc). The first field name and direction pair is the topmost level of sort. The second pair, if provided, is the next level of sort. The field can be any field, using dotted notation if desired for sub-document fields. For example in JSON: [{“fieldName1”: “desc”}, {“fieldName2.subFieldName1”: “desc”}] When sorting with multiple fields, ensure that there is an index already defined with all the sort fields in the same order and each object in the sort array has a single key or at least one of the sort fields is included in the selector. All sorting fields must use the same sort direction, either all ascending or all descending.
stable (bool) – (optional) Whether or not the view results should be returned from a “stable” set of shards.
update (str) – (optional) Whether to update the index prior to returning the result.
use_index (List[str]) – (optional) Use this option to identify a specific index for query to run against, rather than by using the IBM Cloudant Query algorithm to find the best index.
r (int) – (optional) The read quorum that is needed for the result. The value defaults to 1, in which case the document that was found in the index is returned. If set to a higher value, each document is read from at least that many replicas before it is returned in the results. The request will take more time than using only the document that is stored locally with the index.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with dict result representing a ExplainResult object
- post_find(db: str, selector: dict, *, bookmark: str = None, conflicts: bool = None, execution_stats: bool = None, fields: List[str] = None, limit: int = None, skip: int = None, sort: List[dict] = None, stable: bool = None, update: str = None, use_index: List[str] = None, r: int = None, **kwargs) DetailedResponse ¶
Query an index by using selector syntax.
Query documents by using a declarative JSON querying syntax. It’s best practice to create an appropriate index for all fields in selector by using the _index endpoint. Queries without an appropriate backing index will fallback to using the built-in _all_docs index. This is not recommended because it has a significant performance impact causing a full scan of the database with each request. In this case the response body will include a warning field recommending that an index is created.
- Parameters:
db (str) – Path parameter to specify the database name.
selector (dict) –
JSON object describing criteria used to select documents. The selector specifies fields in the document, and provides an expression to evaluate with the field content or other data. The selector object must:
Be structured as valid JSON.
Contain a valid query expression.
Using a selector is significantly more efficient than using a JavaScript filter function, and is the recommended option if filtering on document attributes only. Elementary selector syntax requires you to specify one or more fields, and the corresponding values required for those fields. You can create more complex selector expressions by combining operators. Operators are identified by the use of a dollar sign $ prefix in the name field. There are two core types of operators in the selector syntax: * Combination operators: applied at the topmost level of selection. They are used to combine selectors. In addition to the common boolean operators ($and, $or, $not, $nor) there are three combination operators: $all, $elemMatch, and $allMatch. A combination operator takes a single argument. The argument is either another selector, or an array of selectors. * Condition operators: are specific to a field, and are used to evaluate the value stored in that field. For instance, the basic $eq operator matches when the specified field contains a value that is equal to the supplied argument. * Only equality operators such as $eq, $gt, $gte, $lt, and $lte (but not $ne) can be used as the basis of a query. You should include at least one of these in a selector. For further reference see [selector syntax](https://cloud.ibm.com/docs/Cloudant?topic=Cloudant-query#selector-syntax).
bookmark (str) – (optional) Opaque bookmark token used when paginating results.
conflicts (bool) – (optional) A boolean value that indicates whether or not to include information about existing conflicts in the document.
execution_stats (bool) – (optional) Use this option to find information about the query that was run. This information includes total key lookups, total document lookups (when include_docs=true is used), and total quorum document lookups (when each document replica is fetched).
fields (List[str]) – (optional) JSON array that uses the field syntax. Use this parameter to specify which fields of a document must be returned. If it is omitted, the entire document is returned.
limit (int) – (optional) Maximum number of results returned. The type: text indexes are limited to 200 results when queried.
skip (int) – (optional) Skip the first ‘n’ results, where ‘n’ is the value that is specified.
sort (List[dict]) – (optional) The sort field contains a list of pairs, each mapping a field name to a sort direction (asc or desc). The first field name and direction pair is the topmost level of sort. The second pair, if provided, is the next level of sort. The field can be any field, using dotted notation if desired for sub-document fields. For example in JSON: [{“fieldName1”: “desc”}, {“fieldName2.subFieldName1”: “desc”}] When sorting with multiple fields, ensure that there is an index already defined with all the sort fields in the same order and each object in the sort array has a single key or at least one of the sort fields is included in the selector. All sorting fields must use the same sort direction, either all ascending or all descending.
stable (bool) – (optional) Whether or not the view results should be returned from a “stable” set of shards.
update (str) – (optional) Whether to update the index prior to returning the result.
use_index (List[str]) – (optional) Use this option to identify a specific index for query to run against, rather than by using the IBM Cloudant Query algorithm to find the best index.
r (int) – (optional) The read quorum that is needed for the result. The value defaults to 1, in which case the document that was found in the index is returned. If set to a higher value, each document is read from at least that many replicas before it is returned in the results. The request will take more time than using only the document that is stored locally with the index.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with dict result representing a FindResult object
- post_find_as_stream(db: str, selector: dict, *, bookmark: str = None, conflicts: bool = None, execution_stats: bool = None, fields: List[str] = None, limit: int = None, skip: int = None, sort: List[dict] = None, stable: bool = None, update: str = None, use_index: List[str] = None, r: int = None, **kwargs) DetailedResponse ¶
Query an index by using selector syntax as stream.
Query documents by using a declarative JSON querying syntax. It’s best practice to create an appropriate index for all fields in selector by using the _index endpoint. Queries without an appropriate backing index will fallback to using the built-in _all_docs index. This is not recommended because it has a significant performance impact causing a full scan of the database with each request. In this case the response body will include a warning field recommending that an index is created.
- Parameters:
db (str) – Path parameter to specify the database name.
selector (dict) –
JSON object describing criteria used to select documents. The selector specifies fields in the document, and provides an expression to evaluate with the field content or other data. The selector object must:
Be structured as valid JSON.
Contain a valid query expression.
Using a selector is significantly more efficient than using a JavaScript filter function, and is the recommended option if filtering on document attributes only. Elementary selector syntax requires you to specify one or more fields, and the corresponding values required for those fields. You can create more complex selector expressions by combining operators. Operators are identified by the use of a dollar sign $ prefix in the name field. There are two core types of operators in the selector syntax: * Combination operators: applied at the topmost level of selection. They are used to combine selectors. In addition to the common boolean operators ($and, $or, $not, $nor) there are three combination operators: $all, $elemMatch, and $allMatch. A combination operator takes a single argument. The argument is either another selector, or an array of selectors. * Condition operators: are specific to a field, and are used to evaluate the value stored in that field. For instance, the basic $eq operator matches when the specified field contains a value that is equal to the supplied argument. * Only equality operators such as $eq, $gt, $gte, $lt, and $lte (but not $ne) can be used as the basis of a query. You should include at least one of these in a selector. For further reference see [selector syntax](https://cloud.ibm.com/docs/Cloudant?topic=Cloudant-query#selector-syntax).
bookmark (str) – (optional) Opaque bookmark token used when paginating results.
conflicts (bool) – (optional) A boolean value that indicates whether or not to include information about existing conflicts in the document.
execution_stats (bool) – (optional) Use this option to find information about the query that was run. This information includes total key lookups, total document lookups (when include_docs=true is used), and total quorum document lookups (when each document replica is fetched).
fields (List[str]) – (optional) JSON array that uses the field syntax. Use this parameter to specify which fields of a document must be returned. If it is omitted, the entire document is returned.
limit (int) – (optional) Maximum number of results returned. The type: text indexes are limited to 200 results when queried.
skip (int) – (optional) Skip the first ‘n’ results, where ‘n’ is the value that is specified.
sort (List[dict]) – (optional) The sort field contains a list of pairs, each mapping a field name to a sort direction (asc or desc). The first field name and direction pair is the topmost level of sort. The second pair, if provided, is the next level of sort. The field can be any field, using dotted notation if desired for sub-document fields. For example in JSON: [{“fieldName1”: “desc”}, {“fieldName2.subFieldName1”: “desc”}] When sorting with multiple fields, ensure that there is an index already defined with all the sort fields in the same order and each object in the sort array has a single key or at least one of the sort fields is included in the selector. All sorting fields must use the same sort direction, either all ascending or all descending.
stable (bool) – (optional) Whether or not the view results should be returned from a “stable” set of shards.
update (str) – (optional) Whether to update the index prior to returning the result.
use_index (List[str]) – (optional) Use this option to identify a specific index for query to run against, rather than by using the IBM Cloudant Query algorithm to find the best index.
r (int) – (optional) The read quorum that is needed for the result. The value defaults to 1, in which case the document that was found in the index is returned. If set to a higher value, each document is read from at least that many replicas before it is returned in the results. The request will take more time than using only the document that is stored locally with the index.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with BinaryIO result
- post_index(db: str, index: IndexDefinition, *, ddoc: str = None, def_: IndexDefinition = None, name: str = None, partitioned: bool = None, type: str = None, **kwargs) DetailedResponse ¶
Create a new index on a database.
Create a new index on a database.
- Parameters:
db (str) – Path parameter to specify the database name.
index (IndexDefinition) – Schema for a json or text query index definition. Indexes of type text have additional configuration properties that do not apply to json indexes, these are: * default_analyzer - the default text analyzer to use * default_field - whether to index the text in all document fields and what analyzer to use for that purpose.
ddoc (str) – (optional) Name of the design document in which the index will be created.
def (IndexDefinition) – (optional) Schema for a json or text query index definition. Indexes of type text have additional configuration properties that do not apply to json indexes, these are: * default_analyzer - the default text analyzer to use * default_field - whether to index the text in all document fields and what analyzer to use for that purpose.
name (str) – (optional) name.
partitioned (bool) – (optional) The default value is true for databases with partitioned: true and false otherwise. For databases with partitioned: false if this option is specified the value must be false.
type (str) – (optional) Schema for the type of an index.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with dict result representing a IndexResult object
- post_partition_all_docs(db: str, partition_key: str, *, att_encoding_info: bool = None, attachments: bool = None, conflicts: bool = None, descending: bool = None, include_docs: bool = None, inclusive_end: bool = None, limit: int = None, skip: int = None, update_seq: bool = None, end_key: str = None, key: str = None, keys: List[str] = None, start_key: str = None, **kwargs) DetailedResponse ¶
Query a list of all documents in a database partition.
Queries the primary index (all document IDs). The results that match the query parameters are returned in a JSON object, including a list of matching documents with basic contents, such as the ID and revision. When no query parameters are specified, results for all documents in the database partition are returned. Optionally, document content or additional metadata can be included in the response.
- Parameters:
db (str) – Path parameter to specify the database name.
partition_key (str) – Path parameter to specify the database partition key.
att_encoding_info (bool) – (optional) Parameter to specify whether to include the encoding information in attachment stubs if the particular attachment is compressed.
attachments (bool) – (optional) Parameter to specify whether to include attachments bodies in a response.
conflicts (bool) – (optional) Parameter to specify whether to include a list of conflicted revisions in each returned document. Active only when include_docs is true.
descending (bool) – (optional) Parameter to specify whether to return the documents in descending by key order.
include_docs (bool) – (optional) Parameter to specify whether to include the full content of the documents in the response.
inclusive_end (bool) – (optional) Parameter to specify whether the specified end key should be included in the result.
limit (int) – (optional) Parameter to specify the number of returned documents to limit the result to.
skip (int) – (optional) Parameter to specify the number of records before starting to return the results.
update_seq (bool) – (optional) Parameter to specify whether to include in the response an update_seq value indicating the sequence id of the database the view reflects.
end_key (str) – (optional) Schema for a document ID.
key (str) – (optional) Schema for a document ID.
keys (List[str]) – (optional) Schema for a list of document IDs.
start_key (str) – (optional) Schema for a document ID.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with dict result representing a AllDocsResult object
- post_partition_all_docs_as_stream(db: str, partition_key: str, *, att_encoding_info: bool = None, attachments: bool = None, conflicts: bool = None, descending: bool = None, include_docs: bool = None, inclusive_end: bool = None, limit: int = None, skip: int = None, update_seq: bool = None, end_key: str = None, key: str = None, keys: List[str] = None, start_key: str = None, **kwargs) DetailedResponse ¶
Query a list of all documents in a database partition as stream.
Queries the primary index (all document IDs). The results that match the query parameters are returned in a JSON object, including a list of matching documents with basic contents, such as the ID and revision. When no query parameters are specified, results for all documents in the database partition are returned. Optionally, document content or additional metadata can be included in the response.
- Parameters:
db (str) – Path parameter to specify the database name.
partition_key (str) – Path parameter to specify the database partition key.
att_encoding_info (bool) – (optional) Parameter to specify whether to include the encoding information in attachment stubs if the particular attachment is compressed.
attachments (bool) – (optional) Parameter to specify whether to include attachments bodies in a response.
conflicts (bool) – (optional) Parameter to specify whether to include a list of conflicted revisions in each returned document. Active only when include_docs is true.
descending (bool) – (optional) Parameter to specify whether to return the documents in descending by key order.
include_docs (bool) – (optional) Parameter to specify whether to include the full content of the documents in the response.
inclusive_end (bool) – (optional) Parameter to specify whether the specified end key should be included in the result.
limit (int) – (optional) Parameter to specify the number of returned documents to limit the result to.
skip (int) – (optional) Parameter to specify the number of records before starting to return the results.
update_seq (bool) – (optional) Parameter to specify whether to include in the response an update_seq value indicating the sequence id of the database the view reflects.
end_key (str) – (optional) Schema for a document ID.
key (str) – (optional) Schema for a document ID.
keys (List[str]) – (optional) Schema for a list of document IDs.
start_key (str) – (optional) Schema for a document ID.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with BinaryIO result
- post_partition_find(db: str, partition_key: str, selector: dict, *, bookmark: str = None, conflicts: bool = None, execution_stats: bool = None, fields: List[str] = None, limit: int = None, skip: int = None, sort: List[dict] = None, stable: bool = None, update: str = None, use_index: List[str] = None, **kwargs) DetailedResponse ¶
Query a database partition index by using selector syntax.
Query documents by using a declarative JSON querying syntax. It’s best practice to create an appropriate index for all fields in selector by using the _index endpoint. Queries without an appropriate backing index will fallback to using the built-in _all_docs index. This is not recommended because it has a noticeable performance impact causing a full scan of the partition with each request. In this case the response body will include a warning field recommending that an index is created.
- Parameters:
db (str) – Path parameter to specify the database name.
partition_key (str) – Path parameter to specify the database partition key.
selector (dict) –
JSON object describing criteria used to select documents. The selector specifies fields in the document, and provides an expression to evaluate with the field content or other data. The selector object must:
Be structured as valid JSON.
Contain a valid query expression.
Using a selector is significantly more efficient than using a JavaScript filter function, and is the recommended option if filtering on document attributes only. Elementary selector syntax requires you to specify one or more fields, and the corresponding values required for those fields. You can create more complex selector expressions by combining operators. Operators are identified by the use of a dollar sign $ prefix in the name field. There are two core types of operators in the selector syntax: * Combination operators: applied at the topmost level of selection. They are used to combine selectors. In addition to the common boolean operators ($and, $or, $not, $nor) there are three combination operators: $all, $elemMatch, and $allMatch. A combination operator takes a single argument. The argument is either another selector, or an array of selectors. * Condition operators: are specific to a field, and are used to evaluate the value stored in that field. For instance, the basic $eq operator matches when the specified field contains a value that is equal to the supplied argument. * Only equality operators such as $eq, $gt, $gte, $lt, and $lte (but not $ne) can be used as the basis of a query. You should include at least one of these in a selector. For further reference see [selector syntax](https://cloud.ibm.com/docs/Cloudant?topic=Cloudant-query#selector-syntax).
bookmark (str) – (optional) Opaque bookmark token used when paginating results.
conflicts (bool) – (optional) A boolean value that indicates whether or not to include information about existing conflicts in the document.
execution_stats (bool) – (optional) Use this option to find information about the query that was run. This information includes total key lookups, total document lookups (when include_docs=true is used), and total quorum document lookups (when each document replica is fetched).
fields (List[str]) – (optional) JSON array that uses the field syntax. Use this parameter to specify which fields of a document must be returned. If it is omitted, the entire document is returned.
limit (int) – (optional) Maximum number of results returned. The type: text indexes are limited to 200 results when queried.
skip (int) – (optional) Skip the first ‘n’ results, where ‘n’ is the value that is specified.
sort (List[dict]) – (optional) The sort field contains a list of pairs, each mapping a field name to a sort direction (asc or desc). The first field name and direction pair is the topmost level of sort. The second pair, if provided, is the next level of sort. The field can be any field, using dotted notation if desired for sub-document fields. For example in JSON: [{“fieldName1”: “desc”}, {“fieldName2.subFieldName1”: “desc”}] When sorting with multiple fields, ensure that there is an index already defined with all the sort fields in the same order and each object in the sort array has a single key or at least one of the sort fields is included in the selector. All sorting fields must use the same sort direction, either all ascending or all descending.
stable (bool) – (optional) Whether or not the view results should be returned from a “stable” set of shards.
update (str) – (optional) Whether to update the index prior to returning the result.
use_index (List[str]) – (optional) Use this option to identify a specific index for query to run against, rather than by using the IBM Cloudant Query algorithm to find the best index.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with dict result representing a FindResult object
- post_partition_find_as_stream(db: str, partition_key: str, selector: dict, *, bookmark: str = None, conflicts: bool = None, execution_stats: bool = None, fields: List[str] = None, limit: int = None, skip: int = None, sort: List[dict] = None, stable: bool = None, update: str = None, use_index: List[str] = None, **kwargs) DetailedResponse ¶
Query a database partition index by using selector syntax as stream.
Query documents by using a declarative JSON querying syntax. It’s best practice to create an appropriate index for all fields in selector by using the _index endpoint. Queries without an appropriate backing index will fallback to using the built-in _all_docs index. This is not recommended because it has a noticeable performance impact causing a full scan of the partition with each request. In this case the response body will include a warning field recommending that an index is created.
- Parameters:
db (str) – Path parameter to specify the database name.
partition_key (str) – Path parameter to specify the database partition key.
selector (dict) –
JSON object describing criteria used to select documents. The selector specifies fields in the document, and provides an expression to evaluate with the field content or other data. The selector object must:
Be structured as valid JSON.
Contain a valid query expression.
Using a selector is significantly more efficient than using a JavaScript filter function, and is the recommended option if filtering on document attributes only. Elementary selector syntax requires you to specify one or more fields, and the corresponding values required for those fields. You can create more complex selector expressions by combining operators. Operators are identified by the use of a dollar sign $ prefix in the name field. There are two core types of operators in the selector syntax: * Combination operators: applied at the topmost level of selection. They are used to combine selectors. In addition to the common boolean operators ($and, $or, $not, $nor) there are three combination operators: $all, $elemMatch, and $allMatch. A combination operator takes a single argument. The argument is either another selector, or an array of selectors. * Condition operators: are specific to a field, and are used to evaluate the value stored in that field. For instance, the basic $eq operator matches when the specified field contains a value that is equal to the supplied argument. * Only equality operators such as $eq, $gt, $gte, $lt, and $lte (but not $ne) can be used as the basis of a query. You should include at least one of these in a selector. For further reference see [selector syntax](https://cloud.ibm.com/docs/Cloudant?topic=Cloudant-query#selector-syntax).
bookmark (str) – (optional) Opaque bookmark token used when paginating results.
conflicts (bool) – (optional) A boolean value that indicates whether or not to include information about existing conflicts in the document.
execution_stats (bool) – (optional) Use this option to find information about the query that was run. This information includes total key lookups, total document lookups (when include_docs=true is used), and total quorum document lookups (when each document replica is fetched).
fields (List[str]) – (optional) JSON array that uses the field syntax. Use this parameter to specify which fields of a document must be returned. If it is omitted, the entire document is returned.
limit (int) – (optional) Maximum number of results returned. The type: text indexes are limited to 200 results when queried.
skip (int) – (optional) Skip the first ‘n’ results, where ‘n’ is the value that is specified.
sort (List[dict]) – (optional) The sort field contains a list of pairs, each mapping a field name to a sort direction (asc or desc). The first field name and direction pair is the topmost level of sort. The second pair, if provided, is the next level of sort. The field can be any field, using dotted notation if desired for sub-document fields. For example in JSON: [{“fieldName1”: “desc”}, {“fieldName2.subFieldName1”: “desc”}] When sorting with multiple fields, ensure that there is an index already defined with all the sort fields in the same order and each object in the sort array has a single key or at least one of the sort fields is included in the selector. All sorting fields must use the same sort direction, either all ascending or all descending.
stable (bool) – (optional) Whether or not the view results should be returned from a “stable” set of shards.
update (str) – (optional) Whether to update the index prior to returning the result.
use_index (List[str]) – (optional) Use this option to identify a specific index for query to run against, rather than by using the IBM Cloudant Query algorithm to find the best index.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with BinaryIO result
- post_partition_search(db: str, partition_key: str, ddoc: str, index: str, query: str, *, bookmark: str = None, highlight_fields: List[str] = None, highlight_number: int = None, highlight_post_tag: str = None, highlight_pre_tag: str = None, highlight_size: int = None, include_docs: bool = None, include_fields: List[str] = None, limit: int = None, sort: List[str] = None, stale: str = None, **kwargs) DetailedResponse ¶
Query a database partition search index.
Partitioned Search indexes, which are defined in design documents, allow partition databases to be queried by using Lucene Query Parser Syntax. Search indexes are defined by an index function, similar to a map function in MapReduce views. The index function decides what data to index and store in the index.
- Parameters:
db (str) – Path parameter to specify the database name.
partition_key (str) – Path parameter to specify the database partition key.
ddoc (str) – Path parameter to specify the design document name. The design document name is the design document ID excluding the _design/ prefix.
index (str) – Path parameter to specify the index name.
query (str) – The Lucene query to execute.
bookmark (str) – (optional) Opaque bookmark token used when paginating results.
highlight_fields (List[str]) – (optional) Specifies which fields to highlight. If specified, the result object contains a highlights field with an entry for each specified field.
highlight_number (int) – (optional) Number of fragments that are returned in highlights. If the search term occurs less often than the number of fragments that are specified, longer fragments are returned.
highlight_post_tag (str) – (optional) A string that is inserted after the highlighted word in the highlights output.
highlight_pre_tag (str) – (optional) A string that is inserted before the highlighted word in the highlights output.
highlight_size (int) – (optional) Number of characters in each fragment for highlights.
include_docs (bool) – (optional) Include the full content of the documents in the return.
include_fields (List[str]) – (optional) A JSON array of field names to include in search results. Any fields that are included must be indexed with the store:true option. The default is all fields.
limit (int) – (optional) Limit the number of the returned documents to the specified number.
sort (List[str]) – (optional) Specifies the sort order of the results. In a grouped search (when group_field is used), this parameter specifies the sort order within a group. The default sort order is relevance. A JSON string of the form “fieldname<type>” or “-fieldname<type>” for descending order, where fieldname is the name of a string or number field, and type is either a number, a string, or a JSON array of strings. The type part is optional, and defaults to number. Some examples are “foo”, “-foo”, “bar<string>”, “-foo<number>” and [“-foo<number>”, “bar<string>”]. String fields that are used for sorting must not be analyzed fields. Fields that are used for sorting must be indexed by the same indexer that is used for the search query.
stale (str) – (optional) Do not wait for the index to finish building to return results.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with dict result representing a SearchResult object
- post_partition_search_as_stream(db: str, partition_key: str, ddoc: str, index: str, query: str, *, bookmark: str = None, highlight_fields: List[str] = None, highlight_number: int = None, highlight_post_tag: str = None, highlight_pre_tag: str = None, highlight_size: int = None, include_docs: bool = None, include_fields: List[str] = None, limit: int = None, sort: List[str] = None, stale: str = None, **kwargs) DetailedResponse ¶
Query a database partition search index as stream.
Partitioned Search indexes, which are defined in design documents, allow partition databases to be queried by using Lucene Query Parser Syntax. Search indexes are defined by an index function, similar to a map function in MapReduce views. The index function decides what data to index and store in the index.
- Parameters:
db (str) – Path parameter to specify the database name.
partition_key (str) – Path parameter to specify the database partition key.
ddoc (str) – Path parameter to specify the design document name. The design document name is the design document ID excluding the _design/ prefix.
index (str) – Path parameter to specify the index name.
query (str) – The Lucene query to execute.
bookmark (str) – (optional) Opaque bookmark token used when paginating results.
highlight_fields (List[str]) – (optional) Specifies which fields to highlight. If specified, the result object contains a highlights field with an entry for each specified field.
highlight_number (int) – (optional) Number of fragments that are returned in highlights. If the search term occurs less often than the number of fragments that are specified, longer fragments are returned.
highlight_post_tag (str) – (optional) A string that is inserted after the highlighted word in the highlights output.
highlight_pre_tag (str) – (optional) A string that is inserted before the highlighted word in the highlights output.
highlight_size (int) – (optional) Number of characters in each fragment for highlights.
include_docs (bool) – (optional) Include the full content of the documents in the return.
include_fields (List[str]) – (optional) A JSON array of field names to include in search results. Any fields that are included must be indexed with the store:true option. The default is all fields.
limit (int) – (optional) Limit the number of the returned documents to the specified number.
sort (List[str]) – (optional) Specifies the sort order of the results. In a grouped search (when group_field is used), this parameter specifies the sort order within a group. The default sort order is relevance. A JSON string of the form “fieldname<type>” or “-fieldname<type>” for descending order, where fieldname is the name of a string or number field, and type is either a number, a string, or a JSON array of strings. The type part is optional, and defaults to number. Some examples are “foo”, “-foo”, “bar<string>”, “-foo<number>” and [“-foo<number>”, “bar<string>”]. String fields that are used for sorting must not be analyzed fields. Fields that are used for sorting must be indexed by the same indexer that is used for the search query.
stale (str) – (optional) Do not wait for the index to finish building to return results.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with BinaryIO result
- post_partition_view(db: str, partition_key: str, ddoc: str, view: str, *, att_encoding_info: bool = None, attachments: bool = None, conflicts: bool = None, descending: bool = None, include_docs: bool = None, inclusive_end: bool = None, limit: int = None, skip: int = None, update_seq: bool = None, end_key: object = None, end_key_doc_id: str = None, group: bool = None, group_level: int = None, key: object = None, keys: List[object] = None, reduce: bool = None, start_key: object = None, start_key_doc_id: str = None, update: str = None, **kwargs) DetailedResponse ¶
Query a database partition MapReduce view function.
Runs the specified view function from the specified design document. Unlike GET /{db}/_design/{ddoc}/_view/{view} for accessing views, the POST method supports the specification of explicit keys to be retrieved from the view results. The remainder of the POST view functionality is identical to the GET /{db}/_design/{ddoc}/_view/{view} API.
- Parameters:
db (str) – Path parameter to specify the database name.
partition_key (str) – Path parameter to specify the database partition key.
ddoc (str) – Path parameter to specify the design document name. The design document name is the design document ID excluding the _design/ prefix.
view (str) – Path parameter to specify the map reduce view function name.
att_encoding_info (bool) – (optional) Parameter to specify whether to include the encoding information in attachment stubs if the particular attachment is compressed.
attachments (bool) – (optional) Parameter to specify whether to include attachments bodies in a response.
conflicts (bool) – (optional) Parameter to specify whether to include a list of conflicted revisions in each returned document. Active only when include_docs is true.
descending (bool) – (optional) Parameter to specify whether to return the documents in descending by key order.
include_docs (bool) – (optional) Parameter to specify whether to include the full content of the documents in the response.
inclusive_end (bool) – (optional) Parameter to specify whether the specified end key should be included in the result.
limit (int) – (optional) Parameter to specify the number of returned documents to limit the result to.
skip (int) – (optional) Parameter to specify the number of records before starting to return the results.
update_seq (bool) – (optional) Parameter to specify whether to include in the response an update_seq value indicating the sequence id of the database the view reflects.
end_key (object) – (optional) Schema for any JSON type.
end_key_doc_id (str) – (optional) Schema for a document ID.
group (bool) – (optional) Parameter to specify whether to group reduced results by key. Valid only if a reduce function defined in the view. If the view emits key in JSON array format, then it is possible to reduce groups further based on the number of array elements with the group_level parameter.
group_level (int) – (optional) Parameter to specify a group level to be used. Only applicable if the view uses keys that are JSON arrays. Implies group is true. Group level groups the reduced results by the specified number of array elements. If unset, results are grouped by the entire array key, returning a reduced value for each complete key.
key (object) – (optional) Schema for any JSON type.
keys (List[object]) – (optional) Parameter to specify returning only documents that match any of the specified keys. A JSON array of keys that match the key type emitted by the view function.
reduce (bool) – (optional) Parameter to specify whether to use the reduce function in a map-reduce view. Default is true when a reduce function is defined.
start_key (object) – (optional) Schema for any JSON type.
start_key_doc_id (str) – (optional) Schema for a document ID.
update (str) – (optional) Parameter to specify whether or not the view in question should be updated prior to responding to the user. * true - Return results after the view is updated. * false - Return results without updating the view. * lazy - Return the view results without waiting for an update, but update them immediately after the request.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with dict result representing a ViewResult object
- post_partition_view_as_stream(db: str, partition_key: str, ddoc: str, view: str, *, att_encoding_info: bool = None, attachments: bool = None, conflicts: bool = None, descending: bool = None, include_docs: bool = None, inclusive_end: bool = None, limit: int = None, skip: int = None, update_seq: bool = None, end_key: object = None, end_key_doc_id: str = None, group: bool = None, group_level: int = None, key: object = None, keys: List[object] = None, reduce: bool = None, start_key: object = None, start_key_doc_id: str = None, update: str = None, **kwargs) DetailedResponse ¶
Query a database partition MapReduce view function as stream.
Runs the specified view function from the specified design document. Unlike GET /{db}/_design/{ddoc}/_view/{view} for accessing views, the POST method supports the specification of explicit keys to be retrieved from the view results. The remainder of the POST view functionality is identical to the GET /{db}/_design/{ddoc}/_view/{view} API.
- Parameters:
db (str) – Path parameter to specify the database name.
partition_key (str) – Path parameter to specify the database partition key.
ddoc (str) – Path parameter to specify the design document name. The design document name is the design document ID excluding the _design/ prefix.
view (str) – Path parameter to specify the map reduce view function name.
att_encoding_info (bool) – (optional) Parameter to specify whether to include the encoding information in attachment stubs if the particular attachment is compressed.
attachments (bool) – (optional) Parameter to specify whether to include attachments bodies in a response.
conflicts (bool) – (optional) Parameter to specify whether to include a list of conflicted revisions in each returned document. Active only when include_docs is true.
descending (bool) – (optional) Parameter to specify whether to return the documents in descending by key order.
include_docs (bool) – (optional) Parameter to specify whether to include the full content of the documents in the response.
inclusive_end (bool) – (optional) Parameter to specify whether the specified end key should be included in the result.
limit (int) – (optional) Parameter to specify the number of returned documents to limit the result to.
skip (int) – (optional) Parameter to specify the number of records before starting to return the results.
update_seq (bool) – (optional) Parameter to specify whether to include in the response an update_seq value indicating the sequence id of the database the view reflects.
end_key (object) – (optional) Schema for any JSON type.
end_key_doc_id (str) – (optional) Schema for a document ID.
group (bool) – (optional) Parameter to specify whether to group reduced results by key. Valid only if a reduce function defined in the view. If the view emits key in JSON array format, then it is possible to reduce groups further based on the number of array elements with the group_level parameter.
group_level (int) – (optional) Parameter to specify a group level to be used. Only applicable if the view uses keys that are JSON arrays. Implies group is true. Group level groups the reduced results by the specified number of array elements. If unset, results are grouped by the entire array key, returning a reduced value for each complete key.
key (object) – (optional) Schema for any JSON type.
keys (List[object]) – (optional) Parameter to specify returning only documents that match any of the specified keys. A JSON array of keys that match the key type emitted by the view function.
reduce (bool) – (optional) Parameter to specify whether to use the reduce function in a map-reduce view. Default is true when a reduce function is defined.
start_key (object) – (optional) Schema for any JSON type.
start_key_doc_id (str) – (optional) Schema for a document ID.
update (str) – (optional) Parameter to specify whether or not the view in question should be updated prior to responding to the user. * true - Return results after the view is updated. * false - Return results without updating the view. * lazy - Return the view results without waiting for an update, but update them immediately after the request.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with BinaryIO result
- post_revs_diff(db: str, document_revisions: dict, **kwargs) DetailedResponse ¶
Query the document revisions and possible ancestors missing from the database.
The replicator is the primary user of this operation. After receiving a set of new revision IDs from the source database, the replicator sends this set to the destination database’s _revs_diff to find out which of them already exists there. It can then avoid fetching and sending already-known document bodies.
- Parameters:
db (str) – Path parameter to specify the database name.
document_revisions (dict) – HTTP request body for operations with Document revisions.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with dict result representing a dict object
- post_search(db: str, ddoc: str, index: str, query: str, *, bookmark: str = None, highlight_fields: List[str] = None, highlight_number: int = None, highlight_post_tag: str = None, highlight_pre_tag: str = None, highlight_size: int = None, include_docs: bool = None, include_fields: List[str] = None, limit: int = None, sort: List[str] = None, stale: str = None, counts: List[str] = None, drilldown: List[List[str]] = None, group_field: str = None, group_limit: int = None, group_sort: List[str] = None, ranges: dict = None, **kwargs) DetailedResponse ¶
Query a search index.
Search indexes, which are defined in design documents, allow databases to be queried by using Lucene Query Parser Syntax. An index function defines a search index, similar to a map function in MapReduce views. The index function decides what data to index and what data to store in the index. The advantage of using the HTTP POST method is that the query is submitted as a JSON object in the request body. This avoids the limitations of passing query options as URL query parameters of a GET request.
- Parameters:
db (str) – Path parameter to specify the database name.
ddoc (str) – Path parameter to specify the design document name. The design document name is the design document ID excluding the _design/ prefix.
index (str) – Path parameter to specify the index name.
query (str) – The Lucene query to execute.
bookmark (str) – (optional) Opaque bookmark token used when paginating results.
highlight_fields (List[str]) – (optional) Specifies which fields to highlight. If specified, the result object contains a highlights field with an entry for each specified field.
highlight_number (int) – (optional) Number of fragments that are returned in highlights. If the search term occurs less often than the number of fragments that are specified, longer fragments are returned.
highlight_post_tag (str) – (optional) A string that is inserted after the highlighted word in the highlights output.
highlight_pre_tag (str) – (optional) A string that is inserted before the highlighted word in the highlights output.
highlight_size (int) – (optional) Number of characters in each fragment for highlights.
include_docs (bool) – (optional) Include the full content of the documents in the return.
include_fields (List[str]) – (optional) A JSON array of field names to include in search results. Any fields that are included must be indexed with the store:true option. The default is all fields.
limit (int) – (optional) Limit the number of the returned documents to the specified number.
sort (List[str]) – (optional) Specifies the sort order of the results. In a grouped search (when group_field is used), this parameter specifies the sort order within a group. The default sort order is relevance. A JSON string of the form “fieldname<type>” or “-fieldname<type>” for descending order, where fieldname is the name of a string or number field, and type is either a number, a string, or a JSON array of strings. The type part is optional, and defaults to number. Some examples are “foo”, “-foo”, “bar<string>”, “-foo<number>” and [“-foo<number>”, “bar<string>”]. String fields that are used for sorting must not be analyzed fields. Fields that are used for sorting must be indexed by the same indexer that is used for the search query.
stale (str) – (optional) Do not wait for the index to finish building to return results.
counts (List[str]) – (optional) This field defines an array of names of string fields, for which counts are requested. The response contains counts for each unique value of this field name among the documents that match the search query. Faceting must be enabled for this parameter to function. This option is only available when making global queries.
drilldown (List[List[str]]) – (optional) Restrict results to documents with a dimension equal to the specified label(s). The search matches only documents containing the value that was provided in the named field. It differs from using “fieldname:value” in the q parameter only in that the values are not analyzed. Faceting must be enabled for this parameter to function.
group_field (str) – (optional) Field by which to group search matches. A string that contains the name of a string field. Fields containing other data such as numbers, objects, or arrays cannot be used. This option is only available when making global queries.
group_limit (int) – (optional) Maximum group count. This field can be used only if group_field is specified. This option is only available when making global queries.
group_sort (List[str]) – (optional) This field defines the order of the groups in a search that uses group_field. The default sort order is relevance. This field can have the same values as the sort field, so single fields and arrays of fields are supported. This option is only available when making global queries.
ranges (dict) – (optional) This field defines ranges for faceted, numeric search fields. The value is a JSON object where the fields names are faceted numeric search fields, and the values of the fields are JSON objects. The field names of the JSON objects are names for ranges. The values are strings that describe the range, for example “[0 TO 10]”. This option is only available when making global queries.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with dict result representing a SearchResult object
- post_search_analyze(analyzer: str, text: str, **kwargs) DetailedResponse ¶
Query tokenization of sample text.
Returns the results of analyzer tokenization of the provided sample text. This endpoint can be used for testing analyzer tokenization.
- Parameters:
analyzer (str) – The analyzer type that is being used at the tokenization.
text (str) – The text to tokenize with the analyzer.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with dict result representing a SearchAnalyzeResult object
- post_search_as_stream(db: str, ddoc: str, index: str, query: str, *, bookmark: str = None, highlight_fields: List[str] = None, highlight_number: int = None, highlight_post_tag: str = None, highlight_pre_tag: str = None, highlight_size: int = None, include_docs: bool = None, include_fields: List[str] = None, limit: int = None, sort: List[str] = None, stale: str = None, counts: List[str] = None, drilldown: List[List[str]] = None, group_field: str = None, group_limit: int = None, group_sort: List[str] = None, ranges: dict = None, **kwargs) DetailedResponse ¶
Query a search index as stream.
Search indexes, which are defined in design documents, allow databases to be queried by using Lucene Query Parser Syntax. An index function defines a search index, similar to a map function in MapReduce views. The index function decides what data to index and what data to store in the index. The advantage of using the HTTP POST method is that the query is submitted as a JSON object in the request body. This avoids the limitations of passing query options as URL query parameters of a GET request.
- Parameters:
db (str) – Path parameter to specify the database name.
ddoc (str) – Path parameter to specify the design document name. The design document name is the design document ID excluding the _design/ prefix.
index (str) – Path parameter to specify the index name.
query (str) – The Lucene query to execute.
bookmark (str) – (optional) Opaque bookmark token used when paginating results.
highlight_fields (List[str]) – (optional) Specifies which fields to highlight. If specified, the result object contains a highlights field with an entry for each specified field.
highlight_number (int) – (optional) Number of fragments that are returned in highlights. If the search term occurs less often than the number of fragments that are specified, longer fragments are returned.
highlight_post_tag (str) – (optional) A string that is inserted after the highlighted word in the highlights output.
highlight_pre_tag (str) – (optional) A string that is inserted before the highlighted word in the highlights output.
highlight_size (int) – (optional) Number of characters in each fragment for highlights.
include_docs (bool) – (optional) Include the full content of the documents in the return.
include_fields (List[str]) – (optional) A JSON array of field names to include in search results. Any fields that are included must be indexed with the store:true option. The default is all fields.
limit (int) – (optional) Limit the number of the returned documents to the specified number.
sort (List[str]) – (optional) Specifies the sort order of the results. In a grouped search (when group_field is used), this parameter specifies the sort order within a group. The default sort order is relevance. A JSON string of the form “fieldname<type>” or “-fieldname<type>” for descending order, where fieldname is the name of a string or number field, and type is either a number, a string, or a JSON array of strings. The type part is optional, and defaults to number. Some examples are “foo”, “-foo”, “bar<string>”, “-foo<number>” and [“-foo<number>”, “bar<string>”]. String fields that are used for sorting must not be analyzed fields. Fields that are used for sorting must be indexed by the same indexer that is used for the search query.
stale (str) – (optional) Do not wait for the index to finish building to return results.
counts (List[str]) – (optional) This field defines an array of names of string fields, for which counts are requested. The response contains counts for each unique value of this field name among the documents that match the search query. Faceting must be enabled for this parameter to function. This option is only available when making global queries.
drilldown (List[List[str]]) – (optional) Restrict results to documents with a dimension equal to the specified label(s). The search matches only documents containing the value that was provided in the named field. It differs from using “fieldname:value” in the q parameter only in that the values are not analyzed. Faceting must be enabled for this parameter to function.
group_field (str) – (optional) Field by which to group search matches. A string that contains the name of a string field. Fields containing other data such as numbers, objects, or arrays cannot be used. This option is only available when making global queries.
group_limit (int) – (optional) Maximum group count. This field can be used only if group_field is specified. This option is only available when making global queries.
group_sort (List[str]) – (optional) This field defines the order of the groups in a search that uses group_field. The default sort order is relevance. This field can have the same values as the sort field, so single fields and arrays of fields are supported. This option is only available when making global queries.
ranges (dict) – (optional) This field defines ranges for faceted, numeric search fields. The value is a JSON object where the fields names are faceted numeric search fields, and the values of the fields are JSON objects. The field names of the JSON objects are names for ranges. The values are strings that describe the range, for example “[0 TO 10]”. This option is only available when making global queries.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with BinaryIO result
- post_view(db: str, ddoc: str, view: str, *, att_encoding_info: bool = None, attachments: bool = None, conflicts: bool = None, descending: bool = None, include_docs: bool = None, inclusive_end: bool = None, limit: int = None, skip: int = None, update_seq: bool = None, end_key: object = None, end_key_doc_id: str = None, group: bool = None, group_level: int = None, key: object = None, keys: List[object] = None, reduce: bool = None, stable: bool = None, start_key: object = None, start_key_doc_id: str = None, update: str = None, **kwargs) DetailedResponse ¶
Query a MapReduce view.
This operation queries the specified MapReduce view of the specified design document. By default, the map and reduce functions of the view are run to update the view before returning the response. The advantage of using the HTTP POST method is that the query is submitted as a JSON object in the request body. This avoids the limitations of passing query options as URL query parameters of a GET request.
- Parameters:
db (str) – Path parameter to specify the database name.
ddoc (str) – Path parameter to specify the design document name. The design document name is the design document ID excluding the _design/ prefix.
view (str) – Path parameter to specify the map reduce view function name.
att_encoding_info (bool) – (optional) Parameter to specify whether to include the encoding information in attachment stubs if the particular attachment is compressed.
attachments (bool) – (optional) Parameter to specify whether to include attachments bodies in a response.
conflicts (bool) – (optional) Parameter to specify whether to include a list of conflicted revisions in each returned document. Active only when include_docs is true.
descending (bool) – (optional) Parameter to specify whether to return the documents in descending by key order.
include_docs (bool) – (optional) Parameter to specify whether to include the full content of the documents in the response.
inclusive_end (bool) – (optional) Parameter to specify whether the specified end key should be included in the result.
limit (int) – (optional) Parameter to specify the number of returned documents to limit the result to.
skip (int) – (optional) Parameter to specify the number of records before starting to return the results.
update_seq (bool) – (optional) Parameter to specify whether to include in the response an update_seq value indicating the sequence id of the database the view reflects.
end_key (object) – (optional) Schema for any JSON type.
end_key_doc_id (str) – (optional) Schema for a document ID.
group (bool) – (optional) Parameter to specify whether to group reduced results by key. Valid only if a reduce function defined in the view. If the view emits key in JSON array format, then it is possible to reduce groups further based on the number of array elements with the group_level parameter.
group_level (int) – (optional) Parameter to specify a group level to be used. Only applicable if the view uses keys that are JSON arrays. Implies group is true. Group level groups the reduced results by the specified number of array elements. If unset, results are grouped by the entire array key, returning a reduced value for each complete key.
key (object) – (optional) Schema for any JSON type.
keys (List[object]) – (optional) Parameter to specify returning only documents that match any of the specified keys. A JSON array of keys that match the key type emitted by the view function.
reduce (bool) – (optional) Parameter to specify whether to use the reduce function in a map-reduce view. Default is true when a reduce function is defined.
stable (bool) – (optional) Query parameter to specify whether use the same replica of the index on each request. The default value false contacts all replicas and returns the result from the first, fastest, responder. Setting it to true when used in conjunction with update=false may improve consistency at the expense of increased latency and decreased throughput if the selected replica is not the fastest of the available replicas. Note: In general setting true is discouraged and is strictly not recommended when using update=true.
start_key (object) – (optional) Schema for any JSON type.
start_key_doc_id (str) – (optional) Schema for a document ID.
update (str) – (optional) Parameter to specify whether or not the view in question should be updated prior to responding to the user. * true - Return results after the view is updated. * false - Return results without updating the view. * lazy - Return the view results without waiting for an update, but update them immediately after the request.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with dict result representing a ViewResult object
- post_view_as_stream(db: str, ddoc: str, view: str, *, att_encoding_info: bool = None, attachments: bool = None, conflicts: bool = None, descending: bool = None, include_docs: bool = None, inclusive_end: bool = None, limit: int = None, skip: int = None, update_seq: bool = None, end_key: object = None, end_key_doc_id: str = None, group: bool = None, group_level: int = None, key: object = None, keys: List[object] = None, reduce: bool = None, stable: bool = None, start_key: object = None, start_key_doc_id: str = None, update: str = None, **kwargs) DetailedResponse ¶
Query a MapReduce view as stream.
This operation queries the specified MapReduce view of the specified design document. By default, the map and reduce functions of the view are run to update the view before returning the response. The advantage of using the HTTP POST method is that the query is submitted as a JSON object in the request body. This avoids the limitations of passing query options as URL query parameters of a GET request.
- Parameters:
db (str) – Path parameter to specify the database name.
ddoc (str) – Path parameter to specify the design document name. The design document name is the design document ID excluding the _design/ prefix.
view (str) – Path parameter to specify the map reduce view function name.
att_encoding_info (bool) – (optional) Parameter to specify whether to include the encoding information in attachment stubs if the particular attachment is compressed.
attachments (bool) – (optional) Parameter to specify whether to include attachments bodies in a response.
conflicts (bool) – (optional) Parameter to specify whether to include a list of conflicted revisions in each returned document. Active only when include_docs is true.
descending (bool) – (optional) Parameter to specify whether to return the documents in descending by key order.
include_docs (bool) – (optional) Parameter to specify whether to include the full content of the documents in the response.
inclusive_end (bool) – (optional) Parameter to specify whether the specified end key should be included in the result.
limit (int) – (optional) Parameter to specify the number of returned documents to limit the result to.
skip (int) – (optional) Parameter to specify the number of records before starting to return the results.
update_seq (bool) – (optional) Parameter to specify whether to include in the response an update_seq value indicating the sequence id of the database the view reflects.
end_key (object) – (optional) Schema for any JSON type.
end_key_doc_id (str) – (optional) Schema for a document ID.
group (bool) – (optional) Parameter to specify whether to group reduced results by key. Valid only if a reduce function defined in the view. If the view emits key in JSON array format, then it is possible to reduce groups further based on the number of array elements with the group_level parameter.
group_level (int) – (optional) Parameter to specify a group level to be used. Only applicable if the view uses keys that are JSON arrays. Implies group is true. Group level groups the reduced results by the specified number of array elements. If unset, results are grouped by the entire array key, returning a reduced value for each complete key.
key (object) – (optional) Schema for any JSON type.
keys (List[object]) – (optional) Parameter to specify returning only documents that match any of the specified keys. A JSON array of keys that match the key type emitted by the view function.
reduce (bool) – (optional) Parameter to specify whether to use the reduce function in a map-reduce view. Default is true when a reduce function is defined.
stable (bool) – (optional) Query parameter to specify whether use the same replica of the index on each request. The default value false contacts all replicas and returns the result from the first, fastest, responder. Setting it to true when used in conjunction with update=false may improve consistency at the expense of increased latency and decreased throughput if the selected replica is not the fastest of the available replicas. Note: In general setting true is discouraged and is strictly not recommended when using update=true.
start_key (object) – (optional) Schema for any JSON type.
start_key_doc_id (str) – (optional) Schema for a document ID.
update (str) – (optional) Parameter to specify whether or not the view in question should be updated prior to responding to the user. * true - Return results after the view is updated. * false - Return results without updating the view. * lazy - Return the view results without waiting for an update, but update them immediately after the request.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with BinaryIO result
- post_view_queries(db: str, ddoc: str, view: str, queries: List[ViewQuery], **kwargs) DetailedResponse ¶
Multi-query a MapReduce view.
This operation runs multiple specified view queries against the view function from the specified design document.
- Parameters:
db (str) – Path parameter to specify the database name.
ddoc (str) – Path parameter to specify the design document name. The design document name is the design document ID excluding the _design/ prefix.
view (str) – Path parameter to specify the map reduce view function name.
queries (List[ViewQuery]) – An array of query objects with fields for the parameters of each individual view query to be executed. The field names and their meaning are the same as the query parameters of a regular view request.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with dict result representing a ViewQueriesResult object
- post_view_queries_as_stream(db: str, ddoc: str, view: str, queries: List[ViewQuery], **kwargs) DetailedResponse ¶
Multi-query a MapReduce view as stream.
This operation runs multiple specified view queries against the view function from the specified design document.
- Parameters:
db (str) – Path parameter to specify the database name.
ddoc (str) – Path parameter to specify the design document name. The design document name is the design document ID excluding the _design/ prefix.
view (str) – Path parameter to specify the map reduce view function name.
queries (List[ViewQuery]) – An array of query objects with fields for the parameters of each individual view query to be executed. The field names and their meaning are the same as the query parameters of a regular view request.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with BinaryIO result
- prepare_request(method: str, url: str, *args, headers: Optional[dict] = None, params: Optional[dict] = None, data: Optional[Union[str, dict]] = None, files: Optional[Union[Dict[str, Tuple[str]], List[Tuple[str, Tuple[str, ...]]]]] = None, **kwargs) dict ¶
Build a dict that represents an HTTP service request.
Clean up headers, add default http configuration, convert data into json, process files, and merge all into a single request dict.
- Args:
method: The HTTP method of the request ex. GET, POST, etc. url: The origin + pathname according to WHATWG spec.
- Keyword Arguments:
headers: Headers of the request. params: Querystring data to be appended to the url. data: The request body. Converted to json if a dict. files: ‘files’ can be a dictionary (i.e { ‘<part-name>’: (<tuple>)}),
or a list of tuples [ (<part-name>, (<tuple>))… ]
- Returns:
Prepared request dictionary.
- put_attachment(db: str, doc_id: str, attachment_name: str, attachment: BinaryIO, content_type: str, *, if_match: str = None, rev: str = None, **kwargs) DetailedResponse ¶
Create or modify an attachment.
Uploads the supplied content as an attachment to the specified document. The attachment name that you provide must be a URL encoded string. You must supply the Content-Type header, and for an existing document, you must also supply either the rev query argument or the If-Match HTTP header. If you omit the revision, a new, otherwise empty, document is created with the provided attachment, or a conflict occurs. If the uploaded attachment uses an existing attachment name in the remote database, it updates the corresponding stored content of the database. Since you must supply the revision information to add an attachment to the document, this serves as validation to update the existing attachment.
- Parameters:
db (str) – Path parameter to specify the database name.
doc_id (str) – Path parameter to specify the document ID.
attachment_name (str) – Path parameter to specify the attachment name.
attachment (BinaryIO) – HTTP request body for attachment operations.
content_type (str) – Content-Type of the attachment.
if_match (str) – (optional) Header parameter to specify the document revision. Alternative to rev query parameter.
rev (str) – (optional) Query parameter to specify a document revision.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with dict result representing a DocumentResult object
- put_capacity_throughput_configuration(blocks: int, **kwargs) DetailedResponse ¶
Update the target provisioned throughput capacity.
Sets the target provisioned throughput capacity for an IBM Cloudant instance. When target capacity is changed, the current capacity asynchronously changes to meet the target capacity.
- Parameters:
blocks (int) – A number of blocks of throughput units. A block consists of 100 reads/sec, 50 writes/sec, and 5 global queries/sec of provisioned throughput capacity.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with dict result representing a CapacityThroughputInformation object
- put_cloudant_security_configuration(db: str, cloudant: dict, *, admins: SecurityObject = None, members: SecurityObject = None, couchdb_auth_only: bool = None, **kwargs) DetailedResponse ¶
Modify only Cloudant related database permissions.
Modify only Cloudant related permissions to database. Be careful: by removing an API key from the list, you remove the API key from the list of users that have access to the database. ### Note about nobody role The nobody username applies to all unauthenticated connection attempts. For example, if an application tries to read data from a database, but did not identify itself, the task can continue only if the nobody user has the role _reader.
- Parameters:
db (str) – Path parameter to specify the database name.
cloudant (dict) – Database permissions for Cloudant users and/or API keys.
admins (SecurityObject) – (optional) Schema for names and roles to map to a database permission.
members (SecurityObject) – (optional) Schema for names and roles to map to a database permission.
couchdb_auth_only (bool) – (optional) Manage permissions using the _users database only.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with dict result representing a Ok object
- put_cors_configuration(origins: List[str], *, allow_credentials: bool = None, enable_cors: bool = None, **kwargs) DetailedResponse ¶
Modify CORS configuration.
Sets the CORS configuration. The configuration applies to all databases and all account level endpoints in your account.
- Parameters:
origins (List[str]) – An array of strings that contain allowed origin domains. You have to specify the full URL including the protocol. It is recommended that only the HTTPS protocol is used. Subdomains count as separate domains, so you have to specify all subdomains used.
allow_credentials (bool) – (optional) Boolean value to allow authentication credentials. If set to true, browser requests must be done by using withCredentials = true.
enable_cors (bool) – (optional) Boolean value to turn CORS on and off.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with dict result representing a Ok object
- put_database(db: str, *, partitioned: bool = None, q: int = None, **kwargs) DetailedResponse ¶
Create a database.
- Parameters:
db (str) – Path parameter to specify the database name.
partitioned (bool) – (optional) Query parameter to specify whether to enable database partitions when creating a database.
q (int) – (optional) The number of shards in the database. Each shard is a partition of the hash value range. Its value is set by the service. For more information about modifying database configuration, contact IBM Cloudant support.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with dict result representing a Ok object
- put_design_document(db: str, ddoc: str, design_document: DesignDocument, *, if_match: str = None, batch: str = None, new_edits: bool = None, rev: str = None, **kwargs) DetailedResponse ¶
Create or modify a design document.
The PUT method creates a new named design document, or creates a new revision of the existing design document.
- Parameters:
db (str) – Path parameter to specify the database name.
ddoc (str) – Path parameter to specify the design document name. The design document name is the design document ID excluding the _design/ prefix.
design_document (DesignDocument) – HTTP request body for DesignDocument operations.
if_match (str) – (optional) Header parameter to specify the document revision. Alternative to rev query parameter.
batch (str) – (optional) Query parameter to specify whether to store in batch mode. The server will respond with a HTTP 202 Accepted response code immediately.
new_edits (bool) – (optional) Query parameter to specify whether to prevent insertion of conflicting document revisions. If false, a well-formed _rev must be included in the document. False is used by the replicator to insert documents into the target database even if that leads to the creation of conflicts.
rev (str) – (optional) Query parameter to specify a document revision.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with dict result representing a DocumentResult object
- put_document(db: str, doc_id: str, document: Union[Document, BinaryIO], *, content_type: str = None, if_match: str = None, batch: str = None, new_edits: bool = None, rev: str = None, **kwargs) DetailedResponse ¶
Create or modify a document.
Creates or modifies a document in the specified database. For creation, you must specify the document ID but you should not specify the revision. For modification, you must specify the document ID and a revision identifier.
- Parameters:
db (str) – Path parameter to specify the database name.
doc_id (str) – Path parameter to specify the document ID.
document (Document) – HTTP request body for Document operations.
content_type (str) – (optional) The type of the input.
if_match (str) – (optional) Header parameter to specify the document revision. Alternative to rev query parameter.
batch (str) – (optional) Query parameter to specify whether to store in batch mode. The server will respond with a HTTP 202 Accepted response code immediately.
new_edits (bool) – (optional) Query parameter to specify whether to prevent insertion of conflicting document revisions. If false, a well-formed _rev must be included in the document. False is used by the replicator to insert documents into the target database even if that leads to the creation of conflicts.
rev (str) – (optional) Query parameter to specify a document revision.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with dict result representing a DocumentResult object
- put_local_document(db: str, doc_id: str, document: Union[Document, BinaryIO], *, content_type: str = None, batch: str = None, **kwargs) DetailedResponse ¶
Create or modify a local document.
Stores the specified local document. The semantics are identical to storing a standard document in the specified database, except that the document is not replicated.
- Parameters:
db (str) – Path parameter to specify the database name.
doc_id (str) – Path parameter to specify the document ID.
document (Document) – HTTP request body for Document operations.
content_type (str) – (optional) The type of the input.
batch (str) – (optional) Query parameter to specify whether to store in batch mode. The server will respond with a HTTP 202 Accepted response code immediately.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with dict result representing a DocumentResult object
- put_replication_document(doc_id: str, replication_document: ReplicationDocument, *, if_match: str = None, batch: str = None, new_edits: bool = None, rev: str = None, **kwargs) DetailedResponse ¶
Create or modify a replication using a replication document.
Creates or modifies a document in the _replicator database to start a new replication or to edit an existing replication.
- Parameters:
doc_id (str) – Path parameter to specify the document ID.
replication_document (ReplicationDocument) – HTTP request body for replication operations.
if_match (str) – (optional) Header parameter to specify the document revision. Alternative to rev query parameter.
batch (str) – (optional) Query parameter to specify whether to store in batch mode. The server will respond with a HTTP 202 Accepted response code immediately.
new_edits (bool) – (optional) Query parameter to specify whether to prevent insertion of conflicting document revisions. If false, a well-formed _rev must be included in the document. False is used by the replicator to insert documents into the target database even if that leads to the creation of conflicts.
rev (str) – (optional) Query parameter to specify a document revision.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with dict result representing a DocumentResult object
- put_security(db: str, *, admins: SecurityObject = None, members: SecurityObject = None, cloudant: dict = None, couchdb_auth_only: bool = None, **kwargs) DetailedResponse ¶
Modify database permissions.
Modify who has permission to read, write, or manage a database. This endpoint can be used to modify both Cloudant and CouchDB related permissions. Be careful: by removing a Cloudant API key, a member or an admin from the list of users that have access permissions, you remove it from the list of users that have access to the database. ### Note about nobody role The nobody username applies to all unauthenticated connection attempts. For example, if an application tries to read data from a database, but did not identify itself, the task can continue only if the nobody user has the role _reader.
- Parameters:
db (str) – Path parameter to specify the database name.
admins (SecurityObject) – (optional) Schema for names and roles to map to a database permission.
members (SecurityObject) – (optional) Schema for names and roles to map to a database permission.
cloudant (dict) – (optional) Database permissions for Cloudant users and/or API keys.
couchdb_auth_only (bool) – (optional) Manage permissions using the _users database only.
headers (dict) – A dict containing the request headers
- Returns:
A DetailedResponse containing the result, headers and HTTP status code.
- Return type:
DetailedResponse with dict result representing a Ok object
- set_default_headers(headers: Dict[str, str])¶
Set http headers to be sent in every request.
- Arguments:
headers: A dictionary of headers
- set_service_url(service_url: str)¶
Set the url the service will make HTTP requests too.
- Arguments:
service_url: The WHATWG URL standard origin ex. https://example.service.com
- Raises:
ValueError: Improperly formatted service_url
- DEFAULT_SERVICE_NAME = 'cloudant'¶
- DEFAULT_SERVICE_URL = 'http://localhost:5984'¶
- class ibmcloudant.cloudant_v1.ContentInformationSizes(active: int, external: int, file: int)¶
Bases:
object
Schema for size information of content.
- Attr int active:
The active size of the content, in bytes.
- Attr int external:
The total uncompressed size of the content, in bytes.
- Attr int file:
The total size of the content as stored on disk, in bytes.
- classmethod from_dict(_dict: Dict) ContentInformationSizes ¶
Initialize a ContentInformationSizes object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.CorsInformation(allow_credentials: bool, enable_cors: bool, origins: List[str])¶
Bases:
object
Schema for information about the CORS configuration.
- Attr bool allow_credentials:
Boolean value to allow authentication credentials. If set to true, browser requests must be done by using withCredentials = true.
- Attr bool enable_cors:
Boolean value to turn CORS on and off.
- Attr List[str] origins:
An array of strings that contain allowed origin domains. You have to specify the full URL including the protocol. It is recommended that only the HTTPS protocol is used. Subdomains count as separate domains, so you have to specify all subdomains used.
- classmethod from_dict(_dict: Dict) CorsInformation ¶
Initialize a CorsInformation object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.CurrentThroughputInformation(throughput: CurrentThroughputInformationThroughput)¶
Bases:
object
Schema for information about current consumption of a provisioned throughput capacity.
- Attr CurrentThroughputInformationThroughput throughput:
Detailed information about current consumption.
- classmethod from_dict(_dict: Dict) CurrentThroughputInformation ¶
Initialize a CurrentThroughputInformation object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.CurrentThroughputInformationThroughput(query: int, read: int, write: int)¶
Bases:
object
Detailed information about current consumption.
- Attr int query:
Number of global queries conducted against the instance for a given second.
- Attr int read:
Number of reads conducted against the instance for a given second.
- Attr int write:
Number of writes conducted against the instance for a given second.
- classmethod from_dict(_dict: Dict) CurrentThroughputInformationThroughput ¶
Initialize a CurrentThroughputInformationThroughput object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.DatabaseInformation(cluster: DatabaseInformationCluster, compact_running: bool, db_name: str, disk_format_version: int, doc_count: int, doc_del_count: int, props: DatabaseInformationProps, sizes: ContentInformationSizes, update_seq: str, *, committed_update_seq: str = None, compacted_seq: str = None, engine: str = None, uuid: str = None)¶
Bases:
object
Schema for information about a database.
- Attr DatabaseInformationCluster cluster:
Schema for database cluster information.
- Attr str committed_update_seq:
(optional) An opaque string that describes the committed state of the database.
- Attr bool compact_running:
True if the database compaction routine is operating on this database.
- Attr str compacted_seq:
(optional) An opaque string that describes the compaction state of the database.
- Attr str db_name:
The name of the database.
- Attr int disk_format_version:
The version of the physical format used for the data when it is stored on disk.
- Attr int doc_count:
A count of the documents in the specified database.
- Attr int doc_del_count:
Number of deleted documents.
- Attr str engine:
(optional) The engine used for the database.
- Attr DatabaseInformationProps props:
Schema for database properties.
- Attr ContentInformationSizes sizes:
Schema for size information of content.
- Attr str update_seq:
An opaque string that describes the state of the database. Do not rely on this string for counting the number of updates.
- Attr str uuid:
(optional) The UUID of the database.
- classmethod from_dict(_dict: Dict) DatabaseInformation ¶
Initialize a DatabaseInformation object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.DatabaseInformationCluster(n: int, q: int, r: int, w: int)¶
Bases:
object
Schema for database cluster information.
- Attr int n:
Schema for the number of replicas of a database in a cluster.
- Attr int q:
Schema for the number of shards in a database. Each shard is a partition of the hash value range.
- Attr int r:
Read quorum. The number of consistent copies of a document that need to be read before a successful reply.
- Attr int w:
Write quorum. The number of copies of a document that need to be written before a successful reply.
- classmethod from_dict(_dict: Dict) DatabaseInformationCluster ¶
Initialize a DatabaseInformationCluster object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.DatabaseInformationProps(*, partitioned: bool = None)¶
Bases:
object
Schema for database properties.
- Attr bool partitioned:
(optional) The value is true for a partitioned database.
- classmethod from_dict(_dict: Dict) DatabaseInformationProps ¶
Initialize a DatabaseInformationProps object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.DbEvent(db_name: str, seq: str, type: str)¶
Bases:
object
Schema for a database change event.
- Attr str db_name:
Database name.
- Attr str seq:
Sequence number.
- Attr str type:
A database event.
- class TypeEnum(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
str
,Enum
A database event.
- CREATED = 'created'¶
- DELETED = 'deleted'¶
- UPDATED = 'updated'¶
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.DbUpdates(last_seq: str, results: List[DbEvent])¶
Bases:
object
Schema for database updates.
- Attr str last_seq:
Last sequence number.
- Attr List[DbEvent] results:
results.
- classmethod from_dict(_dict: Dict) DbUpdates ¶
Initialize a DbUpdates object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.DbsInfoResult(key: str, *, error: str = None, info: DatabaseInformation = None)¶
Bases:
object
Schema for database information keyed by database name.
- Attr str error:
(optional) The name of the error.
- Attr DatabaseInformation info:
(optional) Schema for information about a database.
- Attr str key:
Database name.
- classmethod from_dict(_dict: Dict) DbsInfoResult ¶
Initialize a DbsInfoResult object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.DeleteAttachmentEnums¶
Bases:
object
Enums for delete_attachment parameters.
- class ibmcloudant.cloudant_v1.DeleteDesignDocumentEnums¶
Bases:
object
Enums for delete_design_document parameters.
- class ibmcloudant.cloudant_v1.DeleteDocumentEnums¶
Bases:
object
Enums for delete_document parameters.
- class ibmcloudant.cloudant_v1.DeleteIndexEnums¶
Bases:
object
Enums for delete_index parameters.
- class ibmcloudant.cloudant_v1.DeleteLocalDocumentEnums¶
Bases:
object
Enums for delete_local_document parameters.
- class ibmcloudant.cloudant_v1.DeleteReplicationDocumentEnums¶
Bases:
object
Enums for delete_replication_document parameters.
- class ibmcloudant.cloudant_v1.DesignDocument(*, attachments: dict = None, conflicts: List[str] = None, deleted: bool = None, deleted_conflicts: List[str] = None, id: str = None, local_seq: str = None, rev: str = None, revisions: Revisions = None, revs_info: List[DocumentRevisionStatus] = None, autoupdate: bool = None, filters: dict = None, indexes: dict = None, language: str = None, options: DesignDocumentOptions = None, validate_doc_update: str = None, views: dict = None, **kwargs)¶
Bases:
object
Schema for a design document.
- Attr dict attachments:
(optional) Schema for a map of attachment name to attachment metadata.
- Attr List[str] conflicts:
(optional) Schema for a list of document revision identifiers.
- Attr bool deleted:
(optional) Deletion flag. Available if document was removed.
- Attr List[str] deleted_conflicts:
(optional) Schema for a list of document revision identifiers.
- Attr str id:
(optional) Document ID.
- Attr str local_seq:
(optional) Document’s update sequence in current database. Available if requested with local_seq=true query parameter.
- Attr str rev:
(optional) Schema for a document revision identifier.
- Attr Revisions revisions:
(optional) Schema for list of revision information.
- Attr List[DocumentRevisionStatus] revs_info:
(optional) Schema for a list of objects with information about local revisions and their status.
- Attr bool autoupdate:
(optional) Indicates whether to automatically build indexes defined in this design document.
- Attr dict filters:
(optional) Schema for filter functions definition. This schema is a map where keys are the names of the filter functions and values are the function definition in string format. Filter function formats, or filters the changes feed that pass filter rules. The function takes 2 parameters:
doc: The document that is being processed.
req: A Request JavaScript object with these properties: * body - string, Request body data as string.
If the request method is GET this field contains the value “undefined”. If the method is DELETE or HEAD the value is “” (empty string).
cookie - Cookies object.
form - Form Data object, contains the decoded body as key-value pairs if the Content-Type header was application/x-www-form-urlencoded.
headers - Request Headers object.
id - string, requested document id if it was specified or null otherwise.
info - Database Information object, see DatabaseInformation.
method - string or an array of chars, request method. String value is a method as one of: HEAD, GET, POST, PUT, DELETE, OPTIONS, TRACE, COPY. For not supported methods it will be represented as an array of char codes e.g. for VIEW it will be 86,73,69,87.
path - array of strings, requested path sections.
peer - string, request source IP address.
query - string, URL query parameters object. Note that multiple keys are not supported and the last key value suppresses others.
requested_path - array of strings, actual requested path section.
raw_path - string, raw requested path.
userCtx: User Context Object, containing information about the user writing the document (if present), see the UserContext.
secObj: Security Object, with lists of database security roles, see the SecurityObject.
uuid - string, generated UUID by a specified algorithm in the config file.
Filter functions must return true if a document passed all the rules.
- Attr dict indexes:
(optional) Search (text) index function definitions.
- Attr str language:
(optional) Defines Query Server key to process design document functions.
- Attr DesignDocumentOptions options:
(optional) Schema for design document options.
- Attr str validate_doc_update:
(optional) Validate document update function can be used to prevent invalid or unauthorized document update requests from being stored. Validation functions typically examine the structure of the new document to ensure that required fields are present and to verify that the requesting user should be allowed to make changes to the document properties. When a write request is received for a given database, the validation function in each design document in that database is called in an unspecified order. If any of the validation functions throw an error, the write will not succeed. The validation function can abort the pending document write by throwing one of two error objects:
` // user is not authorized to make the change but may re-authenticate throw({ unauthorized: 'Error message here.' }); // change is not allowed throw({ forbidden: 'Error message here.' }); `
The function takes 4 parameters:newDoc - New version of document that will be stored from the update request.
oldDoc - Previous version of document that is already stored.
userCtx - User Context Object, containing information about the user writing the document (if present), see the UserContext.
secObj - Security Object, with lists of database security roles, see the SecurityObject.
- Attr dict views:
(optional) Schema for design document views.
- classmethod from_dict(_dict: Dict) DesignDocument ¶
Initialize a DesignDocument object from a json dictionary.
- get_properties() Dict ¶
Return a dictionary of arbitrary properties from this instance of DesignDocument
- set_properties(_dict: dict)¶
Set a dictionary of arbitrary properties to this instance of DesignDocument
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.DesignDocumentInformation(name: str, view_index: DesignDocumentViewIndex)¶
Bases:
object
Schema for information about a design document.
- Attr str name:
name.
- Attr DesignDocumentViewIndex view_index:
View index information.
- classmethod from_dict(_dict: Dict) DesignDocumentInformation ¶
Initialize a DesignDocumentInformation object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.DesignDocumentOptions(*, partitioned: bool = None)¶
Bases:
object
Schema for design document options.
- Attr bool partitioned:
(optional) Whether this design document describes partitioned or global indexes.
- classmethod from_dict(_dict: Dict) DesignDocumentOptions ¶
Initialize a DesignDocumentOptions object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.DesignDocumentViewIndex(collator_versions: List[str], compact_running: bool, language: str, signature: str, sizes: ContentInformationSizes, updater_running: bool, updates_pending: UpdatesPending, waiting_clients: int, waiting_commit: bool)¶
Bases:
object
View index information.
- Attr List[str] collator_versions:
List of collator versions. If there are multiple entries this implies a libicu upgrade has occurred but compaction has not run yet.
- Attr bool compact_running:
Indicates whether a compaction routine is currently running on the view.
- Attr str language:
Language for the defined views.
- Attr str signature:
MD5 signature of the views for the design document.
- Attr ContentInformationSizes sizes:
Schema for size information of content.
- Attr bool updater_running:
Indicates if the view is currently being updated.
- Attr UpdatesPending updates_pending:
Schema for an ability to tell if view is up-to-date without querying it.
- Attr int waiting_clients:
Number of clients waiting on views from this design document.
- Attr bool waiting_commit:
Indicates if there are outstanding commits to the underlying database that need to processed.
- classmethod from_dict(_dict: Dict) DesignDocumentViewIndex ¶
Initialize a DesignDocumentViewIndex object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.DesignDocumentViewsMapReduce(map: str, *, reduce: str = None)¶
Bases:
object
Schema for view functions definition.
- Attr str map:
JavaScript map function as a string.
- Attr str reduce:
(optional) JavaScript reduce function as a string.
- classmethod from_dict(_dict: Dict) DesignDocumentViewsMapReduce ¶
Initialize a DesignDocumentViewsMapReduce object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.DocsResultRow(key: str, *, caused_by: str = None, error: str = None, reason: str = None, doc: Document = None, id: str = None, value: DocsResultRowValue = None)¶
Bases:
object
Schema for a row of document information in a DocsResult.
- Attr str caused_by:
(optional) The cause of the error (if available).
- Attr str error:
(optional) The name of the error.
- Attr str reason:
(optional) The reason the error occurred (if available).
- Attr Document doc:
(optional) Schema for a document.
- Attr str id:
(optional) id.
- Attr str key:
Document ID.
- Attr DocsResultRowValue value:
(optional) Value of built-in /_all_docs style view.
- classmethod from_dict(_dict: Dict) DocsResultRow ¶
Initialize a DocsResultRow object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.DocsResultRowValue(rev: str, *, deleted: bool = None)¶
Bases:
object
Value of built-in /_all_docs style view.
- Attr bool deleted:
(optional) If true then the document is deleted. Not present for undeleted documents.
- Attr str rev:
Schema for a document revision identifier.
- classmethod from_dict(_dict: Dict) DocsResultRowValue ¶
Initialize a DocsResultRowValue object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.Document(*, attachments: dict = None, conflicts: List[str] = None, deleted: bool = None, deleted_conflicts: List[str] = None, id: str = None, local_seq: str = None, rev: str = None, revisions: Revisions = None, revs_info: List[DocumentRevisionStatus] = None, **kwargs)¶
Bases:
object
Schema for a document.
- Attr dict attachments:
(optional) Schema for a map of attachment name to attachment metadata.
- Attr List[str] conflicts:
(optional) Schema for a list of document revision identifiers.
- Attr bool deleted:
(optional) Deletion flag. Available if document was removed.
- Attr List[str] deleted_conflicts:
(optional) Schema for a list of document revision identifiers.
- Attr str id:
(optional) Document ID.
- Attr str local_seq:
(optional) Document’s update sequence in current database. Available if requested with local_seq=true query parameter.
- Attr str rev:
(optional) Schema for a document revision identifier.
- Attr Revisions revisions:
(optional) Schema for list of revision information.
- Attr List[DocumentRevisionStatus] revs_info:
(optional) Schema for a list of objects with information about local revisions and their status.
- get_properties() Dict ¶
Return a dictionary of arbitrary properties from this instance of Document
- set_properties(_dict: dict)¶
Set a dictionary of arbitrary properties to this instance of Document
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.DocumentResult(id: str, *, rev: str = None, ok: bool = None, caused_by: str = None, error: str = None, reason: str = None)¶
Bases:
object
Schema for the result of a document modification.
- Attr str id:
Schema for a document ID.
- Attr str rev:
(optional) Schema for a document revision identifier.
- Attr bool ok:
(optional) ok.
- Attr str caused_by:
(optional) The cause of the error (if available).
- Attr str error:
(optional) The name of the error.
- Attr str reason:
(optional) The reason the error occurred (if available).
- classmethod from_dict(_dict: Dict) DocumentResult ¶
Initialize a DocumentResult object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.DocumentRevisionStatus(rev: str, status: str)¶
Bases:
object
Schema for information about revisions and their status.
- Attr str rev:
Schema for a document revision identifier.
- Attr str status:
Status of the revision. May be one of: - available: Revision is available for retrieving with rev query parameter - missing: Revision is not available - deleted: Revision belongs to deleted document.
- class StatusEnum(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
str
,Enum
Status of the revision. May be one of: - available: Revision is available for retrieving with rev query parameter - missing: Revision is not available - deleted: Revision belongs to deleted document.
- AVAILABLE = 'available'¶
- DELETED = 'deleted'¶
- MISSING = 'missing'¶
- classmethod from_dict(_dict: Dict) DocumentRevisionStatus ¶
Initialize a DocumentRevisionStatus object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.DocumentShardInfo(nodes: List[str], range: str)¶
Bases:
object
Schema for document shard information.
- Attr List[str] nodes:
List of nodes serving a replica of the shard.
- Attr str range:
The shard range in which the document is stored.
- classmethod from_dict(_dict: Dict) DocumentShardInfo ¶
Initialize a DocumentShardInfo object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.ExecutionStats(execution_time_ms: float, results_returned: int, total_docs_examined: int, total_keys_examined: int, total_quorum_docs_examined: int)¶
Bases:
object
Schema for find query execution statistics.
- Attr float execution_time_ms:
Time to execute the query.
- Attr int results_returned:
Number of results returned.
- Attr int total_docs_examined:
Number of documents fetched from the index.
- Attr int total_keys_examined:
Number of rows scanned in the index.
- Attr int total_quorum_docs_examined:
Number of documents fetched from the primary index with the specified read quorum.
- classmethod from_dict(_dict: Dict) ExecutionStats ¶
Initialize a ExecutionStats object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.ExplainResult(covered: bool, dbname: str, fields: List[str], index: IndexInformation, limit: int, opts: dict, selector: dict, skip: int, *, range: ExplainResultRange = None)¶
Bases:
object
Schema for information about the index used for a find query.
- Attr bool covered:
When true, the query is answered using the index only and no documents are fetched.
- Attr str dbname:
Name of database.
- Attr List[str] fields:
Fields to be returned by the query.
- Attr IndexInformation index:
Schema for information about an index.
- Attr int limit:
The used maximum number of results returned.
- Attr dict opts:
Query options used.
- Attr ExplainResultRange range:
(optional) Range parameters passed to the underlying view.
- Attr dict selector:
JSON object describing criteria used to select documents. The selector specifies fields in the document, and provides an expression to evaluate with the field content or other data. The selector object must:
Be structured as valid JSON.
Contain a valid query expression.
Using a selector is significantly more efficient than using a JavaScript filter function, and is the recommended option if filtering on document attributes only. Elementary selector syntax requires you to specify one or more fields, and the corresponding values required for those fields. You can create more complex selector expressions by combining operators. Operators are identified by the use of a dollar sign $ prefix in the name field. There are two core types of operators in the selector syntax: * Combination operators: applied at the topmost level of selection. They are used to combine selectors. In addition to the common boolean operators ($and, $or, $not, $nor) there are three combination operators: $all, $elemMatch, and $allMatch. A combination operator takes a single argument. The argument is either another selector, or an array of selectors. * Condition operators: are specific to a field, and are used to evaluate the value stored in that field. For instance, the basic $eq operator matches when the specified field contains a value that is equal to the supplied argument. * Only equality operators such as $eq, $gt, $gte, $lt, and $lte (but not $ne) can be used as the basis of a query. You should include at least one of these in a selector. For further reference see [selector syntax](https://cloud.ibm.com/docs/Cloudant?topic=Cloudant-query#selector-syntax).
- Attr int skip:
Skip parameter used.
- classmethod from_dict(_dict: Dict) ExplainResult ¶
Initialize a ExplainResult object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.ExplainResultRange(*, end_key: List[object] = None, start_key: List[object] = None)¶
Bases:
object
Range parameters passed to the underlying view.
- Attr List[object] end_key:
(optional) End key parameter passed to the underlying view.
- Attr List[object] start_key:
(optional) Start key parameter passed to the underlying view.
- classmethod from_dict(_dict: Dict) ExplainResultRange ¶
Initialize a ExplainResultRange object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.FindResult(bookmark: str, docs: List[Document], *, execution_stats: ExecutionStats = None, warning: str = None)¶
Bases:
object
Schema for the result of a query find operation.
- Attr str bookmark:
Opaque bookmark token used when paginating results.
- Attr List[Document] docs:
Documents matching the selector.
- Attr ExecutionStats execution_stats:
(optional) Schema for find query execution statistics.
- Attr str warning:
(optional) warning.
- classmethod from_dict(_dict: Dict) FindResult ¶
Initialize a FindResult object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.GetDbUpdatesEnums¶
Bases:
object
Enums for get_db_updates parameters.
- class ibmcloudant.cloudant_v1.GetLocalDocumentEnums¶
Bases:
object
Enums for get_local_document parameters.
- class Accept(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
str
,Enum
The type of the response: application/json, multipart/mixed, multipart/related, or application/octet-stream.
- APPLICATION_JSON = 'application/json'¶
- APPLICATION_OCTET_STREAM = 'application/octet-stream'¶
- MULTIPART_MIXED = 'multipart/mixed'¶
- MULTIPART_RELATED = 'multipart/related'¶
- class ibmcloudant.cloudant_v1.GetSchedulerDocsEnums¶
Bases:
object
Enums for get_scheduler_docs parameters.
- class States(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
str
,Enum
Query parameter to include only replication documents in the specified states. String must be a comma-delimited string.
- COMPLETED = 'completed'¶
- CRASHING = 'crashing'¶
- ERROR = 'error'¶
- FAILED = 'failed'¶
- INITIALIZING = 'initializing'¶
- PENDING = 'pending'¶
- RUNNING = 'running'¶
- class ibmcloudant.cloudant_v1.IndexDefinition(*, default_analyzer: Analyzer = None, default_field: IndexTextOperatorDefaultField = None, fields: List[IndexField] = None, index_array_lengths: bool = None, partial_filter_selector: dict = None)¶
Bases:
object
Schema for a json or text query index definition. Indexes of type text have additional configuration properties that do not apply to json indexes, these are: * default_analyzer - the default text analyzer to use * default_field - whether to index the text in all document fields and what analyzer to use for that purpose.
- Attr Analyzer default_analyzer:
(optional) Schema for a full text search analyzer.
- Attr IndexTextOperatorDefaultField default_field:
(optional) Schema for the text index default field configuration. The default field is used to index the text of all fields within a document for use with the $text operator.
- Attr List[IndexField] fields:
(optional) List of field objects to index. Nested fields are also allowed, e.g. person.name. For “json” type indexes each object is a mapping of field name to sort direction (asc or desc). For “text” type indexes each object has a name property of the field name and a type property of the field type (string, number, or boolean).
- Attr bool index_array_lengths:
(optional) Whether to scan every document for arrays and store the length for each array found. Set the index_array_lengths field to false if: * You do not need to know the length of an array. * You do not use the $size operator. * The documents in your database are complex, or not completely under your control. As a result, it is difficult to estimate the impact of the extra processing that is needed to determine and store the arrays lengths.
- Attr dict partial_filter_selector:
(optional) JSON object describing criteria used to select documents. The selector specifies fields in the document, and provides an expression to evaluate with the field content or other data. The selector object must:
Be structured as valid JSON.
Contain a valid query expression.
Using a selector is significantly more efficient than using a JavaScript filter function, and is the recommended option if filtering on document attributes only. Elementary selector syntax requires you to specify one or more fields, and the corresponding values required for those fields. You can create more complex selector expressions by combining operators. Operators are identified by the use of a dollar sign $ prefix in the name field. There are two core types of operators in the selector syntax: * Combination operators: applied at the topmost level of selection. They are used to combine selectors. In addition to the common boolean operators ($and, $or, $not, $nor) there are three combination operators: $all, $elemMatch, and $allMatch. A combination operator takes a single argument. The argument is either another selector, or an array of selectors. * Condition operators: are specific to a field, and are used to evaluate the value stored in that field. For instance, the basic $eq operator matches when the specified field contains a value that is equal to the supplied argument. * Only equality operators such as $eq, $gt, $gte, $lt, and $lte (but not $ne) can be used as the basis of a query. You should include at least one of these in a selector. For further reference see [selector syntax](https://cloud.ibm.com/docs/Cloudant?topic=Cloudant-query#selector-syntax).
- classmethod from_dict(_dict: Dict) IndexDefinition ¶
Initialize a IndexDefinition object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.IndexField(*, name: str = None, type: str = None, **kwargs)¶
Bases:
object
Schema for indexed fields for use with declarative JSON query.
- Attr str name:
(optional) Name of the field.
- Attr str type:
(optional) The type of the named field.
- class TypeEnum(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
str
,Enum
The type of the named field.
- BOOLEAN = 'boolean'¶
- NUMBER = 'number'¶
- STRING = 'string'¶
- classmethod from_dict(_dict: Dict) IndexField ¶
Initialize a IndexField object from a json dictionary.
- get_properties() Dict ¶
Return a dictionary of arbitrary properties from this instance of IndexField
- set_properties(_dict: dict)¶
Set a dictionary of arbitrary properties to this instance of IndexField
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.IndexInformation(ddoc: str, def_: IndexDefinition, name: str, type: str)¶
Bases:
object
Schema for information about an index.
- Attr str ddoc:
Design document ID.
- Attr IndexDefinition defdef_:
Schema for a json or text query index definition. Indexes of type text have additional configuration properties that do not apply to json indexes, these are: * default_analyzer - the default text analyzer to use * default_field - whether to index the text in all document fields and what analyzer to use for that purpose.
- Attr str name:
Index name.
- Attr str type:
Schema for the type of an index.
- class TypeEnum(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
str
,Enum
Schema for the type of an index.
- JSON = 'json'¶
- SPECIAL = 'special'¶
- TEXT = 'text'¶
- classmethod from_dict(_dict: Dict) IndexInformation ¶
Initialize a IndexInformation object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.IndexResult(id: str, name: str, result: str)¶
Bases:
object
Schema for the result of creating an index.
- Attr str id:
Id of the design document the index was created in.
- Attr str name:
Name of the index created.
- Attr str result:
Flag to show whether the index was created or one already exists.
- class ResultEnum(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
str
,Enum
Flag to show whether the index was created or one already exists.
- CREATED = 'created'¶
- EXISTS = 'exists'¶
- classmethod from_dict(_dict: Dict) IndexResult ¶
Initialize a IndexResult object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.IndexTextOperatorDefaultField(*, analyzer: Analyzer = None, enabled: bool = None)¶
Bases:
object
Schema for the text index default field configuration. The default field is used to index the text of all fields within a document for use with the $text operator.
- Attr Analyzer analyzer:
(optional) Schema for a full text search analyzer.
- Attr bool enabled:
(optional) Whether or not the default_field is enabled.
- classmethod from_dict(_dict: Dict) IndexTextOperatorDefaultField ¶
Initialize a IndexTextOperatorDefaultField object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.IndexesInformation(total_rows: int, indexes: List[IndexInformation])¶
Bases:
object
Schema for information about the indexes in a database.
- Attr int total_rows:
Number of total rows.
- Attr List[IndexInformation] indexes:
Indexes.
- classmethod from_dict(_dict: Dict) IndexesInformation ¶
Initialize a IndexesInformation object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.MembershipInformation(all_nodes: List[str], cluster_nodes: List[str])¶
Bases:
object
Schema for information about known nodes and cluster membership.
- Attr List[str] all_nodes:
List of nodes this node knows about, including the ones that are part of the cluster.
- Attr List[str] cluster_nodes:
All cluster nodes.
- classmethod from_dict(_dict: Dict) MembershipInformation ¶
Initialize a MembershipInformation object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.Ok(*, ok: bool = None)¶
Bases:
object
Schema for an OK result.
- Attr bool ok:
(optional) ok.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.PartitionInformation(db_name: str, doc_count: int, doc_del_count: int, partition: str, sizes: PartitionInformationSizes, *, partitioned_indexes: PartitionInformationIndexes = None)¶
Bases:
object
Schema for information about a database partition.
- Attr str db_name:
The name of the database.
- Attr int doc_count:
A count of the documents in the specified database partition.
- Attr int doc_del_count:
Number of deleted documents.
- Attr str partition:
The name of the partition in the database.
- Attr PartitionInformationIndexes partitioned_indexes:
(optional) Schema for information about the partition index count and limit in a database.
- Attr PartitionInformationSizes sizes:
The size of active and external data, in bytes.
- classmethod from_dict(_dict: Dict) PartitionInformation ¶
Initialize a PartitionInformation object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.PartitionInformationIndexes(*, count: int = None, indexes: PartitionInformationIndexesIndexes = None, limit: int = None)¶
Bases:
object
Schema for information about the partition index count and limit in a database.
- Attr int count:
(optional) Total count of the partitioned indexes.
- Attr PartitionInformationIndexesIndexes indexes:
(optional) The count breakdown of partitioned indexes.
- Attr int limit:
(optional) The partitioned index limit.
- classmethod from_dict(_dict: Dict) PartitionInformationIndexes ¶
Initialize a PartitionInformationIndexes object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.PartitionInformationIndexesIndexes(*, search: int = None, view: int = None)¶
Bases:
object
The count breakdown of partitioned indexes.
- Attr int search:
(optional) Number of partitioned search indexes.
- Attr int view:
(optional) Number of partitioned view indexes.
- classmethod from_dict(_dict: Dict) PartitionInformationIndexesIndexes ¶
Initialize a PartitionInformationIndexesIndexes object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.PartitionInformationSizes(*, active: int = None, external: int = None)¶
Bases:
object
The size of active and external data, in bytes.
- Attr int active:
(optional) The size of live data inside the database, in bytes.
- Attr int external:
(optional) The uncompressed size of database contents in bytes.
- classmethod from_dict(_dict: Dict) PartitionInformationSizes ¶
Initialize a PartitionInformationSizes object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.PostChangesAsStreamEnums¶
Bases:
object
Enums for post_changes_as_stream parameters.
- class ibmcloudant.cloudant_v1.PostChangesEnums¶
Bases:
object
Enums for post_changes parameters.
- class ibmcloudant.cloudant_v1.PostDesignDocsEnums¶
Bases:
object
Enums for post_design_docs parameters.
- class ibmcloudant.cloudant_v1.PostDesignDocsQueriesEnums¶
Bases:
object
Enums for post_design_docs_queries parameters.
- class ibmcloudant.cloudant_v1.PostDocumentEnums¶
Bases:
object
Enums for post_document parameters.
- class Batch(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
str
,Enum
Query parameter to specify whether to store in batch mode. The server will respond with a HTTP 202 Accepted response code immediately.
- OK = 'ok'¶
- class ContentType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
str
,Enum
The type of the input.
- APPLICATION_JSON = 'application/json'¶
- APPLICATION_OCTET_STREAM = 'application/octet-stream'¶
- MULTIPART_MIXED = 'multipart/mixed'¶
- MULTIPART_RELATED = 'multipart/related'¶
- class ibmcloudant.cloudant_v1.PutDesignDocumentEnums¶
Bases:
object
Enums for put_design_document parameters.
- class ibmcloudant.cloudant_v1.PutDocumentEnums¶
Bases:
object
Enums for put_document parameters.
- class Batch(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
str
,Enum
Query parameter to specify whether to store in batch mode. The server will respond with a HTTP 202 Accepted response code immediately.
- OK = 'ok'¶
- class ContentType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
str
,Enum
The type of the input.
- APPLICATION_JSON = 'application/json'¶
- APPLICATION_OCTET_STREAM = 'application/octet-stream'¶
- MULTIPART_MIXED = 'multipart/mixed'¶
- MULTIPART_RELATED = 'multipart/related'¶
- class ibmcloudant.cloudant_v1.PutLocalDocumentEnums¶
Bases:
object
Enums for put_local_document parameters.
- class Batch(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
str
,Enum
Query parameter to specify whether to store in batch mode. The server will respond with a HTTP 202 Accepted response code immediately.
- OK = 'ok'¶
- class ContentType(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
str
,Enum
The type of the input.
- APPLICATION_JSON = 'application/json'¶
- APPLICATION_OCTET_STREAM = 'application/octet-stream'¶
- MULTIPART_MIXED = 'multipart/mixed'¶
- MULTIPART_RELATED = 'multipart/related'¶
- class ibmcloudant.cloudant_v1.PutReplicationDocumentEnums¶
Bases:
object
Enums for put_replication_document parameters.
- class ibmcloudant.cloudant_v1.ReplicationCreateTargetParameters(*, n: int = None, partitioned: bool = None, q: int = None)¶
Bases:
object
Request parameters to use during target database creation.
- Attr int n:
(optional) Schema for the number of replicas of a database in a cluster.
- Attr bool partitioned:
(optional) Parameter to specify whether to enable database partitions when creating the target database.
- Attr int q:
(optional) Schema for the number of shards in a database. Each shard is a partition of the hash value range.
- classmethod from_dict(_dict: Dict) ReplicationCreateTargetParameters ¶
Initialize a ReplicationCreateTargetParameters object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.ReplicationDatabase(url: str, *, auth: ReplicationDatabaseAuth = None, headers_: dict = None)¶
Bases:
object
Schema for a replication source or target database.
- Attr ReplicationDatabaseAuth auth:
(optional) Schema for replication source or target database authentication.
- Attr dict headersheaders_:
(optional) Replication request headers.
- Attr str url:
Replication database URL.
- classmethod from_dict(_dict: Dict) ReplicationDatabase ¶
Initialize a ReplicationDatabase object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.ReplicationDatabaseAuth(*, basic: ReplicationDatabaseAuthBasic = None, iam: ReplicationDatabaseAuthIam = None)¶
Bases:
object
Schema for replication source or target database authentication.
- Attr ReplicationDatabaseAuthBasic basic:
(optional) Schema for basic authentication of replication source or target database.
- Attr ReplicationDatabaseAuthIam iam:
(optional) Schema for an IAM API key for replication database authentication.
- classmethod from_dict(_dict: Dict) ReplicationDatabaseAuth ¶
Initialize a ReplicationDatabaseAuth object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.ReplicationDatabaseAuthBasic(password: str, username: str)¶
Bases:
object
Schema for basic authentication of replication source or target database.
- Attr str password:
The password associated with the username.
- Attr str username:
The username.
- classmethod from_dict(_dict: Dict) ReplicationDatabaseAuthBasic ¶
Initialize a ReplicationDatabaseAuthBasic object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.ReplicationDatabaseAuthIam(api_key: str)¶
Bases:
object
Schema for an IAM API key for replication database authentication.
- Attr str api_key:
IAM API key.
- classmethod from_dict(_dict: Dict) ReplicationDatabaseAuthIam ¶
Initialize a ReplicationDatabaseAuthIam object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.ReplicationDocument(source: ReplicationDatabase, target: ReplicationDatabase, *, attachments: dict = None, conflicts: List[str] = None, deleted: bool = None, deleted_conflicts: List[str] = None, id: str = None, local_seq: str = None, rev: str = None, revisions: Revisions = None, revs_info: List[DocumentRevisionStatus] = None, cancel: bool = None, checkpoint_interval: int = None, connection_timeout: int = None, continuous: bool = None, create_target: bool = None, create_target_params: ReplicationCreateTargetParameters = None, doc_ids: List[str] = None, filter: str = None, http_connections: int = None, query_params: dict = None, retries_per_request: int = None, selector: dict = None, since_seq: str = None, socket_options: str = None, source_proxy: str = None, target_proxy: str = None, use_bulk_get: bool = None, use_checkpoints: bool = None, user_ctx: UserContext = None, winning_revs_only: bool = None, worker_batch_size: int = None, worker_processes: int = None, **kwargs)¶
Bases:
object
Schema for a replication document. Note that selector, doc_ids, and filter are incompatible with each other.
- Attr dict attachments:
(optional) Schema for a map of attachment name to attachment metadata.
- Attr List[str] conflicts:
(optional) Schema for a list of document revision identifiers.
- Attr bool deleted:
(optional) Deletion flag. Available if document was removed.
- Attr List[str] deleted_conflicts:
(optional) Schema for a list of document revision identifiers.
- Attr str id:
(optional) Document ID.
- Attr str local_seq:
(optional) Document’s update sequence in current database. Available if requested with local_seq=true query parameter.
- Attr str rev:
(optional) Schema for a document revision identifier.
- Attr Revisions revisions:
(optional) Schema for list of revision information.
- Attr List[DocumentRevisionStatus] revs_info:
(optional) Schema for a list of objects with information about local revisions and their status.
- Attr bool cancel:
(optional) Cancels the replication.
- Attr int checkpoint_interval:
(optional) Defines replication checkpoint interval in milliseconds.
- Attr int connection_timeout:
(optional) HTTP connection timeout per replication. Even for very fast/reliable networks it might need to be increased if a remote database is too busy.
- Attr bool continuous:
(optional) Configure the replication to be continuous.
- Attr bool create_target:
(optional) Creates the target database. Requires administrator privileges on target server.
- Attr ReplicationCreateTargetParameters create_target_params:
(optional) Request parameters to use during target database creation.
- Attr List[str] doc_ids:
(optional) Schema for a list of document IDs.
- Attr str filter:
(optional) The name of a filter function which is defined in a design document in the source database in {ddoc_id}/{filter} format. It determines which documents get replicated. Using the selector option provides performance benefits when compared with using the filter option. Use the selector option when possible.
- Attr int http_connections:
(optional) Maximum number of HTTP connections per replication.
- Attr dict query_params:
(optional) Schema for a map of string key value pairs, such as query parameters.
- Attr int retries_per_request:
(optional) Number of times a replication request is retried. The requests are retried with a doubling exponential backoff starting at 0.25 seconds, with a cap at 5 minutes.
- Attr dict selector:
(optional) JSON object describing criteria used to select documents. The selector specifies fields in the document, and provides an expression to evaluate with the field content or other data. The selector object must:
Be structured as valid JSON.
Contain a valid query expression.
Using a selector is significantly more efficient than using a JavaScript filter function, and is the recommended option if filtering on document attributes only. Elementary selector syntax requires you to specify one or more fields, and the corresponding values required for those fields. You can create more complex selector expressions by combining operators. Operators are identified by the use of a dollar sign $ prefix in the name field. There are two core types of operators in the selector syntax: * Combination operators: applied at the topmost level of selection. They are used to combine selectors. In addition to the common boolean operators ($and, $or, $not, $nor) there are three combination operators: $all, $elemMatch, and $allMatch. A combination operator takes a single argument. The argument is either another selector, or an array of selectors. * Condition operators: are specific to a field, and are used to evaluate the value stored in that field. For instance, the basic $eq operator matches when the specified field contains a value that is equal to the supplied argument. * Only equality operators such as $eq, $gt, $gte, $lt, and $lte (but not $ne) can be used as the basis of a query. You should include at least one of these in a selector. For further reference see [selector syntax](https://cloud.ibm.com/docs/Cloudant?topic=Cloudant-query#selector-syntax).
- Attr str since_seq:
(optional) Start the replication at a specific sequence value.
- Attr str socket_options:
(optional) Replication socket options.
- Attr ReplicationDatabase source:
Schema for a replication source or target database.
- Attr str source_proxy:
(optional) Address of a (http or socks5 protocol) proxy server through which replication with the source database should occur.
- Attr ReplicationDatabase target:
Schema for a replication source or target database.
- Attr str target_proxy:
(optional) Address of a (http or socks5 protocol) proxy server through which replication with the target database should occur.
- Attr bool use_bulk_get:
(optional) Specify whether to use _bulk_get for fetching documents from the source. If unset, the server configured default will be used.
- Attr bool use_checkpoints:
(optional) Specify if checkpoints should be saved during replication. Using checkpoints means a replication can be efficiently resumed.
- Attr UserContext user_ctx:
(optional) Schema for the user context of a session.
- Attr bool winning_revs_only:
(optional) Replicate only the winning revisions. Replication with this mode discards conflicting revisions. Replication IDs and checkpoints generated by this mode are different to those generated by default, so it is possible to first replicate the winning revisions then later backfill remaining revisions with a regular replication job.
- Attr int worker_batch_size:
(optional) Controls how many documents are processed. After each batch a checkpoint is written so this controls how frequently checkpointing occurs.
- Attr int worker_processes:
(optional) Controls how many separate processes will read from the changes manager and write to the target. A higher number can improve throughput.
- classmethod from_dict(_dict: Dict) ReplicationDocument ¶
Initialize a ReplicationDocument object from a json dictionary.
- get_properties() Dict ¶
Return a dictionary of arbitrary properties from this instance of ReplicationDocument
- set_properties(_dict: dict)¶
Set a dictionary of arbitrary properties to this instance of ReplicationDocument
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.Revisions(ids: List[str], start: int)¶
Bases:
object
Schema for list of revision information.
- Attr List[str] ids:
Array of valid revision IDs, in reverse order (latest first).
- Attr int start:
Prefix number for the latest revision.
- classmethod from_dict(_dict: Dict) Revisions ¶
Initialize a Revisions object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.RevsDiff(*, missing: List[str] = None, possible_ancestors: List[str] = None)¶
Bases:
object
Schema for information about missing revs and possible ancestors.
- Attr List[str] missing:
(optional) List of missing revisions.
- Attr List[str] possible_ancestors:
(optional) List of possible ancestor revisions.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.SchedulerDocsResult(total_rows: int, docs: List[SchedulerDocument])¶
Bases:
object
Schema for a listing of replication scheduler documents.
- Attr int total_rows:
Number of total rows.
- Attr List[SchedulerDocument] docs:
Array of replication scheduler doc objects.
- classmethod from_dict(_dict: Dict) SchedulerDocsResult ¶
Initialize a SchedulerDocsResult object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.SchedulerDocument(database: str, doc_id: str, error_count: int, id: str, info: SchedulerInfo, last_updated: datetime, start_time: datetime, state: str, *, node: str = None, source: str = None, source_proxy: str = None, target: str = None, target_proxy: str = None)¶
Bases:
object
Schema for a replication scheduler document.
- Attr str database:
Database where replication document came from.
- Attr str doc_id:
Replication document ID.
- Attr int error_count:
Consecutive errors count. Indicates how many times in a row this replication has crashed. Replication will be retried with an exponential backoff based on this number. As soon as the replication succeeds this count is reset to 0. To can be used to get an idea why a particular replication is not making progress.
- Attr str id:
Replication ID, or null if state is completed or failed.
- Attr SchedulerInfo info:
Schema for scheduler document information. A JSON object that may contain additional information about the state. For error states this will contain an error field and string value.
- Attr datetime last_updated:
Timestamp of last state update.
- Attr str node:
(optional) Cluster node where the job is running.
- Attr str source:
(optional) Replication source.
- Attr str source_proxy:
(optional) Address of the (http or socks5 protocol) proxy server through which replication with the source database occurs.
- Attr datetime start_time:
Timestamp of when the replication was started.
- Attr str state:
Schema for replication state.
- Attr str target:
(optional) Replication target.
- Attr str target_proxy:
(optional) Address of the (http or socks5 protocol) proxy server through which replication with the target database occurs.
- class StateEnum(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
str
,Enum
Schema for replication state.
- COMPLETED = 'completed'¶
- CRASHING = 'crashing'¶
- ERROR = 'error'¶
- FAILED = 'failed'¶
- INITIALIZING = 'initializing'¶
- PENDING = 'pending'¶
- RUNNING = 'running'¶
- classmethod from_dict(_dict: Dict) SchedulerDocument ¶
Initialize a SchedulerDocument object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.SchedulerInfo(*, changes_pending: int = None, checkpointed_source_seq: str = None, doc_write_failures: int = None, docs_read: int = None, docs_written: int = None, error: str = None, missing_revisions_found: int = None, revisions_checked: int = None, source_seq: str = None, through_seq: str = None)¶
Bases:
object
Schema for scheduler document information. A JSON object that may contain additional information about the state. For error states this will contain an error field and string value.
- Attr int changes_pending:
(optional) The count of changes not yet replicated.
- Attr str checkpointed_source_seq:
(optional) The source sequence id which was last successfully replicated.
- Attr int doc_write_failures:
(optional) The count of docs which failed to be written to the target.
- Attr int docs_read:
(optional) The count of docs which have been read from the source.
- Attr int docs_written:
(optional) The count of docs which have been written to the target.
- Attr str error:
(optional) Replication error message.
- Attr int missing_revisions_found:
(optional) The count of revisions which were found on the source, but missing from the target.
- Attr int revisions_checked:
(optional) The count of revisions which have been checked since this replication began.
- Attr str source_seq:
(optional) The last sequence number obtained from the source database changes feed.
- Attr str through_seq:
(optional) The last sequence number processed by the replicator.
- classmethod from_dict(_dict: Dict) SchedulerInfo ¶
Initialize a SchedulerInfo object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.SchedulerJob(database: str, doc_id: str, history: List[SchedulerJobEvent], id: str, info: SchedulerInfo, node: str, pid: str, source: str, start_time: datetime, target: str, user: str)¶
Bases:
object
Schema for a replication scheduler job.
- Attr str database:
Replication document database.
- Attr str doc_id:
Replication document ID.
- Attr List[SchedulerJobEvent] history:
Timestamped history of events as a list of objects.
- Attr str id:
Schema for a replication job id.
- Attr SchedulerInfo info:
Schema for scheduler document information. A JSON object that may contain additional information about the state. For error states this will contain an error field and string value.
- Attr str node:
Cluster node where the job is running.
- Attr str pid:
Replication process ID.
- Attr str source:
Replication source.
- Attr datetime start_time:
Timestamp of when the replication was started.
- Attr str target:
Replication target.
- Attr str user:
Name of user running replication.
- classmethod from_dict(_dict: Dict) SchedulerJob ¶
Initialize a SchedulerJob object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.SchedulerJobEvent(timestamp: datetime, type: str, *, reason: str = None)¶
Bases:
object
Schema for a replication scheduler job event.
- Attr str reason:
(optional) Reason for current state of event.
- Attr datetime timestamp:
Timestamp of the event.
- Attr str type:
Type of the event.
- classmethod from_dict(_dict: Dict) SchedulerJobEvent ¶
Initialize a SchedulerJobEvent object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.SchedulerJobsResult(total_rows: int, jobs: List[SchedulerJob])¶
Bases:
object
Schema for a listing of replication scheduler jobs.
- Attr int total_rows:
Number of total rows.
- Attr List[SchedulerJob] jobs:
Array of replication job objects.
- classmethod from_dict(_dict: Dict) SchedulerJobsResult ¶
Initialize a SchedulerJobsResult object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.SearchAnalyzeResult(tokens: List[str])¶
Bases:
object
Schema for the output of testing search analyzer tokenization.
- Attr List[str] tokens:
tokens.
- classmethod from_dict(_dict: Dict) SearchAnalyzeResult ¶
Initialize a SearchAnalyzeResult object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.SearchIndexDefinition(index: str, *, analyzer: AnalyzerConfiguration = None)¶
Bases:
object
Schema for a search index definition.
- Attr AnalyzerConfiguration analyzer:
(optional) Schema for a search analyzer configuration.
- Attr str index:
String form of a JavaScript function that is called for each document in the database. The function takes the document as a parameter, extracts some data from it, and then calls the index function to index that data. The index function takes 2, or optionally 3, parameters. * The first parameter is the name of the field you intend to use when
querying the index. If the special value “default” is used when you define the name, you do not have to specify a field name at query time.
The second parameter is the data to be indexed. This data must be only a string, number, or boolean. Other types will cause an error to be thrown by the index function call.
The optional third parameter is a JavaScript object with these properties:
facet - boolean, default false - Creates a faceted index.
index - boolean, default true - If set to false, the data cannot be used for searches, but can still be retrieved from the index if store is set to true.
store - boolean, default true - If true, the value is returned in the search result; otherwise, the value is not returned.
- classmethod from_dict(_dict: Dict) SearchIndexDefinition ¶
Initialize a SearchIndexDefinition object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.SearchIndexInfo(committed_seq: int, disk_size: int, doc_count: int, doc_del_count: int, pending_seq: int, signature: str)¶
Bases:
object
Schema for metadata information about a search index.
- Attr int committed_seq:
The committed sequence identifier.
- Attr int disk_size:
The size of the search index on disk.
- Attr int doc_count:
The count of the number of indexed documents.
- Attr int doc_del_count:
The number of deleted documents.
- Attr int pending_seq:
The pending sequence identifier.
- Attr str signature:
Unique signature of the search index.
- classmethod from_dict(_dict: Dict) SearchIndexInfo ¶
Initialize a SearchIndexInfo object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.SearchInfoResult(name: str, search_index: SearchIndexInfo)¶
Bases:
object
Schema for search index information.
- Attr str name:
The name of the search index prefixed by the design document ID where the index is stored.
- Attr SearchIndexInfo search_index:
Schema for metadata information about a search index.
- classmethod from_dict(_dict: Dict) SearchInfoResult ¶
Initialize a SearchInfoResult object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.SearchResult(total_rows: int, *, bookmark: str = None, by: str = None, counts: dict = None, ranges: dict = None, rows: List[SearchResultRow] = None, groups: List[SearchResultProperties] = None)¶
Bases:
object
Schema for the result of a query search operation.
- Attr int total_rows:
Number of total rows.
- Attr str bookmark:
(optional) Opaque bookmark token used when paginating results.
- Attr str by:
(optional) Grouped search matches.
- Attr dict counts:
(optional) The counts facet syntax returns the number of query results for each unique value of each named field.
- Attr dict ranges:
(optional) The range facet syntax reuses the standard Lucene syntax for ranges to return counts of results that fit into each specified category.
- Attr List[SearchResultRow] rows:
(optional) Array of row objects.
- Attr List[SearchResultProperties] groups:
(optional) Array of grouped search matches.
- classmethod from_dict(_dict: Dict) SearchResult ¶
Initialize a SearchResult object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.SearchResultProperties(total_rows: int, *, bookmark: str = None, by: str = None, counts: dict = None, ranges: dict = None, rows: List[SearchResultRow] = None)¶
Bases:
object
Schema for the result of a query search operation.
- Attr int total_rows:
Number of total rows.
- Attr str bookmark:
(optional) Opaque bookmark token used when paginating results.
- Attr str by:
(optional) Grouped search matches.
- Attr dict counts:
(optional) The counts facet syntax returns the number of query results for each unique value of each named field.
- Attr dict ranges:
(optional) The range facet syntax reuses the standard Lucene syntax for ranges to return counts of results that fit into each specified category.
- Attr List[SearchResultRow] rows:
(optional) Array of row objects.
- classmethod from_dict(_dict: Dict) SearchResultProperties ¶
Initialize a SearchResultProperties object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.SearchResultRow(fields: dict, id: str, *, doc: Document = None, highlights: dict = None)¶
Bases:
object
Schema for a row of the result of a query search operation.
- Attr Document doc:
(optional) Schema for a document.
- Attr dict fields:
Schema for the fields returned by a query search operation, a map of field name to value.
- Attr dict highlights:
(optional) Returns the context in which a search term was mentioned so that you can display more emphasized results to a user.
- Attr str id:
Schema for a document ID.
- classmethod from_dict(_dict: Dict) SearchResultRow ¶
Initialize a SearchResultRow object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.Security(*, admins: SecurityObject = None, members: SecurityObject = None, cloudant: dict = None, couchdb_auth_only: bool = None)¶
Bases:
object
Schema for a security document.
- Attr SecurityObject admins:
(optional) Schema for names and roles to map to a database permission.
- Attr SecurityObject members:
(optional) Schema for names and roles to map to a database permission.
- Attr dict cloudant:
(optional) Database permissions for Cloudant users and/or API keys.
- Attr bool couchdb_auth_only:
(optional) Manage permissions using the _users database only.
- class CloudantEnum(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
str
,Enum
Database permissions for Cloudant users and/or API keys.
- ADMIN = '_admin'¶
- DB_UPDATES = '_db_updates'¶
- DESIGN = '_design'¶
- READER = '_reader'¶
- REPLICATOR = '_replicator'¶
- SECURITY = '_security'¶
- SHARDS = '_shards'¶
- WRITER = '_writer'¶
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.SecurityObject(*, names: List[str] = None, roles: List[str] = None)¶
Bases:
object
Schema for names and roles to map to a database permission.
- Attr List[str] names:
(optional) List of usernames.
- Attr List[str] roles:
(optional) List of roles.
- classmethod from_dict(_dict: Dict) SecurityObject ¶
Initialize a SecurityObject object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.ServerInformation(couchdb: str, features: List[str], vendor: ServerVendor, version: str, features_flags: List[str])¶
Bases:
object
Schema for information about the server instance.
- Attr str couchdb:
Welcome message.
- Attr List[str] features:
List of enabled optional features.
- Attr ServerVendor vendor:
Schema for server vendor information.
- Attr str version:
Apache CouchDB version.
- Attr List[str] features_flags:
List of feature flags.
- classmethod from_dict(_dict: Dict) ServerInformation ¶
Initialize a ServerInformation object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.ServerVendor(name: str, *, variant: str = None, version: str = None)¶
Bases:
object
Schema for server vendor information.
- Attr str name:
Vendor name.
- Attr str variant:
(optional) Vendor variant.
- Attr str version:
(optional) Vendor version.
- classmethod from_dict(_dict: Dict) ServerVendor ¶
Initialize a ServerVendor object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.SessionAuthentication(authentication_handlers: List[str], *, authenticated: str = None, authentication_db: str = None)¶
Bases:
object
Schema for session authentication information.
- Attr str authenticated:
(optional) authenticated.
- Attr str authentication_db:
(optional) authentication_db.
- Attr List[str] authentication_handlers:
authentication_handlers.
- classmethod from_dict(_dict: Dict) SessionAuthentication ¶
Initialize a SessionAuthentication object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.SessionInformation(ok: bool, info: SessionAuthentication, user_ctx: UserContext)¶
Bases:
object
Schema for information about a session.
- Attr bool ok:
ok.
- Attr SessionAuthentication info:
Schema for session authentication information.
- Attr UserContext user_ctx:
Schema for the user context of a session.
- classmethod from_dict(_dict: Dict) SessionInformation ¶
Initialize a SessionInformation object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.ShardsInformation(shards: dict)¶
Bases:
object
Schema for a shards object that maps the hash value range for each shard to the array of nodes that contain a copy of that shard.
- Attr dict shards:
Mapping of shard hash value range to a list of nodes.
- classmethod from_dict(_dict: Dict) ShardsInformation ¶
Initialize a ShardsInformation object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.ThroughputInformation(blocks: int, query: int, read: int, write: int)¶
Bases:
object
Schema for detailed information about throughput capacity with breakdown by specific throughput requests classes.
- Attr int blocks:
A number of blocks of throughput units. A block consists of 100 reads/sec, 50 writes/sec, and 5 global queries/sec of provisioned throughput capacity.
- Attr int query:
Provisioned global queries capacity in operations per second.
- Attr int read:
Provisioned reads capacity in operations per second.
- Attr int write:
Provisioned writes capacity in operations per second.
- classmethod from_dict(_dict: Dict) ThroughputInformation ¶
Initialize a ThroughputInformation object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.UpInformation(seeds: dict, status: str)¶
Bases:
object
Schema for information about the up state of the server.
- Attr dict seeds:
seeds.
- Attr str status:
status.
- class StatusEnum(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
str
,Enum
status.
- MAINTENANCE_MODE = 'maintenance_mode'¶
- NOLB = 'nolb'¶
- OK = 'ok'¶
- classmethod from_dict(_dict: Dict) UpInformation ¶
Initialize a UpInformation object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.UpdatesPending(minimum: int, preferred: int, total: int)¶
Bases:
object
Schema for an ability to tell if view is up-to-date without querying it.
- Attr int minimum:
Sum of shard copies with the least amount of work to do.
- Attr int preferred:
Sum of unique shards. This value is zero when at least one copy of every shard range is up-to-date and the view is able to answer a query without index building delays.
- Attr int total:
Sum of all shard copies.
- classmethod from_dict(_dict: Dict) UpdatesPending ¶
Initialize a UpdatesPending object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.UserContext(name: str, roles: List[str], *, db: str = None)¶
Bases:
object
Schema for the user context of a session.
- Attr str db:
(optional) Database name in the context of the provided operation.
- Attr str name:
User name.
- Attr List[str] roles:
List of user roles.
- class RolesEnum(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
str
,Enum
Schema for a security role.
- ADMIN = '_admin'¶
- DB_UPDATES = '_db_updates'¶
- DESIGN = '_design'¶
- READER = '_reader'¶
- REPLICATOR = '_replicator'¶
- SECURITY = '_security'¶
- SHARDS = '_shards'¶
- WRITER = '_writer'¶
- classmethod from_dict(_dict: Dict) UserContext ¶
Initialize a UserContext object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.UuidsResult(uuids: List[str])¶
Bases:
object
Schema for a set of uuids generated by the server.
- Attr List[str] uuids:
uuids.
- classmethod from_dict(_dict: Dict) UuidsResult ¶
Initialize a UuidsResult object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.ViewQueriesResult(results: List[ViewResult])¶
Bases:
object
Schema for the results of a queries view operation.
- Attr List[ViewResult] results:
An array of result objects - one for each query. Each result object contains the same fields as the response to a regular view request.
- classmethod from_dict(_dict: Dict) ViewQueriesResult ¶
Initialize a ViewQueriesResult object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.ViewQuery(*, att_encoding_info: bool = None, attachments: bool = None, conflicts: bool = None, descending: bool = None, include_docs: bool = None, inclusive_end: bool = None, limit: int = None, skip: int = None, update_seq: bool = None, end_key: object = None, end_key_doc_id: str = None, group: bool = None, group_level: int = None, key: object = None, keys: List[object] = None, reduce: bool = None, stable: bool = None, start_key: object = None, start_key_doc_id: str = None, update: str = None)¶
Bases:
object
Schema for a query view operation.
- Attr bool att_encoding_info:
(optional) Parameter to specify whether to include the encoding information in attachment stubs if the particular attachment is compressed.
- Attr bool attachments:
(optional) Parameter to specify whether to include attachments bodies in a response.
- Attr bool conflicts:
(optional) Parameter to specify whether to include a list of conflicted revisions in each returned document. Active only when include_docs is true.
- Attr bool descending:
(optional) Parameter to specify whether to return the documents in descending by key order.
- Attr bool include_docs:
(optional) Parameter to specify whether to include the full content of the documents in the response.
- Attr bool inclusive_end:
(optional) Parameter to specify whether the specified end key should be included in the result.
- Attr int limit:
(optional) Parameter to specify the number of returned documents to limit the result to.
- Attr int skip:
(optional) Parameter to specify the number of records before starting to return the results.
- Attr bool update_seq:
(optional) Parameter to specify whether to include in the response an update_seq value indicating the sequence id of the database the view reflects.
- Attr object end_key:
(optional) Schema for any JSON type.
- Attr str end_key_doc_id:
(optional) Schema for a document ID.
- Attr bool group:
(optional) Parameter to specify whether to group reduced results by key. Valid only if a reduce function defined in the view. If the view emits key in JSON array format, then it is possible to reduce groups further based on the number of array elements with the group_level parameter.
- Attr int group_level:
(optional) Parameter to specify a group level to be used. Only applicable if the view uses keys that are JSON arrays. Implies group is true. Group level groups the reduced results by the specified number of array elements. If unset, results are grouped by the entire array key, returning a reduced value for each complete key.
- Attr object key:
(optional) Schema for any JSON type.
- Attr List[object] keys:
(optional) Parameter to specify returning only documents that match any of the specified keys. A JSON array of keys that match the key type emitted by the view function.
- Attr bool reduce:
(optional) Parameter to specify whether to use the reduce function in a map-reduce view. Default is true when a reduce function is defined.
- Attr bool stable:
(optional) Query parameter to specify whether use the same replica of the index on each request. The default value false contacts all replicas and returns the result from the first, fastest, responder. Setting it to true when used in conjunction with update=false may improve consistency at the expense of increased latency and decreased throughput if the selected replica is not the fastest of the available replicas. Note: In general setting true is discouraged and is strictly not recommended when using update=true.
- Attr object start_key:
(optional) Schema for any JSON type.
- Attr str start_key_doc_id:
(optional) Schema for a document ID.
- Attr str update:
(optional) Parameter to specify whether or not the view in question should be updated prior to responding to the user. * true - Return results after the view is updated. * false - Return results without updating the view. * lazy - Return the view results without waiting for an update, but update them immediately after the request.
- class UpdateEnum(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)¶
Bases:
str
,Enum
Parameter to specify whether or not the view in question should be updated prior to responding to the user. * true - Return results after the view is updated. * false - Return results without updating the view. * lazy - Return the view results without waiting for an update, but update them immediately after the request.
- FALSE = 'false'¶
- LAZY = 'lazy'¶
- TRUE = 'true'¶
- classmethod from_dict(_dict: Dict) ViewQuery ¶
Initialize a ViewQuery object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.ViewResult(rows: List[ViewResultRow], *, total_rows: int = None, update_seq: str = None)¶
Bases:
object
Schema for the result of a query view operation.
- Attr int total_rows:
(optional) Number of total rows.
- Attr str update_seq:
(optional) Current update sequence for the database.
- Attr List[ViewResultRow] rows:
rows.
- classmethod from_dict(_dict: Dict) ViewResult ¶
Initialize a ViewResult object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
- class ibmcloudant.cloudant_v1.ViewResultRow(key: object, value: object, *, caused_by: str = None, error: str = None, reason: str = None, doc: Document = None, id: str = None)¶
Bases:
object
Schema for a row of a view result.
- Attr str caused_by:
(optional) The cause of the error (if available).
- Attr str error:
(optional) The name of the error.
- Attr str reason:
(optional) The reason the error occurred (if available).
- Attr Document doc:
(optional) Schema for a document.
- Attr str id:
(optional) Schema for a document ID.
- Attr object key:
Schema for any JSON type.
- Attr object value:
Schema for any JSON type.
- classmethod from_dict(_dict: Dict) ViewResultRow ¶
Initialize a ViewResultRow object from a json dictionary.
- to_dict() Dict ¶
Return a json dictionary representing this model.
ibmcloudant.couchdb_session_authenticator module¶
Module for handling session authentication
- class ibmcloudant.couchdb_session_authenticator.CouchDbSessionAuthenticator(username: str, password: str, disable_ssl_verification: bool = False)¶
Bases:
Authenticator
The CouchDbSessionAuthenticator utilizes a server url and a username and password pair to obtain a session token, and adds it to requests.
- Args:
username: The CouchDB username password: The CouchDB password
Attributes: token_manager (ibmcloudantsdk.couchdb_session_token_manager.CouchDbSessionTokenManager): Retrieves and manages CouchDB session tokens.
- Raises:
ValueError: The supplied username, and/or password are not valid.
- authenticate(req: Request)¶
Adds session authentication information to the request.
The session token will be added as an update to the BaseService cookie jar.
- Args:
req: Ignored. BaseService uses the cookie jar for every request
- authentication_type() str ¶
Returns this authenticator’s type (‘COUCHDB_SESSION’).
- set_jar(jar)¶
Sets the cookie jar for the authenticator. This is an internal method called by BaseService. Not to be called directly.
- validate()¶
Validates the username, and password for session token requests.
Ensure both the username and password are set.
- Raises:
ValueError: The supplied username, and/or password are not valid.
- AUTHTYPE_COUCHDB_SESSION = 'COUCHDB_SESSION'¶
ibmcloudant.couchdb_session_token_manager module¶
Module for managing session authentication token
- class ibmcloudant.couchdb_session_token_manager.CouchDbSessionTokenManager(username: str, password: str, url: str = None, disable_ssl_verification: bool = False)¶
Bases:
TokenManager
The SessionTokenManager takes a username and password and performs the necessary interactions with the CouchDB service to obtain and store a session token.
If the current stored session token has expired a new session token will be retrieved.
This class is used by CouchDbSessionAuthenticator and is internal.
- Attributes:
url (str): The CouchDB service URL for token requests. username (str): The CouchDB username to obtain the session token for password (str): The CouchDB password to obtain the session token for http_config (dict): A dictionary containing values that control the timeout, proxies, and etc of HTTP requests. headers (dict): A dictionary containing values that specify custom headers used for HTTP requests.
- Args:
username: The CouchDB username to obtain the session token for password: The CouchDB password to obtain the session token for
- request_token()¶
Request a CouchDB session token given an username and password.
- Returns:
A CookieJar of Cookies the server sent back.
- set_default_headers(headers)¶
- set_service_url(service_url)¶
Module contents¶
Python client library for the IBM Cloudant