-
Notifications
You must be signed in to change notification settings - Fork 18
Add async support for Dataverse SDK #171
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
Open
abelmilash-msft
wants to merge
28
commits into
main
Choose a base branch
from
users/abelmilash/async-phase2
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
28 commits
Select commit
Hold shift + click to select a range
e7df299
Rebase refactoring on main (post GA API merge)
a4f69cd
Rebase async implementation on main (post GA API merge)
16084a1
Merge branch 'main' into users/abelmilash/async-phase2
c610af5
Remove non-async changes from async PR: revert migration tool path, r…
3113d45
Restore non-async files to match main: libcst in dev, query.py docstr…
9cb9d4a
Align async example scripts with sync counterparts
c4d5614
Add async client documentation to README and SDK use skill
774102a
Simplify async _async_odata.py: replace multi-pass comprehensions wit…
170b550
Fix black formatting in _async_odata.py; sync dev SKILL copies
836ca29
Fix azure.identity import: InteractiveBrowserCredential is not in aio…
7a360c1
Fix async credential examples: use ClientSecretCredential from azure.…
5c6bdc7
Use DefaultAzureCredential in async examples and docs
0d71bd3
Simplify async auth docs: single import with one-line note on interac…
255a798
Remove inline auth comment from async import examples
f37b9b4
Rename 'materialized' to 'response' in _async_http.py for clarity
58fe82e
Fix _async_batch.py: rename r to response, simplify remove_columns loop
bd74d02
Align async fetchxml JSON parsing with sync pattern
d738377
Reorder fetchxml() in async_query.py to match sync method order
e4680f8
Fix fetchxml() position in async_query.py: move above sql_columns
6c32c6b
Align async fetchxml() docstring and comments with sync
e37fe4d
Fix async example scripts: remove deprecated method calls and close s…
5fba6de
Fix async file_upload example: use _AsyncResponse._body instead of .c…
1a9d566
Fix async file_upload example: fix remaining .content references for …
51e653f
Add async concurrency benchmark and validation script
d7310be
Expand concurrency_benchmark.py docstring with per-test descriptions
cb0d711
Apply black formatting to concurrency_benchmark.py
da41fcc
Shorten per-test descriptions in concurrency_benchmark.py docstring
562e8b7
Rewrite per-test docstring entries as concise 3-sentence descriptions
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
|
abelmilash-msft marked this conversation as resolved.
abelmilash-msft marked this conversation as resolved.
abelmilash-msft marked this conversation as resolved.
abelmilash-msft marked this conversation as resolved.
abelmilash-msft marked this conversation as resolved.
abelmilash-msft marked this conversation as resolved.
abelmilash-msft marked this conversation as resolved.
abelmilash-msft marked this conversation as resolved.
abelmilash-msft marked this conversation as resolved.
abelmilash-msft marked this conversation as resolved.
abelmilash-msft marked this conversation as resolved.
abelmilash-msft marked this conversation as resolved.
abelmilash-msft marked this conversation as resolved.
abelmilash-msft marked this conversation as resolved.
abelmilash-msft marked this conversation as resolved.
abelmilash-msft marked this conversation as resolved.
abelmilash-msft marked this conversation as resolved.
abelmilash-msft marked this conversation as resolved.
abelmilash-msft marked this conversation as resolved.
abelmilash-msft marked this conversation as resolved.
abelmilash-msft marked this conversation as resolved.
abelmilash-msft marked this conversation as resolved.
abelmilash-msft marked this conversation as resolved.
abelmilash-msft marked this conversation as resolved.
abelmilash-msft marked this conversation as resolved.
abelmilash-msft marked this conversation as resolved.
abelmilash-msft marked this conversation as resolved.
abelmilash-msft marked this conversation as resolved.
abelmilash-msft marked this conversation as resolved.
abelmilash-msft marked this conversation as resolved.
abelmilash-msft marked this conversation as resolved.
abelmilash-msft marked this conversation as resolved.
abelmilash-msft marked this conversation as resolved.
abelmilash-msft marked this conversation as resolved.
abelmilash-msft marked this conversation as resolved.
abelmilash-msft marked this conversation as resolved.
abelmilash-msft marked this conversation as resolved.
abelmilash-msft marked this conversation as resolved.
abelmilash-msft marked this conversation as resolved.
abelmilash-msft marked this conversation as resolved.
|
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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,2 @@ | ||
| # Copyright (c) Microsoft Corporation. | ||
| # Licensed under the MIT license. |
This file contains hidden or 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,57 @@ | ||
| # Copyright (c) Microsoft Corporation. | ||
| # Licensed under the MIT license. | ||
|
|
||
| """ | ||
| Async credential helper for the async example scripts. | ||
|
|
||
| azure-identity's InteractiveBrowserCredential is only available in the sync | ||
| namespace (azure.identity), not the async one (azure.identity.aio). This | ||
| module wraps the sync credential so it satisfies the AsyncTokenCredential | ||
| protocol required by AsyncDataverseClient. | ||
|
|
||
| Usage:: | ||
|
|
||
| from _auth import AsyncInteractiveBrowserCredential | ||
|
|
||
| credential = AsyncInteractiveBrowserCredential() | ||
| try: | ||
| async with AsyncDataverseClient(org_url, credential) as client: | ||
| ... | ||
| finally: | ||
| await credential.close() | ||
| """ | ||
|
|
||
| import asyncio | ||
| from concurrent.futures import ThreadPoolExecutor | ||
|
|
||
| from azure.identity import InteractiveBrowserCredential | ||
|
|
||
|
|
||
| class AsyncInteractiveBrowserCredential: | ||
| """ | ||
| Async wrapper around the sync InteractiveBrowserCredential. | ||
|
|
||
| get_token() is dispatched to a dedicated thread so the event loop stays | ||
| free during the browser popup / token exchange. Subsequent calls hit the | ||
| in-process token cache and return almost immediately. | ||
| """ | ||
|
|
||
| def __init__(self, **kwargs): | ||
| self._credential = InteractiveBrowserCredential(**kwargs) | ||
| self._executor = ThreadPoolExecutor(max_workers=1) | ||
|
|
||
| async def get_token(self, *scopes, **kwargs): | ||
| loop = asyncio.get_running_loop() | ||
| return await loop.run_in_executor( | ||
| self._executor, | ||
| lambda: self._credential.get_token(*scopes, **kwargs), | ||
| ) | ||
|
|
||
| async def close(self): | ||
| self._executor.shutdown(wait=False) | ||
|
|
||
| async def __aenter__(self): | ||
| return self | ||
|
|
||
| async def __aexit__(self, *_): | ||
| await self.close() |
This file contains hidden or 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,4 @@ | ||
| # Copyright (c) Microsoft Corporation. | ||
| # Licensed under the MIT license. | ||
|
|
||
| """Advanced async examples showcasing complex Dataverse SDK features.""" |
Oops, something went wrong.
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.