Skip to content
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

model: add method to check if key is present in user_profile #501

Closed

Conversation

jrcastro2
Copy link
Contributor

Copy link
Contributor

@ntarocco ntarocco left a comment

Choose a reason for hiding this comment

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

Is this PR really needed? No other ways?

@has_key_in_profile.expression
def has_key_in_profile(cls, key):
"""SQL expression for filtering by presence of a key in the user_profile."""
return func.jsonb_extract_path_text(cls._user_profile, key).isnot(None)
Copy link
Contributor

Choose a reason for hiding this comment

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

Postgres only?

@jrcastro2
Copy link
Contributor Author

Is this PR really needed? No other ways?

Just thought we would prefere to filter it out when searching from the DB, not crucial, so we can simply do it in python. Closing this one as it's not anymore required. Thanks for the comment!

@jrcastro2 jrcastro2 closed this Nov 12, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

names vocab: allow names vocab to have 2 types of objects
2 participants