Skip to content

Missing support for boolean field or examples of how to do it #193

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

Closed
sriveros95 opened this issue Apr 6, 2022 · 5 comments · Fixed by #611
Closed

Missing support for boolean field or examples of how to do it #193

sriveros95 opened this issue Apr 6, 2022 · 5 comments · Fixed by #611
Assignees
Labels
enhancement New feature or request

Comments

@sriveros95
Copy link

I have a model like
MyModel(HashModel): local_auth: bool
When initing or saving I get:
DataError("Invalid input of type: 'bool'. Convert to a bytes, string, int or float first.")

@simonprickett
Copy link
Contributor

Hi there - boolean fields aren't yet supported for JSON or Hash, they'll likely appear in JSON first as boolean is a native type there vs a Redis Hash that understands strings, floats and ints.

@simonprickett
Copy link
Contributor

I'm talking to the maintainers of the other Redis OM Clients for different languages to make sure that when we do add booleans to Python there's a common approach where possible.

@jrwagz
Copy link

jrwagz commented Jul 18, 2023

@simonprickett , any update on native support for boolean fields?

@simonprickett
Copy link
Contributor

@jrwagz I don't have an update here, copying in @dvora-h

@juandaherrera
Copy link

Hey! Is there maybe a way to include it in the hash and have the library convert and store it as an integer behind the scenes? It would be super helpful to work with booleans in these cases instead of requiring users to pass integers directly.

CC: @simonprickett @dvora-h @slorello89

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants