id
stringlengths
7
77
text
stringlengths
0
3.4k
metadata
dict
astrapy.admin.DataAPIDatabaseAdmin.async_drop_keyspace
Drop (delete) a keyspace from the database. Async version of the method, for use in an asyncio context.
{ "kind": "function", "name": "async_drop_keyspace", "path": "astrapy.admin.DataAPIDatabaseAdmin.async_drop_keyspace", "parameters": [ { "name": "name", "type": "str", "description": "the keyspace to delete. If it does not exist in this database,\nan error is raised.", "default": nul...
astrapy.admin.DataAPIDatabaseAdmin.get_database
Create a Database instance out of this class for working with the data in it.
{ "kind": "function", "name": "get_database", "path": "astrapy.admin.DataAPIDatabaseAdmin.get_database", "parameters": [ { "name": "token", "type": "str | TokenProvider | None", "description": "if supplied, is passed to the Database instead of\nthe one set for this object. Useful if one wa...
astrapy.admin.DataAPIDatabaseAdmin.get_async_database
Create an AsyncDatabase instance for the database, to be used when doing data-level work (such as creating/managing collections). This method has identical behavior and signature as the sync counterpart `get_database`: please see that one for more details.
{ "kind": "function", "name": "get_async_database", "path": "astrapy.admin.DataAPIDatabaseAdmin.get_async_database", "parameters": [ { "name": "token", "type": "str | TokenProvider | None", "description": null, "default": "None", "value": null }, { "name": "keyspa...
astrapy.admin.DataAPIDatabaseAdmin.find_embedding_providers
Example (output abridged and indented for clarity): >>> admin_for_my_db.find_embedding_providers() FindEmbeddingProvidersResult(embedding_providers=..., openai, ...) >>> admin_for_my_db.find_embedding_providers().embedding_providers { 'openai': EmbeddingProvider( display_name='OpenAI...
{ "kind": "function", "name": "find_embedding_providers", "path": "astrapy.admin.DataAPIDatabaseAdmin.find_embedding_providers", "parameters": [ { "name": "max_time_ms", "type": "int | None", "description": "a timeout, in milliseconds, for the DevOps API request.", "default": "None",...
astrapy.admin.DataAPIDatabaseAdmin.async_find_embedding_providers
Example (output abridged and indented for clarity): >>> admin_for_my_db.find_embedding_providers() FindEmbeddingProvidersResult(embedding_providers=..., openai, ...) >>> admin_for_my_db.find_embedding_providers().embedding_providers { 'openai': EmbeddingProvider( display_name='OpenAI...
{ "kind": "function", "name": "async_find_embedding_providers", "path": "astrapy.admin.DataAPIDatabaseAdmin.async_find_embedding_providers", "parameters": [ { "name": "max_time_ms", "type": "int | None", "description": "a timeout, in milliseconds, for the DevOps API request.", "defau...
astrapy.transform_payload
{ "kind": "module", "name": "transform_payload", "path": "astrapy.transform_payload", "parameters": null, "returns": null, "gathered_types": null, "value": null, "yields": null, "imports": { "annotations": "__future__.annotations", "logging": null, "Any": "typing.Any", "cast": "typing....
astrapy.transform_payload.convert_vector_to_floats
Convert a vector of strings to a vector of floats.
{ "kind": "function", "name": "convert_vector_to_floats", "path": "astrapy.transform_payload.convert_vector_to_floats", "parameters": [ { "name": "vector", "type": "list", "description": "A vector of objects.", "default": null, "value": null } ], "returns": [ { ...
astrapy.transform_payload.is_list_of_floats
Safely determine if it's a list of floats. Assumption: if list, and first item is float, then all items are.
{ "kind": "function", "name": "is_list_of_floats", "path": "astrapy.transform_payload.is_list_of_floats", "parameters": [ { "name": "vector", "type": "Iterable[Any]", "description": null, "default": null, "value": null } ], "returns": [ { "name": null, "...
astrapy.transform_payload.convert_to_ejson_date_object
{ "kind": "function", "name": "convert_to_ejson_date_object", "path": "astrapy.transform_payload.convert_to_ejson_date_object", "parameters": [ { "name": "date_value", "type": "datetime.date | datetime.datetime", "description": null, "default": null, "value": null } ], ...
astrapy.transform_payload.convert_to_ejson_uuid_object
{ "kind": "function", "name": "convert_to_ejson_uuid_object", "path": "astrapy.transform_payload.convert_to_ejson_uuid_object", "parameters": [ { "name": "uuid_value", "type": "UUID", "description": null, "default": null, "value": null } ], "returns": [ { "nam...
astrapy.transform_payload.convert_to_ejson_objectid_object
{ "kind": "function", "name": "convert_to_ejson_objectid_object", "path": "astrapy.transform_payload.convert_to_ejson_objectid_object", "parameters": [ { "name": "objectid_value", "type": "ObjectId", "description": null, "default": null, "value": null } ], "returns": [ ...
astrapy.transform_payload.convert_ejson_date_object_to_datetime
{ "kind": "function", "name": "convert_ejson_date_object_to_datetime", "path": "astrapy.transform_payload.convert_ejson_date_object_to_datetime", "parameters": [ { "name": "date_object", "type": "dict[str, int]", "description": null, "default": null, "value": null } ], ...
astrapy.transform_payload.convert_ejson_uuid_object_to_uuid
{ "kind": "function", "name": "convert_ejson_uuid_object_to_uuid", "path": "astrapy.transform_payload.convert_ejson_uuid_object_to_uuid", "parameters": [ { "name": "uuid_object", "type": "dict[str, str]", "description": null, "default": null, "value": null } ], "returns...
astrapy.transform_payload.convert_ejson_objectid_object_to_objectid
{ "kind": "function", "name": "convert_ejson_objectid_object_to_objectid", "path": "astrapy.transform_payload.convert_ejson_objectid_object_to_objectid", "parameters": [ { "name": "objectid_object", "type": "dict[str, str]", "description": null, "default": null, "value": null ...
astrapy.transform_payload.normalize_payload_value
The path helps determining special treatments
{ "kind": "function", "name": "normalize_payload_value", "path": "astrapy.transform_payload.normalize_payload_value", "parameters": [ { "name": "path", "type": "list[str]", "description": null, "default": null, "value": null }, { "name": "value", "type": "An...
astrapy.transform_payload.normalize_for_api
Normalize a payload for API calls. This includes e.g. ensuring values for "$vector" key are made into plain lists of floats.
{ "kind": "function", "name": "normalize_for_api", "path": "astrapy.transform_payload.normalize_for_api", "parameters": [ { "name": "payload", "type": "Dict[str, Any]", "description": "A dict expressing a payload for an API call", "default": null, "value": null } ], "re...
astrapy.transform_payload.restore_response_value
The path helps determining special treatments
{ "kind": "function", "name": "restore_response_value", "path": "astrapy.transform_payload.restore_response_value", "parameters": [ { "name": "path", "type": "list[str]", "description": null, "default": null, "value": null }, { "name": "value", "type": "Any"...
astrapy.transform_payload.restore_from_api
Process a dictionary just returned from the API. This is the place where e.g. `{"$date": 123}` is converted back into a datetime object.
{ "kind": "function", "name": "restore_from_api", "path": "astrapy.transform_payload.restore_from_api", "parameters": [ { "name": "response", "type": "DocumentType", "description": null, "default": null, "value": null } ], "returns": [ { "name": null, "t...
astrapy.authentication
{ "kind": "module", "name": "authentication", "path": "astrapy.authentication", "parameters": null, "returns": null, "gathered_types": null, "value": null, "yields": null, "imports": { "annotations": "__future__.annotations", "logging": null, "Any": "typing.Any", "cast": null, "htt...
astrapy.authentication.coerce_token_provider
{ "kind": "function", "name": "coerce_token_provider", "path": "astrapy.authentication.coerce_token_provider", "parameters": [ { "name": "token", "type": "str | TokenProvider | None", "description": null, "default": null, "value": null } ], "returns": [ { "nam...
astrapy.authentication.coerce_embedding_headers_provider
{ "kind": "function", "name": "coerce_embedding_headers_provider", "path": "astrapy.authentication.coerce_embedding_headers_provider", "parameters": [ { "name": "embedding_api_key", "type": "str | EmbeddingHeadersProvider | None", "description": null, "default": null, "value": ...
astrapy.authentication.redact_secret
Return a shortened-if-necessary version of a 'secret' string (with ellipsis).
{ "kind": "function", "name": "redact_secret", "path": "astrapy.authentication.redact_secret", "parameters": [ { "name": "secret", "type": "str", "description": "a secret string to redact", "default": null, "value": null }, { "name": "max_length", "type": "i...
astrapy.authentication.TokenProvider
Abstract base class for a token provider. The relevant method in this interface is returning a string to use as token. The __str__ / __repr__ methods are NOT to be used as source of tokens: use get_token instead. Note that equality (__eq__) checks if the generated tokens match under all circumstances (e.g. a literal ...
{ "kind": "class", "name": "TokenProvider", "path": "astrapy.authentication.TokenProvider", "parameters": null, "returns": null, "gathered_types": [ "ABC" ], "value": null, "yields": null, "imports": null, "properties": null, "bases": [ "ABC" ], "exports": null, "example": null, ...
astrapy.authentication.TokenProvider.get_token
Produce a string for direct use as token in a subsequent API request, or None for no token.
{ "kind": "function", "name": "get_token", "path": "astrapy.authentication.TokenProvider.get_token", "parameters": null, "returns": [ { "name": null, "type": "str | None", "description": null } ], "gathered_types": null, "value": null, "yields": null, "imports": null, "pr...
astrapy.authentication.StaticTokenProvider
A "pass-through" provider that wraps a supplied literal token.
{ "kind": "class", "name": "StaticTokenProvider", "path": "astrapy.authentication.StaticTokenProvider", "parameters": [ { "name": "token", "type": "str | None", "description": "an access token for subsequent use in the client.", "default": null, "value": null } ], "retu...
astrapy.authentication.StaticTokenProvider.token
{ "kind": "attribute", "name": "token", "path": "astrapy.authentication.StaticTokenProvider.token", "parameters": null, "returns": null, "gathered_types": null, "value": "token = token", "yields": null, "imports": null, "properties": null, "bases": null, "exports": null, "example": null, "re...
astrapy.authentication.StaticTokenProvider.get_token
{ "kind": "function", "name": "get_token", "path": "astrapy.authentication.StaticTokenProvider.get_token", "parameters": null, "returns": [ { "name": null, "type": "str | None", "description": null } ], "gathered_types": null, "value": null, "yields": null, "imports": null,...
astrapy.authentication.UsernamePasswordTokenProvider
A token provider encoding username/password-based authentication, as used e.g. for DSE and HCD. These are base64-encoded and concatenated by colons, with a prepended suffix 'Cassandra', as required by this authentication scheme.
{ "kind": "class", "name": "UsernamePasswordTokenProvider", "path": "astrapy.authentication.UsernamePasswordTokenProvider", "parameters": [ { "name": "username", "type": "str", "description": "the username for accessing the database.", "default": null, "value": null }, ...
astrapy.authentication.UsernamePasswordTokenProvider.PREFIX
{ "kind": "attribute", "name": "PREFIX", "path": "astrapy.authentication.UsernamePasswordTokenProvider.PREFIX", "parameters": null, "returns": null, "gathered_types": null, "value": "PREFIX = 'Cassandra'", "yields": null, "imports": null, "properties": null, "bases": null, "exports": null, "ex...
astrapy.authentication.UsernamePasswordTokenProvider.username
{ "kind": "attribute", "name": "username", "path": "astrapy.authentication.UsernamePasswordTokenProvider.username", "parameters": null, "returns": null, "gathered_types": null, "value": "username = username", "yields": null, "imports": null, "properties": null, "bases": null, "exports": null, ...
astrapy.authentication.UsernamePasswordTokenProvider.password
{ "kind": "attribute", "name": "password", "path": "astrapy.authentication.UsernamePasswordTokenProvider.password", "parameters": null, "returns": null, "gathered_types": null, "value": "password = password", "yields": null, "imports": null, "properties": null, "bases": null, "exports": null, ...
astrapy.authentication.UsernamePasswordTokenProvider.token
{ "kind": "attribute", "name": "token", "path": "astrapy.authentication.UsernamePasswordTokenProvider.token", "parameters": null, "returns": null, "gathered_types": [ "_b64", "PREFIX" ], "value": "token = f'{self.PREFIX}:{self._b64(self.username)}:{self._b64(self.password)}'", "yields": null, ...
astrapy.authentication.UsernamePasswordTokenProvider.get_token
{ "kind": "function", "name": "get_token", "path": "astrapy.authentication.UsernamePasswordTokenProvider.get_token", "parameters": null, "returns": [ { "name": null, "type": "str", "description": null } ], "gathered_types": null, "value": null, "yields": null, "imports": nu...
astrapy.authentication.EmbeddingHeadersProvider
Abstract base class for a provider of embedding-related headers (such as API Keys). The relevant method in this interface is returning a dict to use as (part of the) headers in Data API requests for a collection. This class captures the fact that, depending on the embedding provider for the collection, there may be ze...
{ "kind": "class", "name": "EmbeddingHeadersProvider", "path": "astrapy.authentication.EmbeddingHeadersProvider", "parameters": null, "returns": null, "gathered_types": [ "ABC" ], "value": null, "yields": null, "imports": null, "properties": null, "bases": [ "ABC" ], "exports": null,...
astrapy.authentication.EmbeddingHeadersProvider.get_headers
Produce a dictionary for use as (part of) the headers in HTTP requests to the Data API.
{ "kind": "function", "name": "get_headers", "path": "astrapy.authentication.EmbeddingHeadersProvider.get_headers", "parameters": null, "returns": [ { "name": null, "type": "dict[str, str]", "description": null } ], "gathered_types": null, "value": null, "yields": null, "im...
astrapy.authentication.EmbeddingAPIKeyHeaderProvider
A "pass-through" header provider representing the single-header (typically "X-Embedding-Api-Key") auth scheme, in use by most of the embedding models in Vectorize.
{ "kind": "class", "name": "EmbeddingAPIKeyHeaderProvider", "path": "astrapy.authentication.EmbeddingAPIKeyHeaderProvider", "parameters": [ { "name": "embedding_api_key", "type": "str | None", "description": "a string that will be the value for the header.\nIf None is passed, this results ...
astrapy.authentication.EmbeddingAPIKeyHeaderProvider.embedding_api_key
{ "kind": "attribute", "name": "embedding_api_key", "path": "astrapy.authentication.EmbeddingAPIKeyHeaderProvider.embedding_api_key", "parameters": null, "returns": null, "gathered_types": null, "value": "embedding_api_key = embedding_api_key", "yields": null, "imports": null, "properties": null, ...
astrapy.authentication.EmbeddingAPIKeyHeaderProvider.get_headers
{ "kind": "function", "name": "get_headers", "path": "astrapy.authentication.EmbeddingAPIKeyHeaderProvider.get_headers", "parameters": null, "returns": [ { "name": null, "type": "dict[str, str]", "description": null } ], "gathered_types": null, "value": null, "yields": null, ...
astrapy.authentication.AWSEmbeddingHeadersProvider
A header provider representing the two-header auth scheme in use by the Amazon Web Services (e.g. AWS Bedrock) when using header-based authentication.
{ "kind": "class", "name": "AWSEmbeddingHeadersProvider", "path": "astrapy.authentication.AWSEmbeddingHeadersProvider", "parameters": [ { "name": "embedding_access_id", "type": "str", "description": "value of the \"Access ID\" secret. This will become\nthe value for the corresponding heade...
astrapy.authentication.AWSEmbeddingHeadersProvider.embedding_access_id
{ "kind": "attribute", "name": "embedding_access_id", "path": "astrapy.authentication.AWSEmbeddingHeadersProvider.embedding_access_id", "parameters": null, "returns": null, "gathered_types": null, "value": "embedding_access_id = embedding_access_id", "yields": null, "imports": null, "properties": nu...
astrapy.authentication.AWSEmbeddingHeadersProvider.embedding_secret_id
{ "kind": "attribute", "name": "embedding_secret_id", "path": "astrapy.authentication.AWSEmbeddingHeadersProvider.embedding_secret_id", "parameters": null, "returns": null, "gathered_types": null, "value": "embedding_secret_id = embedding_secret_id", "yields": null, "imports": null, "properties": nu...
astrapy.authentication.AWSEmbeddingHeadersProvider.get_headers
{ "kind": "function", "name": "get_headers", "path": "astrapy.authentication.AWSEmbeddingHeadersProvider.get_headers", "parameters": null, "returns": [ { "name": null, "type": "dict[str, str]", "description": null } ], "gathered_types": null, "value": null, "yields": null, ...
astrapy.collection
{ "kind": "module", "name": "collection", "path": "astrapy.collection", "parameters": null, "returns": null, "gathered_types": null, "value": null, "yields": null, "imports": { "annotations": "__future__.annotations", "logging": "logging", "Any": "typing.Any", "cast": null, "httpx"...
astrapy.collection.logger
{ "kind": "attribute", "name": "logger", "path": "astrapy.collection.logger", "parameters": null, "returns": null, "gathered_types": [ "__name__" ], "value": "logger = logging.getLogger(__name__)", "yields": null, "imports": null, "properties": null, "bases": null, "exports": null, "exam...
astrapy.collection.Collection
A Data API collection, the main object to interact with the Data API, especially for DDL operations. This class has a synchronous interface. A Collection is spawned from a Database object, from which it inherits the details on how to reach the API server (endpoint, authentication token).
{ "kind": "class", "name": "Collection", "path": "astrapy.collection.Collection", "parameters": [ { "name": "database", "type": "Database", "description": "a Database object, instantiated earlier. This represents\nthe database the collection belongs to.", "default": null, "valu...
astrapy.collection.Collection.api_options
{ "kind": "attribute", "name": "api_options", "path": "astrapy.collection.Collection.api_options", "parameters": null, "returns": null, "gathered_types": [ "astrapy.api_options.CollectionAPIOptions" ], "value": "api_options = CollectionAPIOptions()", "yields": null, "imports": null, "propertie...
astrapy.collection.Collection.callers
{ "kind": "attribute", "name": "callers", "path": "astrapy.collection.Collection.callers", "parameters": null, "returns": null, "gathered_types": null, "value": "callers = callers_param", "yields": null, "imports": null, "properties": null, "bases": null, "exports": null, "example": null, "r...
astrapy.collection.Collection.with_options
Create a clone of this collection with some changed attributes.
{ "kind": "function", "name": "with_options", "path": "astrapy.collection.Collection.with_options", "parameters": [ { "name": "name", "type": "str | None", "description": "the name of the collection. This parameter is useful to\nquickly spawn Collection instances each pointing to a differe...
astrapy.collection.Collection.to_async
Create an AsyncCollection from this one. Save for the arguments explicitly provided as overrides, everything else is kept identical to this collection in the copy (the database is converted into an async object).
{ "kind": "function", "name": "to_async", "path": "astrapy.collection.Collection.to_async", "parameters": [ { "name": "database", "type": "AsyncDatabase | None", "description": "an AsyncDatabase object, instantiated earlier.\nThis represents the database the new collection belongs to.", ...
astrapy.collection.Collection.set_caller
Set a new identity for the application/framework on behalf of which the Data API calls are performed (the "caller").
{ "kind": "function", "name": "set_caller", "path": "astrapy.collection.Collection.set_caller", "parameters": [ { "name": "caller_name", "type": "str | None", "description": "name of the application, or framework, on behalf of which\nthe Data API calls are performed. This ends up in the re...
astrapy.collection.Collection.options
Get the collection options, i.e. its configuration as read from the database. The method issues a request to the Data API each time is invoked, without caching mechanisms: this ensures up-to-date information for usages such as real-time collection validation by the application.
{ "kind": "function", "name": "options", "path": "astrapy.collection.Collection.options", "parameters": [ { "name": "max_time_ms", "type": "int | None", "description": "a timeout, in milliseconds, for the underlying HTTP request.\nIf not passed, the collection-level setting is used instead...
astrapy.collection.Collection.info
Information on the collection (name, location, database), in the form of a CollectionInfo object. Not to be confused with the collection `options` method (related to the collection internal configuration).
{ "kind": "function", "name": "info", "path": "astrapy.collection.Collection.info", "parameters": null, "returns": [ { "name": null, "type": "CollectionInfo", "description": null } ], "gathered_types": [ "astrapy.info.CollectionInfo" ], "value": null, "yields": null, ...
astrapy.collection.Collection.database
a Database object, the database this collection belongs to.
{ "kind": "attribute", "name": "database", "path": "astrapy.collection.Collection.database", "parameters": null, "returns": null, "gathered_types": [ "astrapy.database.Database" ], "value": "database: Database", "yields": null, "imports": null, "properties": null, "bases": null, "exports":...
astrapy.collection.Collection.namespace
The namespace this collection is in. *DEPRECATED* (removal in 2.0). Switch to the "keyspace" property.**
{ "kind": "attribute", "name": "namespace", "path": "astrapy.collection.Collection.namespace", "parameters": null, "returns": null, "gathered_types": null, "value": "namespace: str", "yields": null, "imports": null, "properties": null, "bases": null, "exports": null, "example": ">>> my_coll.na...
astrapy.collection.Collection.keyspace
The keyspace this collection is in.
{ "kind": "attribute", "name": "keyspace", "path": "astrapy.collection.Collection.keyspace", "parameters": null, "returns": null, "gathered_types": null, "value": "keyspace: str", "yields": null, "imports": null, "properties": null, "bases": null, "exports": null, "example": ">>> my_coll.keysp...
astrapy.collection.Collection.name
The name of this collection.
{ "kind": "attribute", "name": "name", "path": "astrapy.collection.Collection.name", "parameters": null, "returns": null, "gathered_types": null, "value": "name: str", "yields": null, "imports": null, "properties": null, "bases": null, "exports": null, "example": ">>> my_coll.name\n'my_v_colle...
astrapy.collection.Collection.full_name
The fully-qualified collection name within the database, in the form "keyspace.collection_name".
{ "kind": "attribute", "name": "full_name", "path": "astrapy.collection.Collection.full_name", "parameters": null, "returns": null, "gathered_types": null, "value": "full_name: str", "yields": null, "imports": null, "properties": null, "bases": null, "exports": null, "example": ">>> my_coll.fu...
astrapy.collection.Collection.insert_one
Insert a single document in the collection in an atomic operation.
{ "kind": "function", "name": "insert_one", "path": "astrapy.collection.Collection.insert_one", "parameters": [ { "name": "document", "type": "DocumentType", "description": "the dictionary expressing the document to insert.\nThe `_id` field of the document can be left out, in which\ncase i...
astrapy.collection.Collection.insert_many
Insert a list of documents into the collection. This is not an atomic operation.
{ "kind": "function", "name": "insert_many", "path": "astrapy.collection.Collection.insert_many", "parameters": [ { "name": "documents", "type": "Iterable[DocumentType]", "description": "an iterable of dictionaries, each a document to insert.\nDocuments may specify their `_id` field or lea...
astrapy.collection.Collection.find
Find documents on the collection, matching a certain provided filter. The method returns a Cursor that can then be iterated over. Depending on the method call pattern, the iteration over all documents can reflect collection mutations occurred since the `find` method was called, or not. In cases where the cursor reflec...
{ "kind": "function", "name": "find", "path": "astrapy.collection.Collection.find", "parameters": [ { "name": "filter", "type": "FilterType | None", "description": "a predicate expressed as a dictionary according to the\nData API filter syntax. Examples are:\n {}\n {\"name\": \"John\...
astrapy.collection.Collection.find_one
Run a search, returning the first document in the collection that matches provided filters, if any is found.
{ "kind": "function", "name": "find_one", "path": "astrapy.collection.Collection.find_one", "parameters": [ { "name": "filter", "type": "FilterType | None", "description": "a predicate expressed as a dictionary according to the\nData API filter syntax. Examples are:\n {}\n {\"name\":...
astrapy.collection.Collection.distinct
Return a list of the unique values of `key` across the documents in the collection that match the provided filter.
{ "kind": "function", "name": "distinct", "path": "astrapy.collection.Collection.distinct", "parameters": [ { "name": "key", "type": "str", "description": "the name of the field whose value is inspected across documents.\nKeys can use dot-notation to descend to deeper document levels.\nExa...
astrapy.collection.Collection.count_documents
Count the documents in the collection matching the specified filter.
{ "kind": "function", "name": "count_documents", "path": "astrapy.collection.Collection.count_documents", "parameters": [ { "name": "filter", "type": "FilterType", "description": "a predicate expressed as a dictionary according to the\nData API filter syntax. Examples are:\n {}\n {\"...
astrapy.collection.Collection.estimated_document_count
Query the API server for an estimate of the document count in the collection. Contrary to `count_documents`, this method has no filtering parameters.
{ "kind": "function", "name": "estimated_document_count", "path": "astrapy.collection.Collection.estimated_document_count", "parameters": [ { "name": "max_time_ms", "type": "int | None", "description": "a timeout, in milliseconds, for the underlying HTTP request.\nIf not passed, the collec...
astrapy.collection.Collection.find_one_and_replace
Find a document on the collection and replace it entirely with a new one, optionally inserting a new one if no match is found.
{ "kind": "function", "name": "find_one_and_replace", "path": "astrapy.collection.Collection.find_one_and_replace", "parameters": [ { "name": "filter", "type": "FilterType", "description": "a predicate expressed as a dictionary according to the\nData API filter syntax. Examples are:\n {...
astrapy.collection.Collection.replace_one
Replace a single document on the collection with a new one, optionally inserting a new one if no match is found.
{ "kind": "function", "name": "replace_one", "path": "astrapy.collection.Collection.replace_one", "parameters": [ { "name": "filter", "type": "FilterType", "description": "a predicate expressed as a dictionary according to the\nData API filter syntax. Examples are:\n {}\n {\"name\": ...
astrapy.collection.Collection.find_one_and_update
Find a document on the collection and update it as requested, optionally inserting a new one if no match is found.
{ "kind": "function", "name": "find_one_and_update", "path": "astrapy.collection.Collection.find_one_and_update", "parameters": [ { "name": "filter", "type": "FilterType", "description": "a predicate expressed as a dictionary according to the\nData API filter syntax. Examples are:\n {}\...
astrapy.collection.Collection.update_one
Update a single document on the collection as requested, optionally inserting a new one if no match is found.
{ "kind": "function", "name": "update_one", "path": "astrapy.collection.Collection.update_one", "parameters": [ { "name": "filter", "type": "FilterType", "description": "a predicate expressed as a dictionary according to the\nData API filter syntax. Examples are:\n {}\n {\"name\": \"...
astrapy.collection.Collection.update_many
Apply an update operations to all documents matching a condition, optionally inserting one documents in absence of matches.
{ "kind": "function", "name": "update_many", "path": "astrapy.collection.Collection.update_many", "parameters": [ { "name": "filter", "type": "FilterType", "description": "a predicate expressed as a dictionary according to the\nData API filter syntax. Examples are:\n {}\n {\"name\": ...
astrapy.collection.Collection.find_one_and_delete
Find a document in the collection and delete it. The deleted document, however, is the return value of the method.
{ "kind": "function", "name": "find_one_and_delete", "path": "astrapy.collection.Collection.find_one_and_delete", "parameters": [ { "name": "filter", "type": "FilterType", "description": "a predicate expressed as a dictionary according to the\nData API filter syntax. Examples are:\n {}\...
astrapy.collection.Collection.delete_one
Delete one document matching a provided filter. This method never deletes more than a single document, regardless of the number of matches to the provided filters.
{ "kind": "function", "name": "delete_one", "path": "astrapy.collection.Collection.delete_one", "parameters": [ { "name": "filter", "type": "FilterType", "description": "a predicate expressed as a dictionary according to the\nData API filter syntax. Examples are:\n {}\n {\"name\": \"...
astrapy.collection.Collection.delete_many
Delete all documents matching a provided filter.
{ "kind": "function", "name": "delete_many", "path": "astrapy.collection.Collection.delete_many", "parameters": [ { "name": "filter", "type": "FilterType", "description": "a predicate expressed as a dictionary according to the\nData API filter syntax. Examples are:\n {}\n {\"name\": ...
astrapy.collection.Collection.delete_all
Delete all documents in a collection.
{ "kind": "function", "name": "delete_all", "path": "astrapy.collection.Collection.delete_all", "parameters": [ { "name": "max_time_ms", "type": "int | None", "description": "a timeout, in milliseconds, for the underlying HTTP request.\nIf not passed, the collection-level setting is used i...
astrapy.collection.Collection.bulk_write
Execute an arbitrary amount of operations such as inserts, updates, deletes either sequentially or concurrently. This method does not execute atomically, i.e. individual operations are each performed in the same way as the corresponding collection method, and each one is a different and unrelated database mutation.
{ "kind": "function", "name": "bulk_write", "path": "astrapy.collection.Collection.bulk_write", "parameters": [ { "name": "requests", "type": "Iterable[BaseOperation]", "description": "an iterable over concrete subclasses of `BaseOperation`,\nsuch as `InsertMany` or `ReplaceOne`. Each such...
astrapy.collection.Collection.drop
Drop the collection, i.e. delete it from the database along with all the documents it contains.
{ "kind": "function", "name": "drop", "path": "astrapy.collection.Collection.drop", "parameters": [ { "name": "max_time_ms", "type": "int | None", "description": "a timeout, in milliseconds, for the underlying HTTP request.\nIf not passed, the collection-level setting is used instead.\nRem...
astrapy.collection.Collection.command
Send a POST request to the Data API for this collection with an arbitrary, caller-provided payload.
{ "kind": "function", "name": "command", "path": "astrapy.collection.Collection.command", "parameters": [ { "name": "body", "type": "dict[str, Any]", "description": "a JSON-serializable dictionary, the payload of the request.", "default": null, "value": null }, { ...
astrapy.collection.AsyncCollection
A Data API collection, the main object to interact with the Data API, especially for DDL operations. This class has an asynchronous interface for use with asyncio. An AsyncCollection is spawned from a Database object, from which it inherits the details on how to reach the API server (endpoint, authentication token).
{ "kind": "class", "name": "AsyncCollection", "path": "astrapy.collection.AsyncCollection", "parameters": [ { "name": "database", "type": "AsyncDatabase", "description": "a Database object, instantiated earlier. This represents\nthe database the collection belongs to.", "default": nu...
astrapy.collection.AsyncCollection.api_options
{ "kind": "attribute", "name": "api_options", "path": "astrapy.collection.AsyncCollection.api_options", "parameters": null, "returns": null, "gathered_types": [ "astrapy.api_options.CollectionAPIOptions" ], "value": "api_options = CollectionAPIOptions()", "yields": null, "imports": null, "prop...
astrapy.collection.AsyncCollection.callers
{ "kind": "attribute", "name": "callers", "path": "astrapy.collection.AsyncCollection.callers", "parameters": null, "returns": null, "gathered_types": null, "value": "callers = callers_param", "yields": null, "imports": null, "properties": null, "bases": null, "exports": null, "example": null,...
astrapy.collection.AsyncCollection.with_options
Create a clone of this collection with some changed attributes.
{ "kind": "function", "name": "with_options", "path": "astrapy.collection.AsyncCollection.with_options", "parameters": [ { "name": "name", "type": "str | None", "description": "the name of the collection. This parameter is useful to\nquickly spawn AsyncCollection instances each pointing to...
astrapy.collection.AsyncCollection.to_sync
Create a Collection from this one. Save for the arguments explicitly provided as overrides, everything else is kept identical to this collection in the copy (the database is converted into a sync object).
{ "kind": "function", "name": "to_sync", "path": "astrapy.collection.AsyncCollection.to_sync", "parameters": [ { "name": "database", "type": "Database | None", "description": "a Database object, instantiated earlier.\nThis represents the database the new collection belongs to.", "def...
astrapy.collection.AsyncCollection.set_caller
Set a new identity for the application/framework on behalf of which the Data API calls are performed (the "caller").
{ "kind": "function", "name": "set_caller", "path": "astrapy.collection.AsyncCollection.set_caller", "parameters": [ { "name": "caller_name", "type": "str | None", "description": "name of the application, or framework, on behalf of which\nthe Data API calls are performed. This ends up in t...
astrapy.collection.AsyncCollection.options
Get the collection options, i.e. its configuration as read from the database. The method issues a request to the Data API each time is invoked, without caching mechanisms: this ensures up-to-date information for usages such as real-time collection validation by the application.
{ "kind": "function", "name": "options", "path": "astrapy.collection.AsyncCollection.options", "parameters": [ { "name": "max_time_ms", "type": "int | None", "description": "a timeout, in milliseconds, for the underlying HTTP request.\nIf not passed, the collection-level setting is used in...
astrapy.collection.AsyncCollection.info
Information on the collection (name, location, database), in the form of a CollectionInfo object. Not to be confused with the collection `options` method (related to the collection internal configuration).
{ "kind": "function", "name": "info", "path": "astrapy.collection.AsyncCollection.info", "parameters": null, "returns": [ { "name": null, "type": "CollectionInfo", "description": null } ], "gathered_types": [ "astrapy.info.CollectionInfo" ], "value": null, "yields": nul...
astrapy.collection.AsyncCollection.database
a Database object, the database this collection belongs to.
{ "kind": "attribute", "name": "database", "path": "astrapy.collection.AsyncCollection.database", "parameters": null, "returns": null, "gathered_types": [ "astrapy.database.AsyncDatabase" ], "value": "database: AsyncDatabase", "yields": null, "imports": null, "properties": null, "bases": nul...
astrapy.collection.AsyncCollection.namespace
The namespace this collection is in. *DEPRECATED* (removal in 2.0). Switch to the "keyspace" property.**
{ "kind": "attribute", "name": "namespace", "path": "astrapy.collection.AsyncCollection.namespace", "parameters": null, "returns": null, "gathered_types": null, "value": "namespace: str", "yields": null, "imports": null, "properties": null, "bases": null, "exports": null, "example": ">>> my_as...
astrapy.collection.AsyncCollection.keyspace
The keyspace this collection is in.
{ "kind": "attribute", "name": "keyspace", "path": "astrapy.collection.AsyncCollection.keyspace", "parameters": null, "returns": null, "gathered_types": null, "value": "keyspace: str", "yields": null, "imports": null, "properties": null, "bases": null, "exports": null, "example": ">>> my_coll....
astrapy.collection.AsyncCollection.name
The name of this collection.
{ "kind": "attribute", "name": "name", "path": "astrapy.collection.AsyncCollection.name", "parameters": null, "returns": null, "gathered_types": null, "value": "name: str", "yields": null, "imports": null, "properties": null, "bases": null, "exports": null, "example": ">>> my_async_coll.name\n...
astrapy.collection.AsyncCollection.full_name
The fully-qualified collection name within the database, in the form "keyspace.collection_name".
{ "kind": "attribute", "name": "full_name", "path": "astrapy.collection.AsyncCollection.full_name", "parameters": null, "returns": null, "gathered_types": null, "value": "full_name: str", "yields": null, "imports": null, "properties": null, "bases": null, "exports": null, "example": ">>> my_as...
astrapy.collection.AsyncCollection.insert_one
Insert a single document in the collection in an atomic operation.
{ "kind": "function", "name": "insert_one", "path": "astrapy.collection.AsyncCollection.insert_one", "parameters": [ { "name": "document", "type": "DocumentType", "description": "the dictionary expressing the document to insert.\nThe `_id` field of the document can be left out, in which\nc...
astrapy.collection.AsyncCollection.insert_many
Returns: an InsertManyResult object.
{ "kind": "function", "name": "insert_many", "path": "astrapy.collection.AsyncCollection.insert_many", "parameters": [ { "name": "documents", "type": "Iterable[DocumentType]", "description": "an iterable of dictionaries, each a document to insert.\nDocuments may specify their `_id` field o...
astrapy.collection.AsyncCollection.find
Find documents on the collection, matching a certain provided filter. The method returns a Cursor that can then be iterated over. Depending on the method call pattern, the iteration over all documents can reflect collection mutations occurred since the `find` method was called, or not. In cases where the cursor reflec...
{ "kind": "function", "name": "find", "path": "astrapy.collection.AsyncCollection.find", "parameters": [ { "name": "filter", "type": "FilterType | None", "description": "a predicate expressed as a dictionary according to the\nData API filter syntax. Examples are:\n {}\n {\"name\": \"...
astrapy.collection.AsyncCollection.find_one
Run a search, returning the first document in the collection that matches provided filters, if any is found.
{ "kind": "function", "name": "find_one", "path": "astrapy.collection.AsyncCollection.find_one", "parameters": [ { "name": "filter", "type": "FilterType | None", "description": "a predicate expressed as a dictionary according to the\nData API filter syntax. Examples are:\n {}\n {\"na...
astrapy.collection.AsyncCollection.distinct
Return a list of the unique values of `key` across the documents in the collection that match the provided filter.
{ "kind": "function", "name": "distinct", "path": "astrapy.collection.AsyncCollection.distinct", "parameters": [ { "name": "key", "type": "str", "description": "the name of the field whose value is inspected across documents.\nKeys can use dot-notation to descend to deeper document levels....
astrapy.collection.AsyncCollection.count_documents
Count the documents in the collection matching the specified filter.
{ "kind": "function", "name": "count_documents", "path": "astrapy.collection.AsyncCollection.count_documents", "parameters": [ { "name": "filter", "type": "FilterType", "description": "a predicate expressed as a dictionary according to the\nData API filter syntax. Examples are:\n {}\n ...
astrapy.collection.AsyncCollection.estimated_document_count
Query the API server for an estimate of the document count in the collection. Contrary to `count_documents`, this method has no filtering parameters.
{ "kind": "function", "name": "estimated_document_count", "path": "astrapy.collection.AsyncCollection.estimated_document_count", "parameters": [ { "name": "max_time_ms", "type": "int | None", "description": "a timeout, in milliseconds, for the underlying HTTP request.\nIf not passed, the c...
astrapy.collection.AsyncCollection.find_one_and_replace
Find a document on the collection and replace it entirely with a new one, optionally inserting a new one if no match is found. Args: filter: a predicate expressed as a dictionary according to the Data API filter syntax. Examples are: {} {"name": "John"} {"price": {"$lt"...
{ "kind": "function", "name": "find_one_and_replace", "path": "astrapy.collection.AsyncCollection.find_one_and_replace", "parameters": [ { "name": "filter", "type": "FilterType", "description": null, "default": null, "value": null }, { "name": "replacement", ...
astrapy.collection.AsyncCollection.replace_one
Replace a single document on the collection with a new one, optionally inserting a new one if no match is found.
{ "kind": "function", "name": "replace_one", "path": "astrapy.collection.AsyncCollection.replace_one", "parameters": [ { "name": "filter", "type": "FilterType", "description": "a predicate expressed as a dictionary according to the\nData API filter syntax. Examples are:\n {}\n {\"nam...
astrapy.collection.AsyncCollection.find_one_and_update
Find a document on the collection and update it as requested, optionally inserting a new one if no match is found.
{ "kind": "function", "name": "find_one_and_update", "path": "astrapy.collection.AsyncCollection.find_one_and_update", "parameters": [ { "name": "filter", "type": "FilterType", "description": "a predicate expressed as a dictionary according to the\nData API filter syntax. Examples are:\n ...
astrapy.collection.AsyncCollection.update_one
Update a single document on the collection as requested, optionally inserting a new one if no match is found.
{ "kind": "function", "name": "update_one", "path": "astrapy.collection.AsyncCollection.update_one", "parameters": [ { "name": "filter", "type": "FilterType", "description": "a predicate expressed as a dictionary according to the\nData API filter syntax. Examples are:\n {}\n {\"name\...