Skip to content

Bug: Incorrect SQL generated for UPSERT INTO ... SELECT #78

@makhalin

Description

@makhalin

Hi guys,

Thank you for the great work on this library.

I've encountered an issue where UPSERT INTO ... SELECT FROM generates invalid YQL. This also likely affects INSERT INTO ... SELECT. YDB supports this syntax natively (UPSERT docs, INSERT docs), but the generated query fails because it incorrectly includes the target table in the FROM clause.

Example of the faulty generated query:

UPSERT INTO my_table (col1, col2) 
SELECT my_table.col1, my_table.col2
FROM as_table(%(my_input)s), my_table

The extra my_table in the FROM clause and columns in brackets causes the query to fail. Could you please look into fixing the query generation logic?
Thanks for your help!

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