Skip to content

not boolean_column (None) is unexpected #232

@luckydonald

Description

@luckydonald

Hey, I'm havin unexpected behaviour with bool:

packs = orm.select(
        p for p in Pack if not p.nsfw
   )

Results in

SELECT "p"."url", "p"."title", "p"."nsfw", "p"."owner_id", "p"."first_seen", "p"."last_crawled", "p"."sticker_count"
FROM "pack" "p"
WHERE ("p"."nsfw")::int = 0

Which doesn't seem to cover the not None=>True case.

For postgres it could be like this Stackoverflow:

SELECT * FROM table_name WHERE (boolean_column IS NULL OR NOT boolean_column)

Indeed, a python workaround is:

p for p in Pack if p.nsfw is True or p.nsfw is None

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions