diff --git a/CHANGES b/CHANGES index ff5bbeb3..32be10a0 100644 --- a/CHANGES +++ b/CHANGES @@ -1,3 +1,9 @@ +v. 1.3.1 +======== +Fixed bug in parsing endpoint domain names containing hyphens (#287), by @bradfordcp +Added isort for source code formatting +Updated abstractions diagram in README for non-Astra environments + v. 1.3.0 ======== Integration testing covers Astra and nonAstra smoothly: diff --git a/README.md b/README.md index 8c2b9ce3..b48ee88e 100644 --- a/README.md +++ b/README.md @@ -20,8 +20,11 @@ import astrapy ASTRA_DB_APPLICATION_TOKEN = "AstraCS:..." ASTRA_DB_API_ENDPOINT = "https://01234567-....apps.astra.datastax.com" -my_client = astrapy.DataAPIClient(ASTRA_DB_APPLICATION_TOKEN) -my_database = my_client.get_database(ASTRA_DB_API_ENDPOINT) +my_client = astrapy.DataAPIClient() +my_database = my_client.get_database( + ASTRA_DB_API_ENDPOINT, + token=ASTRA_DB_APPLICATION_TOKEN, +) my_collection = my_database.create_collection( "dreams", @@ -97,6 +100,7 @@ Here's a small admin-oriented example: import astrapy +# this must have "Database Administrator" permissions: ASTRA_DB_APPLICATION_TOKEN = "AstraCS:..." my_client = astrapy.DataAPIClient(ASTRA_DB_APPLICATION_TOKEN) @@ -136,8 +140,11 @@ import astrapy ASTRA_DB_APPLICATION_TOKEN = "AstraCS:..." ASTRA_DB_API_ENDPOINT = "https://01234567-....apps.astra.datastax.com" -my_client = astrapy.DataAPIClient(ASTRA_DB_APPLICATION_TOKEN) -my_database = my_client.get_database(ASTRA_DB_API_ENDPOINT) +my_client = astrapy.DataAPIClient() +my_database = my_client.get_database( + ASTRA_DB_API_ENDPOINT, + token=ASTRA_DB_APPLICATION_TOKEN, +) my_collection = my_database.dreams my_collection.insert_one({"when": datetime.datetime.now()}) @@ -177,8 +184,11 @@ import bson ASTRA_DB_APPLICATION_TOKEN = "AstraCS:..." ASTRA_DB_API_ENDPOINT = "https://01234567-....apps.astra.datastax.com" -my_client = astrapy.DataAPIClient(ASTRA_DB_APPLICATION_TOKEN) -my_database = my_client.get_database(ASTRA_DB_API_ENDPOINT) +my_client = astrapy.DataAPIClient() +my_database = my_client.get_database( + ASTRA_DB_API_ENDPOINT, + token=ASTRA_DB_APPLICATION_TOKEN, +) my_collection = my_database.create_collection( "ecommerce", diff --git a/pictures/astrapy_abstractions.png b/pictures/astrapy_abstractions.png index ddacb230..3059338a 100644 Binary files a/pictures/astrapy_abstractions.png and b/pictures/astrapy_abstractions.png differ diff --git a/pyproject.toml b/pyproject.toml index 2e0c0912..46f30006 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "astrapy" -version = "1.3.0" +version = "1.3.1" description = "AstraPy is a Pythonic SDK for DataStax Astra and its Data API" authors = [ "Stefano Lottini ", diff --git a/tests/idiomatic/integration/test_timeout_sync.py b/tests/idiomatic/integration/test_timeout_sync.py index 23745ab8..cfa7118b 100644 --- a/tests/idiomatic/integration/test_timeout_sync.py +++ b/tests/idiomatic/integration/test_timeout_sync.py @@ -32,7 +32,7 @@ def test_collection_count_documents_timeout_sync( ) -> None: sync_empty_collection.insert_many([{"a": 1}] * 100) time.sleep(10) - assert sync_empty_collection.count_documents({}, upper_bound=150) >= 100 + assert sync_empty_collection.count_documents({}, upper_bound=500) >= 100 with pytest.raises(DataAPITimeoutException) as exc: sync_empty_collection.count_documents({}, upper_bound=150, max_time_ms=1)