|
1 |
| -v 2.0.0 |
2 |
| -======= |
3 |
| -Support for arbitrary 'database' and 'admin' headers throughout the object chain |
4 |
| -Reworked the options system: |
| 1 | +v 2.0.0-preview |
| 2 | +=============== |
| 3 | +Introduction of full Tables support. |
| 4 | +Major revision of overall interface including Collection support. |
| 5 | + |
| 6 | +Introduced new astrapy-specific data types for full expressivity (see `serdes_options` below): |
| 7 | + - `DataAPIVector` data type |
| 8 | + - `DataAPIDate`, `DataAPITime`, `DataAPITimestamp`, `DataAPIDuration` |
| 9 | + - `DataAPISet`, `DataAPIMap` |
| 10 | + |
| 11 | +Typing support for Collections (optional): |
| 12 | + - `get_collection` and `create_collection` get a `document_type` parameter to go with the type hint `Collection[MyType]` |
| 13 | + - if unspecified fall back to `DefaultCollection = Collection[DefaultDocumentType]` (where `DefaultDocumentType = dict[str, Any]`) |
| 14 | + - cursors from `find` also allow strict typechecking |
| 15 | + |
| 16 | +Introduced a consistent API Options system: |
5 | 17 | - an APIOptions object inherited at each "spawn" operation, with overrides
|
6 | 18 | - environment-dependent defaults if nothing supplied
|
7 |
| - - "spawn" operations expose top-level aliases for selected settings |
8 |
| - - per-method overrides. For timeouts, `max_time_ms` becomes an alias for more specific timeout types |
9 |
| - - collection and database's `info` method gets timeout parameters |
10 |
| - - (not user-facing) classes in the hierarchy other than DataAPIClient have breaking changes in their constructor (now options-first and keyword-arg-only) |
11 |
| -Major restructuring of the codebase into directories |
12 |
| - - BaseCursor not exported by astrapy.cursors anymore |
13 |
| - - some imports (supposedly not used externally) changed slightly |
14 |
| - - adapted and limited scope of test_imports.py |
15 |
| -Removed AstraDBDatabaseAdmin's `from_api_endpoint` static method (reason: unused) |
16 |
| -Rename main branch from 'master' ==> `main` |
17 |
| -Cursors' state described by the `CursorState` enum |
18 |
| -Removal of several deprecated modules/features from previous versions: |
| 19 | + - `serdes_options` to control data types accepted for writes and to select data types for reads |
| 20 | + - `serdes_options`: Collections default to using custom types for lossless and full-range expression of database content |
| 21 | + - `serdes_options.binary_encode_vectors`, to control usage of binary-encoding for writing vectors. |
| 22 | + - e.g. instead of 'datetime.datetime', instances of `DataAPITimestamp` are returned |
| 23 | + - Exception: numbers are treated by default as ints and floats. To have them all Decimal, set serdes_option.use_decimals_in_collections to True. |
| 24 | + - Use the options' serdes_option to opt out and revert to non-custom data types |
| 25 | + - For datetimes, fine control over naive-datetime tolerance and timezone is introduced. Usage of naive datetime is now OPT-IN. |
| 26 | + - Support for arbitrary 'database' and 'admin' headers throughout the object chain |
| 27 | + - Fully reworked timeout options through all abstractions: |
| 28 | + - `TimeoutOptions` has six classes of timeouts, applying differently to various methods according to the kind of method. Timeouts can be overridden per-method-call |
| 29 | + - removal of the 'max_time_ms` parameter ==> still a quick migration path is to replace it with `timeout_ms` throughout |
| 30 | + - timeout of 0 means that timeout is disabled |
| 31 | + |
| 32 | +Reworked and enriched `FindCursor` interface: |
| 33 | + - Cursors are typed, similarly to Tables and Collections. The `find` method has an optional `document_type` parameter for typechecking. |
| 34 | + - Cursor classes renamed to `[Async]CollectionCursor` |
| 35 | + - Base class for all (find) cursors renamed to `FindCursor` |
| 36 | + - introduced `map` and `to_list` methods |
| 37 | + - `cursor.state` now has values in `FindCursorState` enum (take `cursor.state.value` for a string) |
| 38 | + - 'cursor.address' is removed from the API |
| 39 | + - `cursor.rewind()` returns None, mutates cursor in-place |
| 40 | + - removed 'cursor.distinct()': use the corresponding collection(/table) method. |
| 41 | + - removed cursor '.keyspace' property |
| 42 | + - removed 'retrieved' for cursors: use `consumed` |
| 43 | + - added many cursor management methods (see docstrings for details) |
| 44 | + |
| 45 | +Other changes to existing API: |
| 46 | + - `Database.create_collection`: signature change (now accepts a single "collection definition") |
| 47 | + - added parameter `definition` to method (a CollectionDefinition, plain dictionary or None) |
| 48 | + - (support for `source_model` vector index setting within the `definition` parameter) |
| 49 | + - removed 'dimension', 'metric', 'source_model', 'service', 'indexing', 'default_id_type' (all of them subsumed in `definition`) |
| 50 | + - removed parameters 'additional_options' and 'timeout_ms' as part of the broader timeout rework |
| 51 | + - renamed 'CollectionOptions' class to `CollectionDefinition` (return type of `Collection.options()`): |
| 52 | + - renamed its 'options' attribute into `definition` (although the API payload calls it "options") |
| 53 | + - removed its 'raw_options' attribute (redundant w.r.t `CollectionDescriptor.raw_descriptor`) |
| 54 | + - `CollectionDefinition`: implemented fluent interface to build collection definition objects |
| 55 | + - renamed `CollectionVectorServiceOptions` class to `VectorServiceOptions` |
| 56 | + - renamed `astrapy.constants.SortDocuments` to `SortMode` |
| 57 | + - renamed (collection-specific) "Result" classes like this: |
| 58 | + - 'DeleteResult' ==> `CollectionDeleteResult` |
| 59 | + - 'InsertOneResult' ==> `CollectionInsertOneResult` |
| 60 | + - 'InsertManyResult' ==> `CollectionInsertManyResult` |
| 61 | + - 'UpdateResult' ==> `CollectionUpdateResult` |
| 62 | + - signature change from `-> {"ok": 1}` to `-> None` for some admin and schema methods: |
| 63 | + - `AstraDBAdmin`: `drop_database` (+ async) |
| 64 | + - `AstraDBDatabaseAdmin`, `DataAPIDatabaseAdmin`: `create_keyspace`, `drop_keyspace`, `drop` (+ async) |
| 65 | + - `Database`, `AsyncDatabase`: `drop_collection`, `drop_table` |
| 66 | + - `Collection`, `AsyncCollection`: `drop` |
| 67 | + - renamed parameter 'collection_name' to `collection_or_table_name` and allow for `keyspace=None` in database `command()` method |
| 68 | + - [Async]Database `drop_collection` method now accepts a keyspace parameter. |
| 69 | + - `AsyncDatabase` methods `get_collection` and `get_table` are not async functions anymore (remove the await when calling them) |
| 70 | + - the following "info" methods are made async (= awaitable): `AsyncDatabase.info`, `AsyncDatabase.name`, `AsyncCollection.info`, `AsyncTable.info`, `AsyncDatabase.list_collections`, `AsyncDatabase.list_tables` |
| 71 | + - Database info structure: changed class name and reworked attributes of `AstraDBAdminDatabaseInfo` (formerly 'AdminDatabaseInfo') and `AstraDBDatabaseInfo` (formerly 'DatabaseInfo') |
| 72 | + - `[Async]Collection` and `[Async]Database`: `info` method now accepts the relevant timeout parameters |
| 73 | + - remove 'check_exists' from `[Async]Database.create_collection` method (the client does no checks now) |
| 74 | + - removed AstraDBDatabaseAdmin's `from_api_endpoint` static method (reason: unused) |
| 75 | + - remove 'database' parameter to the `to_sync()` and `to_async()` conversion methods for collections |
| 76 | + - `[Async]Database.drop_collection` method accepts only the string name of the target to drop (no collection objects anymore) |
| 77 | + - removed the 'CommandCursor'/'AsyncCommandCursor' classes: |
| 78 | + - `AstraDBAdmin`: `list_databases`, `async_list_databases` methods return regular lists |
| 79 | + - `[Async]Database`: `list_collections`, `list_tables` methods return regular lists |
| 80 | + - `[Async]Database`: added a `.region` property |
| 81 | + |
| 82 | +Exceptions hierarchy reworked: |
| 83 | + - removed 'CursorIsStartedException': now `CursorException` raised for all state-related illegal calls in cursors |
| 84 | + - removed 'CollectionNotFoundException', replaced by a ValueError in the few cases it's needed |
| 85 | + - removed `CollectionAlreadyExistsException` class (not used anymore without `check_exists`) |
| 86 | + - introduced `InvalidEnvironmentException` for operations invalid on some Data API environments. |
| 87 | + - renamed 'InsertManyException' ==> `CollectionInsertManyException` |
| 88 | + - renamed 'DeleteManyException' ==> `CollectionDeleteManyException` |
| 89 | + - renamed 'UpdateManyException' ==> `CollectionUpdateManyException` |
| 90 | + - renamed 'DevOpsAPIFaultyResponseException' ==> `UnexpectedDevOpsAPIResponseException` |
| 91 | + - renamed 'DataAPIFaultyResponseException' ==> `UnexpectedDataAPIResponseException` |
| 92 | + - (improved string representation of DataAPIResponseException cases with multiple error descriptors) |
| 93 | + |
| 94 | +Removal of deprecated modules, objects, patterns and parameters: |
19 | 95 | - 'core' (i.e. pre-1.0) library
|
20 | 96 | - 'collection.bulk_write' and the associated result and exception classes
|
21 | 97 | - 'vector=', 'vectorize=' and 'vectors=' parameters from collection methods
|
22 |
| - - 'retrieved' (=> `consumed`) and 'collection' (=> `data_source`) for cursors |
23 | 98 | - 'set_caller' method of `DataAPIClient`, `AstraDBAdmin`, `DataAPIDatabaseAdmin`, `AstraDBDatabaseAdmin`, `[Async]Database`, `[Async]Collection`
|
24 |
| - - 'caller_name' and 'caller_version' parameters where `callers` is now expected |
| 99 | + - 'caller_name' and 'caller_version' parameters. A single list-of-pairs `callers` is now expected |
25 | 100 | - 'id' and 'region' to DataAPIClient's 'get_database' (and async version). Use `api_endpoint` which is now the one positional parameter.
|
26 |
| - - 'region' parameter of AstraDBDatabaseAdmin.get[_async]_database (was ignored already in the method) |
27 |
| - - 'max_time_ms' parameter in AstraDBDatabaseAdmin's constructor and its `from_astra_db_admin` method (was already ignored in the body) |
28 |
| - - The 'max_time_ms' parameter in DataAPIClient's 'get_database' method. |
29 | 101 | - Accordingly, the syntax `client[api_endpoint]` also does not accept a database ID anymore.
|
| 102 | + - 'region' parameter of `AstraDBDatabaseAdmin.get[_async]_database` (was ignored already in the method) |
30 | 103 | - 'namespace' parameter of several methods of: DataAPIClient, admin objects, Database and Collection (use `keyspace`)
|
31 | 104 | - 'namespace' property of CollectionInfo, DatabaseInfo, CollectionNotFoundException, CollectionAlreadyExistsException (use `keyspace`)
|
32 |
| - - 'namespace' property of Databases and Collections (switch to `keyspace`) |
33 |
| - - 'update_db_namespace' parameter to for admin keyspace CRD methods (use `update_db_keyspace`) |
34 |
| - - 'use_namespace' for Databases (switch to `use_keyspace`) |
35 |
| - - 'delete_all' method of Collection and AsyncCollection (use `delete_many({})`) |
36 |
| -Removal of unused imports from toplevel __init__.py (ids, constants, cursors) |
| 105 | + - 'namespace' property of `Database` and `Collection` (switch to `keyspace`) |
| 106 | + - 'update_db_namespace' parameter for keyspace admin methods (use `update_db_keyspace`) |
| 107 | + - 'use_namespace' for `Databases` (switch to `use_keyspace`) |
| 108 | + - 'delete_all' method of `Collection` and `AsyncCollection` (use `delete_many({})`) |
| 109 | + |
| 110 | +API payloads are encoded with full Unicode (not encoded in ASCII anymore) for HTTP requests |
| 111 | + |
| 112 | +- Revision of all "spawning and copying" methods for abstractions. Parameters added/removed/renamed (switch to the corresponding parameters inside the APIOptions instead of the removed keyword parameters): |
| 113 | + - All the client/admin/database/table/collection classes have an `api_options` parameter in their `with_options/to_[a]sync` method |
| 114 | + - `DataAPIClient` |
| 115 | + - `_copy()`, `with_options()`: removed 'callers' |
| 116 | + - `get_..._database...()`: removed 'api_path', 'api_version' |
| 117 | + - `get_admin()`: removed 'dev_ops_url', 'dev_ops_api_version' |
| 118 | + - `AstraDBAdmin` |
| 119 | + - `(_copy)`: removed 'environment', 'dev_ops_url', 'dev_ops_api_version', 'callers' |
| 120 | + - `(with_options)`: removed 'callers' |
| 121 | + - `(create..._database)`: added `token`, `spawn_api_options` |
| 122 | + - `(get..._database)`: removed 'api_path', 'api_version', 'database_request_timeout_ms', 'database_timeout_ms'; renamed 'database_api_options' => `spawn_api_options` |
| 123 | + - `(get_database_admin)`: added `token`, `spawn_api_options` |
| 124 | + - `AstraDBDatabaseAdmin` |
| 125 | + - `_copy()`: removed 'api_endpoint', 'environment', 'dev_ops_url', 'dev_ops_api_version', 'api_path', 'api_version', 'callers' |
| 126 | + - `with_options()`: removed 'api_endpoint', 'callers' |
| 127 | + - `get..._database()`: removed 'api_path', 'api_version', 'database_request_timeout_ms', 'database_timeout_ms'; renamed 'database_api_options' => `spawn_api_options` |
| 128 | + - `DataAPIDatabaseAdmin` |
| 129 | + - `_copy()`: removed 'api_endpoint', 'environment', 'api_path', 'api_version', 'callers' |
| 130 | + - `with_options()`: removed 'api_endpoint', 'callers' |
| 131 | + - `get..._database()`: removed 'api_path', 'api_version', 'database_request_timeout_ms', 'database_timeout_ms'; renamed 'database_api_options' => `spawn_api_options` |
| 132 | + - `[Async]Database` |
| 133 | + - `_copy()`: removed 'api_endpoint', 'callers', 'environment', 'api_path', 'api_version' |
| 134 | + - `with_options()`: removed 'callers'; added `token` |
| 135 | + - `to_[a]sync()`: removed 'api_endpoint', 'callers', 'environment', 'api_path', 'api_version', |
| 136 | + - `get_collection()`: removed 'collection_request_timeout_ms', 'collection_timeout_ms'; renamed 'collection_api_options' => `spawn_api_options` |
| 137 | + - `get_table()`: removed 'table_request_timeout_ms', 'table_timeout_ms'; renamed 'table_api_options' => `spawn_api_options` |
| 138 | + - `create_collection()`: removed 'collection_request_timeout_ms', 'collection_timeout_ms'; renamed 'collection_api_options' => `spawn_api_options` |
| 139 | + - `create_table()`: removed 'table_request_timeout_ms', 'table_timeout_ms'; renamed 'table_api_options' => `spawn_api_options` |
| 140 | + - `get_database_admin()`: removed 'dev_ops_url', 'dev_ops_api_version' |
| 141 | + - `[Async]Collection` |
| 142 | + - `_copy()`: removed 'request_timeout_ms', 'collection_timeout_ms', 'callers' |
| 143 | + - `with_options`: removed 'request_timeout_ms', 'collection_timeout_ms', 'name', 'callers' |
| 144 | + - `to_[a]sync()`: removed 'request_timeout_ms', 'collection_timeout_ms', 'keyspace', 'name', 'callers' |
| 145 | + - `[Async]Table` |
| 146 | + - `_copy()`: removed 'database', 'name', 'keyspace', 'request_timeout_ms', 'table_timeout_ms', 'callers' |
| 147 | + - `with_options`: removed 'name', 'request_timeout_ms', 'table_timeout_ms', 'callers' |
| 148 | + - `to_[a]sync()`: removed 'database', 'name', 'keyspace', 'request_timeout_ms', 'table_timeout_ms', 'callers' |
37 | 149 |
|
| 150 | +Internal restructuring/maintenance things: |
| 151 | + - (not user-facing) classes in the hierarchy other than `DataAPIClient` have breaking changes in their constructor (now options-first and keyword-arg-only) |
| 152 | + - Token and Embedding API key coercion into `*Provider` now happens at the Options' init layer |
| 153 | + - `[Async]Collection.find_one` method uses the actual findOne API command |
| 154 | + - rename main branch from 'master' ==> `main` |
| 155 | + - major restructuring of the codebase in directories (some internal-only imports changed; reduced the scope of `test_imports`) |
| 156 | + - removal of unused imports from toplevel `__init__.py` (ids, constants, cursors) |
| 157 | + - simplified timeout management classes and representations |
38 | 158 |
|
39 | 159 | v. 1.5.2
|
40 | 160 | ========
|
|
0 commit comments