Skip to content
This repository was archived by the owner on Aug 19, 2025. It is now read-only.
This repository was archived by the owner on Aug 19, 2025. It is now read-only.

Cannot use boolean in case function #302

Description

@psowa001

Hi,

I can not use True or False in case function as below

case([(table.c.item_id == None, False)], else_= True).label('saved')

it is showing me this error

File "asyncpg\protocol\protocol.pyx", line 181, in bind_execute
File "asyncpg\protocol\prepared_stmt.pyx", line 171, in asyncpg.protocol.protocol.PreparedStatementState._encode_bind_msg
asyncpg.exceptions.DataError: invalid input for query argument $3: False (expected str, got bool)

I tried to use it with sqlalchemy and it is correctly returning True/False values.

Is it some issue with postgres driver or database library?
I tried to replace True/False with 'True'/'False' and it is working.
Is there another way to return boolean values?

Kind regards

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions