Skip to content

Commit ee798e2

Browse files
authored
Cleanup of all deprecated things pre-v2 (#320)
* removal of core * removal of bulk_write * removal of vector, vectorize, vectors parameters to collection methods * removed .collection and .retrieved of cursors * remove set_caller; bump to 2.0.0 * removed caller_name, caller_version param pair * removed id/region pattern in DataAPIClient get_database methods * refactor get_database_by_api_endpoint as alias; adjust admin tests not to use id/region * removed all namespace aliases in API * full removal of all 'namespace' things
1 parent 4601c5f commit ee798e2

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

72 files changed

+400
-18177
lines changed

.github/workflows/hcd.yaml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,6 @@ on:
1111
jobs:
1212
test:
1313
env:
14-
# special setting to not drop any collection (core only)
15-
TEST_SKIP_COLLECTION_DELETE: ${{ secrets.TEST_SKIP_COLLECTION_DELETE }}
1614
# for admin-related testing if enabled
1715
DO_IDIOMATIC_ADMIN_TESTS: ${{ secrets.DO_IDIOMATIC_ADMIN_TESTS }}
1816
# hardcoding the target DB

.github/workflows/main.yml

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,6 @@ jobs:
1616
ASTRA_DB_API_ENDPOINT: ${{ secrets.ASTRA_DB_API_ENDPOINT }}
1717
ASTRA_DB_KEYSPACE: ${{ secrets.ASTRA_DB_KEYSPACE }}
1818
ASTRA_DB_SECONDARY_KEYSPACE: ${{ secrets.ASTRA_DB_SECONDARY_KEYSPACE }}
19-
# special setting to not drop any collection (core only)
20-
TEST_SKIP_COLLECTION_DELETE: ${{ secrets.TEST_SKIP_COLLECTION_DELETE }}
2119
# for admin-related testing if enabled
2220
DO_IDIOMATIC_ADMIN_TESTS: ${{ secrets.DO_IDIOMATIC_ADMIN_TESTS }}
2321
PROD_ADMIN_TEST_ASTRA_DB_APPLICATION_TOKEN: ${{ secrets.PROD_ADMIN_TEST_ASTRA_DB_APPLICATION_TOKEN }}
@@ -26,9 +24,6 @@ jobs:
2624
DEV_ADMIN_TEST_ASTRA_DB_APPLICATION_TOKEN: ${{ secrets.DEV_ADMIN_TEST_ASTRA_DB_APPLICATION_TOKEN }}
2725
DEV_ADMIN_TEST_ASTRA_DB_PROVIDER: ${{ secrets.DEV_ADMIN_TEST_ASTRA_DB_PROVIDER }}
2826
DEV_ADMIN_TEST_ASTRA_DB_REGION: ${{ secrets.DEV_ADMIN_TEST_ASTRA_DB_REGION }}
29-
# for "core" ops testing
30-
ASTRA_DB_ID: ${{ secrets.ASTRA_DB_ID }}
31-
ASTRA_DB_OPS_APPLICATION_TOKEN: ${{ secrets.ASTRA_DB_OPS_APPLICATION_TOKEN }}
3227
runs-on: ubuntu-latest
3328

3429
steps:

CHANGES

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,24 @@
1+
v 2.0.0
2+
=======
3+
Removal of several deprecated modules/features from previous versions:
4+
- 'core' (i.e. pre-1.0) library
5+
- 'collection.bulk_write' and the associated result and exception classes
6+
- 'vector=', 'vectorize=' and 'vectors=' parameters from collection methods
7+
- 'retrieved' (=> `consumed`) and 'collection' (=> `data_source`) for cursors
8+
- 'set_caller' method of `DataAPIClient`, `AstraDBAdmin`, `DataAPIDatabaseAdmin`, `AstraDBDatabaseAdmin`, `[Async]Database`, `[Async]Collection`
9+
- 'caller_name' and 'caller_version' parameters where `callers` is now expected
10+
- 'id' and 'region' to DataAPIClient's 'get_database' (and async version). Use `api_endpoint` which is now the one positional parameter.
11+
- 'region' parameter of AstraDBDatabaseAdmin.get[_async]_database (was ignored already in the method)
12+
- The 'max_time_ms' parameter in DataAPIClient's 'get_database' method.
13+
- Accordingly, the syntax `client[api_endpoint]` also does not accept a database ID anymore.
14+
- 'namespace' parameter of several methods of: DataAPIClient, admin objects, Database and Collection (use `keyspace`)
15+
- 'namespace' property of CollectionInfo, DatabaseInfo, CollectionNotFoundException, CollectionAlreadyExistsException (use `keyspace`)
16+
- 'namespace' property of Databases and Collections (switch to `keyspace`)
17+
- 'update_db_namespace' parameter to for admin keyspace CRD methods (use `update_db_keyspace`)
18+
- 'use_namespace' for Databases (switch to `use_keyspace`)
19+
- 'delete_all' method of Collection and AsyncCollection (use `delete_many({})`)
20+
Removal of unused imports from toplevel __init__.py (ids, constants, cursors)
21+
122
v. 1.5.2
223
========
324
Bugfix: `Database.get_collection` uses callers inheritance (same for async)

README.md

Lines changed: 10 additions & 97 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22

33
A pythonic client for [DataStax Astra DB](https://astra.datastax.com).
44

5-
_This README targets AstraPy version **1.0.0+**, which introduces a whole new API.
6-
Click [here](https://github.com/datastax/astrapy/blob/cd3f5ce8146093e10a095709c0f5c3f8e3f2c7da/README.md) for the pre-existing API (fully compatible with newer versions)._
5+
_This README targets **AstraPy version 2.0+**. Click [here](https://github.com/datastax/astrapy/blob/4601c5fa749925d961de1f114ca27690d1a71b13/README.md) for v1 and [here](https://github.com/datastax/astrapy/blob/cd3f5ce8146093e10a095709c0f5c3f8e3f2c7da/README.md) for the v0 API (which you should not really be using by now)._
76

87

98
## Quickstart
@@ -253,7 +252,6 @@ Tests are grouped in three _blocks_ (in as many subdirs of `tests/`):
253252

254253
- **idiomatic**: all 1.0+ classes and APIs, except...
255254
- **vectorize**: ... everything making use of `$vectorize` (within the idiomatic classes)
256-
- _(core: pre-1.0 classes). Frozen as of v1.5, deprecated for removal in v2.0_
257255

258256
Actually, for convenience, _sub-blocks_ of tests are considered:
259257

@@ -262,8 +260,6 @@ Actually, for convenience, _sub-blocks_ of tests are considered:
262260
- **idiomatic admin nonAstra**: the nonAstra-specific admin operations
263261
- **vectorize in-depth**: many Data API interactions for a single choice of provider/model. This is mostly test the client
264262
- **vectorize all-providers**: a slightly more shallow test repeated for all providers, models, auth methods etc. This is mostly testing the API
265-
- _(core regular: everything except DevOps interactions)_
266-
- _(core ops: core DevOps operations)_
267263

268264
Tests can be run on three types of Data API _targets_ (with slight differences in what is applicable):
269265

@@ -275,7 +271,7 @@ Depending on the (sub-block, target) combination, some environment variables may
275271
Templates for the environment variables are to be found in `tests/env_templates`.
276272

277273
The general expectation is that idiomatic non-Admin tests, and vectorize in-depth tests, are
278-
part of the main CI flow; conversely, core, admin and vectorize all-providers are kept as a
274+
part of the main CI flow; conversely, admin and vectorize all-providers are kept as a
279275
manual task to run (locally in most cases) when circumstances require it (use your judgement).
280276

281277
#### Required environment variables
@@ -286,13 +282,12 @@ of testing:
286282
- **DockerCompose**: generally no variables needed, except:
287283
- **vectorize in-depth**: provide as in `env.vectorize-minimal.template`
288284
- **vectorize all-providers**: provide as in `env.vectorize.template`
289-
- (also note that _core ops_ and _idiomatic admin Astra_ amount to nothing in this case)
285+
- (also note that _idiomatic admin Astra_ amounts to nothing in this case)
290286
- **nonAstra**: all tests require as in `env.local.template`, plus:
291287
- **vectorize in-depth**: also provide as in `env.vectorize-minimal.template`
292288
- **vectorize all-providers**: also provide as in `env.vectorize.template`
293-
- (also note that _core ops_ and _idiomatic admin Astra_ amount to nothing in this case)
289+
- (also note that _idiomatic admin Astra_ amounts to nothing in this case)
294290
- **Astra**: all tests require as in `env.astra.template`, plus:
295-
- **core ops**: the token must have at least "Database Administrator" role (possibly through definition of a separate `ASTRA_DB_OPS_APPLICATION_TOKEN`), and `ASTRA_DB_ID` must also be defined
296291
- **idiomatic admin Astra**: also provide as in `env.astra.admin.template`
297292
- **vectorize in-depth**: also provide as in `env.vectorize-minimal.template`
298293
- **vectorize all-providers**: also provide as in `env.vectorize.template`
@@ -305,20 +300,6 @@ For the **DockerCompose** case, prepend all of the following with `DOCKER_COMPOS
305300
All the usual `pytest` ways of restricting the test selection hold in addition
306301
(e.g. `poetry run pytest tests/idiomatic/unit` or `[...] -k <test_name_selector>`).
307302

308-
##### _core regular_:
309-
310-
```
311-
poetry run pytest tests/core
312-
```
313-
314-
##### _core ops_:
315-
316-
Note the special variable needed to actually run this. You will have to manually clean up afterwards.
317-
318-
```
319-
TEST_ASTRADBOPS="1" poetry run pytest tests/core/test_ops.py
320-
```
321-
322303
##### _idiomatic regular_:
323304

324305
Warning: this will also trigger the very long-running _idiomatic admin Astra_ if the vars as in `env.astra.admin.template` are also detected. Likewise, the _idiomatic admin nonAstra_ may start (if `DO_IDIOMATIC_ADMIN_TESTS` is set), which however takes few seconds.
@@ -379,12 +360,6 @@ Increase logging level to `DEBUG` (i.e. level `10`):
379360
poetry run pytest [...] -o log_cli=1 --log-cli-level=10
380361
```
381362

382-
Do not drop collections (valid for core):
383-
384-
```
385-
TEST_SKIP_COLLECTION_DELETE=1 poetry run pytest [...]
386-
```
387-
388363

389364
## Appendices
390365

@@ -433,29 +408,6 @@ from astrapy.ids import (
433408
)
434409
```
435410

436-
Operations (for `bulk_write` collection method):
437-
438-
```python
439-
from astrapy.operations import (
440-
BaseOperation,
441-
InsertOne,
442-
InsertMany,
443-
UpdateOne,
444-
UpdateMany,
445-
ReplaceOne,
446-
DeleteOne,
447-
DeleteMany,
448-
AsyncBaseOperation,
449-
AsyncInsertOne,
450-
AsyncInsertMany,
451-
AsyncUpdateOne,
452-
AsyncUpdateMany,
453-
AsyncReplaceOne,
454-
AsyncDeleteOne,
455-
AsyncDeleteMany,
456-
)
457-
```
458-
459411
Result classes:
460412

461413
```python
@@ -465,15 +417,13 @@ from astrapy.results import (
465417
InsertOneResult,
466418
InsertManyResult,
467419
UpdateResult,
468-
BulkWriteResult,
469420
)
470421
```
471422

472423
Exceptions:
473424

474425
```python
475426
from astrapy.exceptions import (
476-
BulkWriteException,
477427
CollectionAlreadyExistsException,
478428
CollectionNotFoundException,
479429
CumulativeOperationException,
@@ -542,47 +492,10 @@ from astrapy.cursors import (
542492
### Appendix B: compatibility with pre-1.0.0 library
543493

544494
If your code still uses the pre-1.0.0 astrapy (i.e. `from astrapy.db import AstraDB, AstraDBCollection` and so on)
545-
you are strongly advised to migrate to the current API, which has more capabilities and improved interfaces.
546-
547-
All of the astrapy pre-1.0 API (now dubbed "core") works throughout *astrapy v1*, albeit with a deprecation warning
548-
on astrapy v. 1.5.
549-
550-
Version 1.5 (the first to not wrap internally "core" as the engine of its own "idiomatic" API) introduces
551-
several deprecation notices (nothing is retired yet), including a submodule-wide deprecation of "core".
552-
553-
**Version 2 of astrapy will finally remove "core" entirely (along with a few other things).**
554-
555-
#### v1 is fully compatible with "core", i.e. with pre-1.0.0
556-
557-
That being said, there are no known breakings of backward compatibility:
558-
**legacy code would run with astrapy v1 just as well**
559-
Here is a recap of the minor changes that came _to the old API_ with 1.0.0 (and beyond, up to 1.5):
560-
561-
- added a submodule-wide deprecation warning of the whole "core" library (v 1.5)
562-
- added 'options' parameter to [Async]AstraDBCollection.update_one (v. 1.4.2+)
563-
- prefetched find iterators: fix second-thread hangups in some cases (v. 1.4.2+)
564-
- Added support for null tokens (with the effect of no authentication/token header in requests)
565-
- Added Content-Type header to all HTTP requests to the API
566-
- Added methods to `[Async]AstraDBCollection`: `delete_one_filter`,
567-
- Paginated find methods (sync/async) type change from Iterable to Generator
568-
- Bugfix: handling of the mutable caller identity in copy and convert (sync/async) methods
569-
- Default value of `sort` is `None` and not `{}` for `find` (sync/async)
570-
- Introduction of `[Async]AstraDBCollection.chunked_delete_many` method
571-
- Added `projection` parameter to `find_one_and[replace/update]` (sync/async)
572-
- Bugfix: projection was silently ignored in `vector_find_one_and_[replace/update]` (sync/async)
573-
- Added `options` to `update_many` (sync/async)
574-
- `[Async]AstraDBDatabase.chunked_insert_many` does not intercept generic exceptions anymore, only `APIRequestError`
575-
- Bugfix: `AsyncAstraDBCollection.async chunked_insert_many` stops at the first error when `ordered=True`
576-
- Added payload info to `DataAPIException`
577-
- Added `find_one_and_delete` method (sync/async)
578-
- Added `skip_error_check` parameter to `delete_many` (sync/async)
579-
- Timeout support throughout the library
580-
- Added `sort` to `update_one`, `delete_one` and `delete_one_by_predicate` methods (sync/async)
581-
- Full support for UUID v1,3,4,5,6,7,8 and ObjectID at the collection data I/O level
582-
- `AstraDBOps.create_database` raises errors in case of failures
583-
- `AstraDBOps.create_database`, return type corrected
584-
- Fixed behaviour and return type of `AstraDBOps.create_keyspace` and `AstraDBOps.terminate_db`
585-
- Added `AstraDBOps.delete_keyspace` method
586-
- Method `create_collection` of `AstraDB` relaxes checks on passing `dimensions` for vector collections
587-
- AstraDBOps core class acquired async methods: `async_get_databases`, `async_get_database`, `async_create_database`, `async_terminate_database`, `async_create_keyspace`, `async_delete_keyspace`
495+
you are strongly advised to migrate to the current API. All of the astrapy pre-1.0 API (later dubbed "core")
496+
works throughout *astrapy v1*, albeit with a deprecation warning on astrapy v. 1.5.
497+
498+
Version 2 drops "core" support entirely. In order to use astrapy version 2.0+, you need to migrate your application.
499+
Check the links at the beginning of this README for the updated documentation and API reference.
588500

501+
Check out previous versions of this README for more on "core": [1.5.2](https://github.com/datastax/astrapy/blob/4601c5fa749925d961de1f114ca27690d1a71b13/README.md) and [pre-1.0](https://github.com/datastax/astrapy/blob/cd3f5ce8146093e10a095709c0f5c3f8e3f2c7da/README.md).

astrapy/__init__.py

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -49,10 +49,6 @@ def get_version() -> str:
4949
__version__: str = get_version()
5050

5151

52-
import astrapy.constants # noqa: E402
53-
import astrapy.cursors # noqa: E402
54-
import astrapy.ids # noqa: E402
55-
import astrapy.operations # noqa: F401, E402
5652
from astrapy.admin import ( # noqa: E402
5753
AstraDBAdmin,
5854
AstraDBDatabaseAdmin,
@@ -78,15 +74,11 @@ def get_version() -> str:
7874

7975

8076
__pdoc__ = {
81-
"api": False,
8277
"api_commander": False,
8378
"api_options": False,
84-
"core": False,
85-
"db": False,
8679
"defaults": False,
8780
"ids": False,
8881
"meta": False,
89-
"ops": False,
9082
"request_tools": False,
9183
"transform_payload": False,
9284
"user_agents": False,

0 commit comments

Comments
 (0)