Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions pygeoapi/api/itemtypes.py
Original file line number Diff line number Diff line change
Expand Up @@ -387,8 +387,12 @@ def get_collection_items(

LOGGER.debug('processing property parameters')
for k, v in request.params.items():
if k not in reserved_fieldnames and k in list(p.fields.keys()):
LOGGER.debug(f'Adding property filter {k}={v}')
if k not in reserved_fieldnames:
if k in list(p.fields.keys()):
LOGGER.debug(f'Adding property filter {k}={v}')
else:
LOGGER.debug(f'Adding additional property filter {k}={v}')

properties.append((k, v))

LOGGER.debug('processing sort parameter')
Expand Down
14 changes: 14 additions & 0 deletions pygeoapi/provider/oracle.py
Original file line number Diff line number Diff line change
Expand Up @@ -647,6 +647,19 @@ def query(

:returns: GeoJSON FeaturesCollection
"""
LOGGER.debug(f"properties contains: {properties}")

# NOTE: properties contains field keys plus extra params
# need to split them up here
filtered_properties = []
extra_params = {}
for (key, value) in properties:
if key in self.fields.keys():
filtered_properties.append((key, value))
else:
extra_params[key] = value

properties = filtered_properties

# Check mandatory filter properties
property_dict = dict(properties)
Expand Down Expand Up @@ -804,6 +817,7 @@ def query(
q,
language,
filterq,
extra_params=extra_params
Copy link
Contributor

@doublebyte1 doublebyte1 Aug 3, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 for adding this functionality. I think we should add something about these extra parameters for Oracle in the documentation of the provider. Maybe just give an example of how this could be useful?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have added the documentation here:
master...Moritz-Langer:pygeoapi:master

If that resonates with you I can create a PR.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1 for a PR, thanks.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PR is here:
#2075
Thank you :)

)

# Clean up placeholders that aren't used by the
Expand Down
12 changes: 12 additions & 0 deletions tests/test_oracle_provider.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,11 @@ def process_query(
q,
language,
filterq,
extra_params
):
sql = "ID = 10 AND :foo != :bar"
if extra_params.get("custom-auth") == "forbidden":
sql = f"{sql} AND 'auth' = 'you are not allowed'"

if sql_query.find(" WHERE ") == -1:
sql_query = sql_query.replace("#WHERE#", f" WHERE {sql}")
Expand Down Expand Up @@ -632,6 +635,15 @@ def test_query_mandatory_properties_must_be_specified(config):
p.query(properties=[("id", "123")])


def test_extra_params_are_passed_to_sql_manipulator(config_manipulator):
extra_params = [("custom-auth", "forbidden")]

p = OracleProvider(config_manipulator)
response = p.query(properties=extra_params)

assert not response['features']


@pytest.fixture()
def database_connection_pool(config_db_conn):
os.environ["ORACLE_POOL_MIN"] = "2" # noqa: F841
Expand Down