我正在為 python (NoSQL) 使用 mysqlx XDevAPI。我無法在表格中插入日期。table = my_schema.get_table("date_table")field = "date_field"insert = table.insert(field)value = datetime.datetime.now()insert.values(value)insert.execute我得到一個錯誤:ValueError: Expected token type 19 at pos 0 but found type 72我假設(shè)它與日期/日期時間格式有關(guān),但我不確定如何找到標(biāo)記 19 或 72 是什么。如果我嘗試插入一個字符串或整數(shù),我會得到同樣的錯誤。
1 回答
互換的青春
TA貢獻(xiàn)1797條經(jīng)驗(yàn) 獲得超6個贊
是的。正如Rui所說,Connector/Python在X DevAPI中不支持Python對象轉(zhuǎn)換,您需要在插入之前將日期時間轉(zhuǎn)換為字符串格式。
添加回答
舉報
0/150
提交
取消
