mercredi 8 juillet 2015

Why is there a Decimal() when I try to INSERT a row with SQLAlchemy in a sqlite database?

I use SQLAlchemy with Python3 and sqlite3.

I tried to add() and new object into a sqlite database and got this error message.

sqlalchemy.exc.InterfaceError: (sqlite3.InterfaceError)
Error binding parameter 3 - probably unsupported type.
SQL: 'INSERT INTO "TrainingUnit"
(oid, "order", date, level, sets, repetitions, machine)
VALUES (?, ?, ?, ?, ?, ?, ?)']
[parameters: (6, 0, '2014-12-12', Decimal('75'), None, None, 1)]

I understand that "parameter 3" means the fourth one because the counting begins with 0. I think the problem here is the Decimal(). I don't understand why SQLAlchemy add this here?

The scheme itself is generated automaticly from SQLA with that statement

CREATE TABLE "TrainingUnit" (
        oid INTEGER NOT NULL, 
        "order" INTEGER, 
        date DATE, 
        level INTEGER, 
        sets INTEGER, 
        repetitions INTEGER, 
        machine INTEGER, 
        PRIMARY KEY (oid), 
        FOREIGN KEY(machine) REFERENCES "Machine" (oid)
)

Aucun commentaire:

Enregistrer un commentaire