fix: apply typeNames SQL filter and scope queryables per profile in multi-profile deployments - #1269
Open
lirantul123 wants to merge 1 commit into
Open
lirantul123 wants to merge 1 commit into
lirantul123 wants to merge 1 commit into
Conversation
Two bugs made GetRecords unusable when multiple CSW profiles share one repository table (each row tagged by its typename column): - repository.query() accepted a typenames argument but never applied it, so a request scoped to one profile returned every row. It now filters on the typename column for specific, non-generic types; the csw:Record / csw30:Record wildcards still return all rows, leaving default and single-profile behaviour unchanged. - Filter/CQL property names always resolved against queryables['_all'], a flat merge in which the last-loaded profile wins, so profiles sharing a property name mapped to different columns resolved incorrectly. The new _scoped_queryables() overlays the requested typenames' queryables onto _all (returning _all verbatim for no/generic types). Applied to the GET and POST filter/CQL paths of both csw2.py and csw3.py. Adds unit tests for the typename filter, including the wildcard and no-typename cases that must keep returning all rows.
lirantul123
force-pushed
the
fix/multiprofile-typename-scoping
branch
from
September 23, 2026 14:12
53da19a to
5323c96
Compare
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Two bugs made GetRecords unusable when multiple CSW profiles share one repository table (each row tagged by its typename column):
repository.query() accepted a typenames argument but never applied it, so a request scoped to one profile returned every row. It now filters on the typename column for specific, non-generic types; the csw:Record / csw30:Record wildcards still return all rows, leaving default and single-profile behaviour unchanged.
Filter/CQL property names always resolved against queryables['_all'], a flat merge in which the last-loaded profile wins, so profiles sharing a property name mapped to different columns resolved incorrectly. The new _scoped_queryables() overlays the requested typenames' queryables onto _all (returning _all verbatim for no/generic types). Applied to the GET and POST filter/CQL paths of both csw2.py and csw3.py.
Adds unit tests for the typename filter, including the wildcard and no-typename cases that must keep returning all rows.
Overview
When multiple CSW profiles share one repository table (each row tagged by its typename column), two bugs make GetRecords unusable when scoped to a specific profile typename:
Three unit tests cover the new typename filter: specific typename returns only matching rows, csw:Record wildcard returns all rows, and omitted typenames returns all rows.
Related Issue / Discussion
Fixes #1268
Additional Information
GetRecordById is not addressed here. The CSW 2.0.2 spec includes no typeNames parameter for that operation, so cross-profile record-by-ID resolution is out of scope for this fix.
Contributions and Licensing
(as per https://github.com/geopython/pycsw/blob/master/CONTRIBUTING.rst#contributions-and-licensing)