-
Notifications
You must be signed in to change notification settings - Fork 9
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
AsyncDefog #61
Merged
Merged
AsyncDefog #61
Conversation
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
rishsriv
approved these changes
Sep 10, 2024
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.
Thanks for pointing this out! Will add native support for these!
Get Outlook for iOS<https://aka.ms/o0ukef>
…________________________________
From: Rishabh Srivastava ***@***.***>
Sent: Tuesday, September 10, 2024 10:03:11 PM
To: defog-ai/defog-python ***@***.***>
Cc: Muhammad Abdullah ***@***.***>; Author ***@***.***>
Subject: Re: [defog-ai/defog-python] AsyncDefog (PR #61)
- External Email -
@rishsriv approved this pull request.
Thanks Abdullah! This looks very, very good. And +1 for the tests.
Could you please add native asynchronous mode for the following:
* Snowflake: example here<https://docs.snowflake.com/en/developer-guide/python-connector/python-connector-example#submitting-an-asynchronous-query>
* SQLServer, by using aioodbc. Example here<mkleehammer/pyodbc#901 (comment)>
After that, I can test and merge!
—
Reply to this email directly, view it on GitHub<#61 (review)>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AZGPXGWBY5KVWH5A6W4EVDLZV33Z7AVCNFSM6AAAAABN6POFK2VHI2DSMVQWIX3LMV43YUDVNRWFEZLROVSXG5CSMV3GSZLXHMZDEOJSGYZTKMBRGE>.
You are receiving this because you authored the thread.Message ID: ***@***.***>
|
rishsriv
approved these changes
Sep 12, 2024
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.
Finished testing and this looks great Abdullah! Thanks for adding this much needed feature!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
For
postgres
andredshift
, we have the asynchronousasyncpg
to replacepsycopg2
For
mysql
, we haveaiomysql
to replacemysql.converter
For
snowflake
, we use the same connector as it also offers acur.execute_async
method- we then poll the status of the query id to see if its done running otherwise just simulate an async sleep usingawait asyncio.sleep(1)
.For
sqlserver
, we useaioodbc
which has the exact same signature aspyodbc
but is asynchronous and must be awaited.However, for
Databricks
andBigQuery
, no native asynchronous alternatives were found. To mimic asynchronous behavior for these databases, we are usingasyncio.to_thread
to handle blocking operations in a non-blocking manner.Methods of
AsyncDefog
have the exact same signature (name, params) but have to beawaited
. The initial methods likesave_connection_json, check_db_creds, to_base64_creds, from_base64_creds
are kept as it is (not made async) but do let me know if those also need to be async and that will be a 3 mins fix (because it will just need a wrapper off its parent class's methods into an async function i.easync def function(): return self.function()
).create_table_ddl
andcreate_ddl_from_metadata
also made async underasync_admin_methods
for the sake of consistency even though they are not I/O bound or db intensive.