Reputation: 129
i got this error:
sqlalchemy.exc.DBAPIError: (pyodbc.Error) ('HY004', '[HY004] [Microsoft][ODBC Microsoft Access Driver]Invalid SQL data type (67) (SQLBindParameter)')
[SQL: UPDATE table SET first=?, second=? WHERE table.id = ?]
[parameters: (('Test',), 'Test', 5)]
while running this code:
...
test = session.query(Table).filter(Table.test == test_var).first()
test.first = "Test",
test.second = "Test"
session.commit()
...
for Model:
class Table(Base):
__tablename__ = 'table'
id = Column(Integer, primary_key=True)
test = Column(String)
first = Column(String)
second = Column(String)
The first Parameter looks like a list, how could this happen and how can i fix this? This code already runs a few times without any issues, that's why i am confused about this.
Thx in advanced for your help.
Upvotes: 1
Views: 986
Reputation: 110
Did you intend to include a comma at the end of this line?
test.first = "Test",
I believe this is causing python to interpret test.first
as a tuple, which it cannot insert into the table since the table is expecting a string type.
Upvotes: 3