getmoto / py-partiql-parser

Python Parser for PartiQL
MIT License
7 stars 2 forks source link

Unsupported type BOOL True/False #10

Closed tmottershead closed 5 months ago

tmottershead commented 11 months ago

Hi,

Thanks for this useful tool! I have some BOOL values stored in my moto DynamoDB table and when I select using PartiQL I get errors of the form:

TypeError: Unsupported type "<class 'py_partiql_parser._internal.json_parser.Variable'>" for value "<True>"

One of the attributes in my table includes e.g.

{ 'catchup': {'BOOL': True }} or { 'catchup': {'BOOL': False }}

I am successfully inserting into the mocked table with boto3.resource('dynamodb').put_item() which serializes a Python dict to DynamoDB JSON. Data being passed to boto3.resource('dynamodb').put_item() {'id': 'record-1', 'arguments': {'schedule': '0 20 * * *', 'catchup': True, 'default_args_overrides': {'start_date': '2023-12-06', 'depends_on_past': False}, 'additional_tags': ['XXX', 'YYY']}, 'run_zzz': True}

Date being received by boto3.client('dynamodb').get_item() {'id': {'S': 'record-1'}, 'arguments': {'M': {'schedule': {'S': '0 20 * * *'}, 'catchup': {'BOOL': True}, 'default_args_overrides': {'M': {'start_date': {'S': '2022-12-06'}, 'depends_on_past': {'BOOL': False}}}, 'additional_tags': {'L': [{'S': 'XXX'}, {'S': 'YYY'}]}}}, 'run_zzz': {'BOOL': True}}

But I get TypeError when running SELECT * FROM <table> in PartiQL.

bblommers commented 11 months ago

Hi @tmottershead! I've just released version 0.3.8 with improved support for booleans. Can you verify that this fixes your problem?

tmottershead commented 11 months ago

Awesome, that's fixed the BOOL issue I think. Thanks for that. I'm now having some other issues:

Something not quite right about the structure I'm getting back but I haven't been able to investigate fully.

bblommers commented 11 months ago

Can you share a minimal test case that reproduces the issues you're seeing?

bblommers commented 5 months ago

I'm going to close this, but feel free to open a new issue if you're still running into any issues with the latest release.