Skip to content

PartiQL execute_statement fails with KeyError when using Global Secondary Index syntax #9322

@DiarCyborg

Description

@DiarCyborg

Environment:

Moto version: 5.1.13 (latest)
py-partiql-parser version: 0.6.1 (dependency of Moto)
Python version: 3.9.21
OS: macOS
boto3/botocore: Latest compatible versions

Issue Description:

When executing PartiQL queries in DynamoDB using the execute_statement method with Global Secondary Index (GSI) syntax FROM table.index, the query fails with a KeyError in the py-partiql-parser library.

The issue is in the py-partiql-parser library's DynamoDBFromParser which treats TableName.lastChangedIndex as a single table name instead of recognising it as a GSI reference syntax.

This limitation prevents testing of applications that use PartiQL with GSI syntax, which is a valid and documented AWS DynamoDB feature. Applications using this syntax work correctly in production AWS but cannot be tested with Moto.

AWS Reference: SELECT * FROM "Music.GSI1" WHERE "GSI1PK" = 'A'
Link : https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/ql-reference.html

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions