-
Notifications
You must be signed in to change notification settings - Fork 10
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
Add support for glob/regex filtering on NestedAsset
list endpoint
#1022
Conversation
95786df
to
bed134f
Compare
What exactly from the translation is incompatible with Postgres? I'd hope that any differences are minor and could be addressed directly. I'd rather not pull in an obscure 3rd party library if it's not necessary. |
|
It seems to me a lot of this has to do with regex modes and differences with chars used. For example, the re.sub(r'\(\?s?m?:([^\)]+)\)\\Z', r'^\1$', glob) This essentially removes the |
I don't love either including that library (even if it seems to be harmless) or this homebrew regex (even if we could write tests for it). The docs for fnmatch.translate imply that the globbing star is just converted to |
I think it's worth testing out at least. For the record, |
bed134f
to
364c2b6
Compare
364c2b6
to
2c50b3d
Compare
Agreed that @waxlamp's solution is cleaner. I tested it and it seems to work perfectly, I'll update this to do it that way 👍 |
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.
Just one request otherwise looks good
@mvandenburgh it seems the |
I assumed it was a fluke because I'm not seeing it when I run tests locally, but it happened again when I reran the job 😕 |
51a76b9
to
fa2d3f4
Compare
🚀 PR was released in |
Closes #1002.
Note that Postgres doesn't support querying with globs, but it does support querying with a regex. So, the approach I've taken to support globbing here is to convert the glob pattern to a regex pattern and then use that in the query. Python has a built-in function (
fnmatch.translate
) that converts a glob expression to a regex, but the regex syntax it uses is incompatible with Postgres's regex syntax. I found this 81-line library that does work with Postgres, so I've used that here.