googleapis / langchain-google-cloud-sql-pg-python

Apache License 2.0
29 stars 11 forks source link

fix: use 'thread mode' by default for async/sync init #180

Closed kurtisvg closed 2 months ago

kurtisvg commented 3 months ago

Alternative to #176.

Terminology:

Currently, 'async init' attempts to run in 'no-thread mode'. The problem with this is that you can't call sync methods from 'no-thread mode' without blocking the current thread.

This attempts to lessen that problem by defaulting to 'thread mode'. The only specific usecase where a user might use 'no-thread mode' is when using "from_engine" -- in which case an error will be thrown when calling 'sync' methods. User's may pass in their own loop to restore original behavior (need to add more docs to support his).