-
Notifications
You must be signed in to change notification settings - Fork 28
FEAT: Python support for Pooling #62
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
Merged
Merged
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
4591b55
refactor native layer and create reusable components
e375b20
add newline
b5a7d5a
Delete copy/assign for DriverLoader singleton
fc5903a
resolve review comments
998b25e
initial edit
7f9304b
working flow with c++ connection class
65d19a8
working interation with access token
be946d0
cleanup free() in sqlhandle
aad1e22
removed unnecessary prints
179ebf2
removing comment
70f6aa3
resolving conflict
b22b197
working
e302c0c
final working-fix test
gargsaumya 6a077c6
minor updates
gargsaumya 2c9c3d7
Merge branch 'saumya/conn_implementation' into saumya/integratec++class
gargsaumya 5181a0e
updating file
gargsaumya 3240394
added a TODO comment to address review comments
gargsaumya a9ee888
Merge branch 'saumya/conn_implementation' into saumya/integratec++class
gargsaumya c74ad07
adding python support for pool feature
gargsaumya dee13b4
addressed review comments
gargsaumya daa63ed
Merge remote-tracking branch 'origin/main' into saumya/pool-python
gargsaumya 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 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,29 @@ | ||
| # mssql_python/pooling.py | ||
| from mssql_python import ddbc_bindings | ||
| import threading | ||
|
|
||
| class PoolingManager: | ||
| _enabled = False | ||
| _lock = threading.Lock() | ||
| _config = { | ||
| "max_size": 100, | ||
gargsaumya marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| "idle_timeout": 600 | ||
| } | ||
|
|
||
| @classmethod | ||
| def enable(cls, max_size=100, idle_timeout=600): | ||
gargsaumya marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| with cls._lock: | ||
| if cls._enabled: | ||
| return | ||
|
|
||
| if max_size <= 0 or idle_timeout < 0: | ||
| raise ValueError("Invalid pooling parameters") | ||
|
|
||
| ddbc_bindings.enable_pooling(max_size, idle_timeout) | ||
| cls._config["max_size"] = max_size | ||
| cls._config["idle_timeout"] = idle_timeout | ||
| cls._enabled = True | ||
|
|
||
| @classmethod | ||
| def is_enabled(cls): | ||
| return cls._enabled | ||
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
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.