Skip to content

Attempting to filter_equal_dict with the wrong typed object produces an exception instead of gracefully returning nothing #142

@jasper-tms

Description

@jasper-tms

caveclient 5.18.0
python 3.10.8
MacOS


I have some code that is unexpectedly crashing because the following sorts of commands raise an exception:

client = CAVEclient('brain_and_nerve_cord')

# Trying to filter a str column using a bool
client.materialize.live_live_query(
    'cell_info',
    datetime.now(timezone.utc),
    filter_equal_dict={'cell_info': {'tag': True}})

# Trying to filter a bool column using a str
client.materialize.live_live_query(
    'backbone_proofread',
    datetime.now(timezone.utc),
    filter_equal_dict={'backbone_proofread': {'proofread': 'some tag'}})

I think it makes more sense in principle (and it definitely would be more useful for me in practice) if such an attempt to query while filtering using the wrong data type just returned nothing, instead of the sort of ugly error that's currently raised:

HTTPError: 500 Server Error: invalid input syntax for type boolean: "some tag"
LINE 4: WHERE backbone_proofread.proofread = 'some tag' AND backbone_proo...

(This might seem like an unusual command to want to run, but I'm trying to check whether a user-specified thing exists in any of a number of tables, so I loop over a few candidate tables and try doing this sort of filter to find said thing in said tables. My candidates include some str and some bool columns, hence the desire to be able to do this for both str and bool arguments without getting an exception when trying to query either str or bool columns.)

Thanks!

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