sqlc-dev / sqlc-gen-python

MIT License
154 stars 19 forks source link

SQLAlchemy generated insert statement rejected for MySQL #3

Open kyleconroy opened 2 years ago

kyleconroy commented 2 years ago

Version

1.10.0

What happened?

I am using MariaDB - maybe MySQL does not support ? syntax.

Relevant log output

sqlalchemy.exc.ProgrammingError: (pymysql.err.ProgrammingError) (1064, "You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near '?,\n    ?\n)' at line 11")

Database schema

No response

SQL queries

CREATE_TRAINING_ENTRY = """ 
INSERT INTO training (
    messageuuid,
    originalclass
) VALUES (
    ?,
    ?
)
"""

    def create_training_entry(self, arg: CreateTrainingEntryParams) -> None:
        self._conn.execute(
            sqlalchemy.text(CREATE_TRAINING_ENTRY),
            {
                "p1": arg.messageuuid,
                "p2": arg.originalclass,
            },
        )

Configuration

No response

Playground URL

No response

What operating system are you using?

macOS

What database engines are you using?

MySQL

What type of code are you generating?

Python