-
-
Notifications
You must be signed in to change notification settings - Fork 317
Pooling #2345
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
+131
−4
Merged
Pooling #2345
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
37f428c
Enhance SQL Alchemy engine with connection pool options
KoalaGeo 5841ed9
Add db_pool_options to PostgreSQL connection
KoalaGeo bc68af4
Update pool_recycle to SQLAlchemy default value
KoalaGeo cd9c836
Enhance SQLAlchemy connection pooling settings
KoalaGeo 9838aa9
Add files via upload
KoalaGeo 82ea64b
Consolidate SQLAlchemy connection pool option handling
KoalaGeo 9be0bf7
Ruff format
KoalaGeo 04c0099
Revert "Ruff format"
KoalaGeo 58c0d96
Ensure files end with a newline
KoalaGeo 60f3c4a
Normalize file endings
KoalaGeo 0b0f684
Add copyright and license to SQL pooling test
KoalaGeo 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
|
KoalaGeo 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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,56 @@ | ||
| # ================================================================= | ||
| # | ||
| # Authors: Edward Lewis <eddlewis85@gmail.com> | ||
| # | ||
| # Copyright (c) 2026 Edward Lewis | ||
| # | ||
| # 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. | ||
| # | ||
| # ================================================================= | ||
| # Test that get_engine() separates SQLAlchemy connection-pool tuning | ||
| # options from DBAPI connect_args. This is the contract introduced by | ||
| # the configurable-pool change; it needs no live database. | ||
| # ================================================================= | ||
|
|
||
| from unittest import mock | ||
|
|
||
| from pygeoapi.provider import sql | ||
|
|
||
|
|
||
| @mock.patch.object(sql, 'create_engine') | ||
| def test_get_engine_separates_pool_options_from_connect_args(mock_create): | ||
| sql.get_engine.cache_clear() | ||
| sql.get_engine( | ||
| 'postgresql+psycopg2', 'h', 5432, 'd', 'u', 'p', None, | ||
| pool_size=2, pool_recycle=300, connect_timeout=10, | ||
| ) | ||
|
|
||
| _, kwargs = mock_create.call_args | ||
| # pool keys are applied to the engine (QueuePool), with overrides | ||
| # honoured and unset pool keys falling back to the documented defaults | ||
| assert kwargs['pool_size'] == 2 | ||
| assert kwargs['pool_recycle'] == 300 | ||
| assert kwargs['max_overflow'] == 10 | ||
| assert kwargs['pool_timeout'] == 30 | ||
| assert kwargs['pool_pre_ping'] is True | ||
| # genuine DBAPI args are forwarded via connect_args; pool keys are not | ||
| assert kwargs['connect_args'] == {'connect_timeout': 10} |
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.