Oracle Connection Pooling implementation of issues/1655 (#1688)

* Implemented Connection Pooling

First part of collection pooling, improve by making pool size and other params configurable in YAML file of pygeoapi

* updated session pooling with more robust creation of dsn

* Further changes for releasing connections

* further little tweaks

* Added Thread Lock and building of DSN

* Session Pooling now only happens when ENV VAR ORACLE_POOL_MIN and ORACLE_POOL_MAX are set. Else usual behaviour is restored and single connections are opened and closed. Added a Lock for avoiding race conditions and threat safety.

* Flake8 changes

* More Flake8

* Added integer type to env variables

* Added Tests for Session Pooling

* Flake 8 changes for tests

* More Flake8 fun

* Fixed typo for env vars

* Fixed typo for env var and added noqa for variables

* More Typos

* More Flake8

* Added documentation to the oracle section for session pooling

* Review and Feedback with @totycro

* Update oracle.py

Added Author

* Added feedback from review

---------

Co-authored-by: root <root@els01entw.ama.at>
Co-authored-by: xlanger <moritz.langer@ama.gv.at>
This commit is contained in:
Moritz Langer
2024-06-21 13:15:34 +02:00
committed by GitHub
parent fef8df120e
commit c607be7ed2
3 changed files with 220 additions and 97 deletions
@@ -387,6 +387,21 @@ Extra properties
Extra properties is a list of strings which are added as fields for data retrieval in the SELECT clauses. They
can be used to return expressions computed by the database.
Session Pooling
""""""""""""""""
Configured using environment variables.
.. code-block:: bash
export ORACLE_POOL_MIN=2
export ORACLE_POOL_MAX=10
The ``ORACLE_POOL_MIN`` and ``ORACLE_POOL_MAX`` environment variables are used to trigger session pool creation in the Oracle Provider and the ``DatabaseConnection`` class. See https://python-oracledb.readthedocs.io/en/latest/api_manual/module.html#oracledb.create_pool for documentation of the ``create_pool`` function.
If none or only one of the environment variables is set, session pooling will not be activated and standalone connections are established at every request.
Custom SQL Manipulator Plugin
"""""""""""""""""""""""""""""