-
-
Notifications
You must be signed in to change notification settings - Fork 265
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
Oracle Provider #1329
Oracle Provider #1329
Conversation
Feature/ogc api part4 crud
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.
Excellent work here and super easy/pleasant to review. See minor change requests. Thanks!
|
||
Sometimes it is necessary to use the Oracle client for the connection. In this case init_oracle_client must be set to True. | ||
|
||
The provider supports a SQL-Manipulator-Plugin class. With this, the SQL statement could be manipulated. This is |
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.
Perhaps this level of information (code blocks, etc.) can go in pygeoapi/provider/oracle.py
and specify in the doc to consult the plugin itself? We should keep these sections of the docs more user focused.
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.
What do you think about to link here to the test class? There is the example class, too.
Something like:
Sometimes it is necessary to use the Oracle client for the connection. In this case init_oracle_client must be set to True.
The provider supports a SQL-Manipulator-Plugin class. With this, the SQL statement could be manipulated. This is
useful e.g. for authorization at row level or manipulation of the explain plan with hints.
An example an more informations about that feature you can find in the test class in tests/test_oracle_provider.py.
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.
+1
oracle-config.yml
Outdated
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.
Remove this file (given we have an example in tests
.
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.
If the full configuration files are beneficial to keep, alternatively consider creating an oracle docker example.
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.
No, there is no benefit. Everything is in the documentation, too. I only forgot to delete this file...
oracle-openapi.yml
Outdated
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.
Remove this file.
# OTHER DEALINGS IN THE SOFTWARE. | ||
# | ||
# ================================================================= | ||
|
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.
Sort dependencies as standard library, external packages, local imports, alphabetically. So:
import importlib
import json
import logging
from typing import Optional
import oracledb
from pygeoapi.provider.base import (
BaseProvider,
ProviderConnectionError,
ProviderItemNotFoundError,
ProviderQueryError
)
pygeoapi/provider/oracle.py
Outdated
if bbox: | ||
bbox_dict = {"clause": "", "properties": {}} | ||
|
||
sdo_mask = "mask={}".format(sdo_mask) |
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.
use f-string
pygeoapi/provider/oracle.py
Outdated
where_dict["properties"].update(bbox_dict["properties"]) | ||
|
||
if where_conditions: | ||
where_dict["clause"] = " WHERE {}".format( |
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.
use f-string
pygeoapi/provider/oracle.py
Outdated
module_name, class_name = module_class_string.rsplit(".", 1) | ||
module = importlib.import_module(module_name) | ||
LOGGER.debug( | ||
"reading class {} from module {}".format(class_name, module_name) |
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.
use f-string
pygeoapi/provider/oracle.py
Outdated
if super_cls is not None: | ||
assert issubclass( | ||
cls, super_cls | ||
), "class {} should inherit from {}".format( |
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.
use f-string
pygeoapi/provider/oracle.py
Outdated
), "class {} should inherit from {}".format( | ||
class_name, super_cls.__name__ | ||
) | ||
LOGGER.debug("initialising {} with params {}".format(class_name, kwargs)) |
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.
use f-string
Thanks for the laud! I'll try to fix everything in the next days. |
oracle-config.yml
Outdated
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.
If the full configuration files are beneficial to keep, alternatively consider creating an oracle docker example.
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.
@tomkralidis I believe this file can be deleted too - https://github.com/geopython/pygeoapi/pull/1329/files#diff-bec70aa2812a4deafc7d4f626335d69a1467963368c7b7946d62462d38abe7afR121
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.
Yes, the configuration is included in the test class.
All change requests are now implemented and commited! |
Overview
Oracle Provider for pygeoapi implemented by @xkosubek
The implementation is modeled after the PostgreSQL provider and thus should be fairly consistent with related code in pygeoapi.
It supports all CRUD operations.
The tests are executed via GitHub Actions using an oracle docker container.
There is some documentation, specifically also for the
SqlManipulator
, which is a mechanism for custom extensions that is necessary for a certain private use case, but is designed to be useable for different contexts.(as per https://github.com/geopython/pygeoapi/blob/master/CONTRIBUTING.md#contributions-and-licensing)