-
Notifications
You must be signed in to change notification settings - Fork 434
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
feat: add EXISTS/NOT_EXISTS query option for specific tags filter #697
Conversation
@mlabouardy After a lot of experimenting with the queries for the NOT_EXISTS filter, I've decided to go with this solution, as it covers what we need. I've just one problem with it now, when applied the filter shows the correct results for all resources, that have tags except the one in the filter. But the Just to clarify, this: SELECT
resources.id,
resources.resource_id,
resources.tags
FROM
resources
CROSS JOIN json_each(tags)
WHERE
TYPE = 'object'
AND(NOT EXISTS (
SELECT
1 FROM json_each(resources.tags)
WHERE (json_extract(value, '$.key') = 'Author')))
ORDER BY
resources.id
LIMIT 50 OFFSET 0 shows all resources, that have tags but only if none of the keys is And this: SELECT
resources.id,
resources.resource_id,
resources.tags
FROM
resources
WHERE
NOT EXISTS (
SELECT
1 FROM json_each(resources.tags)
WHERE (json_extract(value, '$.key') = 'Author'))
ORDER BY
resources.id
LIMIT 50 OFFSET 0 shows all resources, that don't have the The |
dashboard/components/inventory/components/filter/InventoryFilterOperator.tsx
Show resolved
Hide resolved
Yes its the expected behavior and |
@mlabouardy I added a "SELECT DISTINCT" now to filter out the duplicates. But I am really hesitant to introduce yet another |
This PR adds two new filters for specific tags, the
does exist/EXISTS
anddoes not exist/NOT_EXISTS
filters. TheEXISTS
filter checks if a given tag key is present in a row, respectivelyNOT_EXISTS
returns all rows that do not have that key present.