-
Notifications
You must be signed in to change notification settings - Fork 2.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Cosmos] create new async user agent for async client #22263
Merged
Merged
Changes from all commits
Commits
Show all changes
73 commits
Select commit
Hold shift + click to select a range
61ba8d1
initial commit
simorenoh 15dcceb
Client Constructor (#20310)
annatisch bda95c3
read database
simorenoh c9648ab
Update simon_testfile.py
simorenoh 80540dc
with coroutine
simorenoh 1285438
Update simon_testfile.py
simorenoh 992b0cd
small changes
simorenoh 47cb688
async with returns no exceptions
simorenoh f3fa79f
Merge pull request #1 from Azure/simonmoreno/async
simorenoh 0c49739
async read container
simorenoh 47f4af5
async item read
simorenoh c97c946
cleaning up
simorenoh fcd95db
create item/ database methods
simorenoh 36c5b90
item delete working
simorenoh 44db2a2
docs replace functionality
simorenoh ec5b6ed
upsert functionality
simorenoh d63d052
Merge pull request #2 from simorenoh/item-read
simorenoh 5d74c8f
missing query methods
simorenoh 89fc2f7
CRUD for udf, sproc, triggers
simorenoh fdaa880
Merge branch 'Azure:main' into async-client
simorenoh 3f9baf2
Merge branch 'Azure:main' into async-client
simorenoh d6650bc
Merge branch 'Azure:main' into query-functionality
simorenoh 043dfe0
initial query logic + container methods
simorenoh befdb41
Merge branch 'async-client' into query-functionality
simorenoh 8cffbe2
Merge pull request #3 from simorenoh/query-functionality
simorenoh 72de7c8
missing some execution logic and tests
simorenoh 5b805b8
oops
simorenoh 8d8d0c4
fully working queries
simorenoh b597ca8
small fix to query_items()
simorenoh 18319df
Update _cosmos_client_connection_async.py
simorenoh 162c44d
Update _cosmos_client_connection.py
simorenoh ebbac51
documentation update
simorenoh 43f78e6
Merge branch 'Azure:main' into main
simorenoh 470aa5b
updated MIT dates and get_user_client() description
simorenoh 74da690
Update CHANGELOG.md
simorenoh 7104d63
Merge branch 'Azure:main' into main
simorenoh 20718c7
Delete simon_testfile.py
simorenoh d825eaa
Merge pull request #4 from simorenoh/async-client
simorenoh e3c27a5
leftover retry utility
simorenoh 3b778ad
Update README.md
simorenoh c6e352e
docs and removed six package
simorenoh 8971a25
Merge remote-tracking branch 'upstream/main'
simorenoh 52736ac
changes based on comments
simorenoh ad98039
small change in type hints
simorenoh f76c595
updated readme
simorenoh 3f02a65
fixes based on conversations
simorenoh e719869
added missing type comments
simorenoh d03ee05
Merge branch 'Azure:main' into main
simorenoh 02c52ee
update changelog for ci pipeline
simorenoh 2cb4551
added typehints, moved params into keywords, added decorators, made _…
simorenoh cf20d35
changes based on sync with central sdk
simorenoh f456817
remove is_system_key from scripts (only used in execute_sproc)
simorenoh ea9bd16
Revert "remove is_system_key from scripts (only used in execute_sproc)"
simorenoh 709d2eb
async script proxy using composition
simorenoh 3277dd8
pylint
simorenoh a57cb4d
capitalized constants
simorenoh 014578b
Apply suggestions from code review
simorenoh 0d79695
closing python code snippet
simorenoh fdabea1
last doc updates
simorenoh 016d0dd
Update sdk/cosmos/azure-cosmos/CHANGELOG.md
tjprescott 8228aa9
version update
simorenoh 7ae1cd0
Merge branch 'Azure:main' into main
simorenoh 7e8e953
cosmos updates for release
simorenoh b080256
create async user agent for debugging
simorenoh 643f9c5
added basic tests
simorenoh 99997e9
Merge branch 'main' of https://github.com/Azure/azure-sdk-for-python …
simorenoh f446308
Merge branch 'Azure-main'
simorenoh bc466d8
Merge branch 'Azure-main'
simorenoh be005ee
made user agent private so users know it's not something they need to…
simorenoh bca2da7
Merge branch 'Azure:main' into main
simorenoh c555d93
Merge branch 'main' into cosmos-async-user-agent
simorenoh 1dbacc3
bring in private user agent
simorenoh 759114a
Merge branch 'main' into cosmos-async-user-agent
simorenoh File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
# The MIT License (MIT) | ||
# Copyright (c) 2021 Microsoft Corporation | ||
|
||
# Permission is hereby granted, free of charge, to any person obtaining a copy | ||
# of this software and associated documentation files (the "Software"), to deal | ||
# in the Software without restriction, including without limitation the rights | ||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
# copies of the Software, and to permit persons to whom the Software is | ||
# furnished to do so, subject to the following conditions: | ||
|
||
# The above copyright notice and this permission notice shall be included in all | ||
# copies or substantial portions of the Software. | ||
|
||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
# SOFTWARE. | ||
|
||
import unittest | ||
|
||
import azure.cosmos.cosmos_client as sync_client | ||
import azure.cosmos.aio.cosmos_client as async_client | ||
import pytest | ||
import asyncio | ||
from test_config import _test_config | ||
|
||
# This test class serves to test user-configurable options and verify they are | ||
# properly set and saved into the different object instances that use these | ||
# user-configurable settings. | ||
|
||
pytestmark = pytest.mark.cosmosEmulator | ||
|
||
|
||
@pytest.mark.usefixtures("teardown") | ||
class TestClientUserAgent(unittest.TestCase): | ||
|
||
async def test_client_user_agent(self): | ||
client_sync = sync_client.CosmosClient(url=_test_config.host, credential=_test_config.masterKey) | ||
client_async = async_client.CosmosClient(url=_test_config.host, credential=_test_config.masterKey) | ||
|
||
self.assertTrue(client_sync.client_connection._user_agent.startswith("azsdk-python-cosmos/")) | ||
self.assertTrue(client_async.client_connection._user_agent.startswith("azsdk-python-cosmos-async/")) | ||
self.assertTrue(client_async.client_connection._user_agent != client_sync.client_connection._user_agent) | ||
|
||
await client_async.close() | ||
|
||
|
||
if __name__ == "__main__": | ||
event_loop = asyncio.get_event_loop() | ||
event_loop.run_until_complete(unittest.main()) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we also need to close
client_sync
?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nope, since the other client is synchronous it closes gracefully upon exiting the execution context is it being used in
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good, thanks!