python调用数据库报错_Python 同步数据库, mysql 报错 1064

8

303 天前

@wuwukai007 大佬报错了

res = fast_sql.to_sql(sql, from_db=con, to_db=to_db, if_exists='delete', mode='rw', to_table=table,

delete_cache=True, show_progress=True, )

Traceback (most recent call last):

File "/home/v2ex/PycharmProjects/test_project/app/util/syncdb.py", line 27, in syncdb

delete_cache=True, show_progress=False, )

File "/home/v2ex/.local/lib/python3.6/site-packages/fast_sql/__init__.py", line 360, in to_sql

parse_dates=parse_dates, columns=columns,

File "/home/v2ex/.local/lib/python3.6/site-packages/fast_sql/fastsql/sql.py", line 308, in rsync_db

self.decision()

File "/home/v2ex/.local/lib/python3.6/site-packages/fast_sql/fastsql/sql.py", line 274, in decision

self.write_db()

File "/home/v2ex/.local/lib/python3.6/site-packages/fast_sql/utils/common.py", line 94, in hander

raise e

File "/home/v2ex/.local/lib/python3.6/site-packages/fast_sql/utils/common.py", line 91, in hander

fun(*args, **kwargs)

File "/home/v2ex/.local/lib/python3.6/site-packages/fast_sql/fastsql/sql.py", line 372, in write_db

self.insert_db()

File "/home/v2ex/.local/lib/python3.6/site-packages/fast_sql/fastsql/sql.py", line 394, in insert_db

raise e

File "/home/v2ex/.local/lib/python3.6/site-packages/fast_sql/fastsql/sql.py", line 391, in insert_db

db.executemany(sql, df.values.tolist())

File "/home/v2ex/.local/lib/python3.6/site-packages/DBUtils/SteadyDB.py", line 605, in tough_method

result = method(*args, **kwargs) # try to execute

File "/home/v2ex/.local/lib/python3.6/site-packages/pymysql/cursors.py", line 197, in executemany

self._get_db().encoding)

File "/home/v2ex/.local/lib/python3.6/site-packages/pymysql/cursors.py", line 213, in _do_execute_many

v = values % escape(next(args), conn)

File "/home/v2ex/.local/lib/python3.6/site-packages/pymysql/cursors.py", line 122, in _escape_args

return tuple(conn.literal(arg) for arg in args)

File "/home/v2ex/.local/lib/python3.6/site-packages/pymysql/cursors.py", line 122, in

return tuple(conn.literal(arg) for arg in args)

File "/home/v2ex/.local/lib/python3.6/site-packages/pymysql/connections.py", line 467, in literal

return self.escape(obj, self.encoders)

File "/home/v2ex/.local/lib/python3.6/site-packages/pymysql/connections.py", line 460, in escape

return converters.escape_item(obj, self.charset, mapping=mapping)

File "/home/v2ex/.local/lib/python3.6/site-packages/pymysql/converters.py", line 27, in escape_item

val = encoder(val, mapping)

File "/home/v2ex/.local/lib/python3.6/site-packages/pymysql/converters.py", line 118, in escape_unicode

return u"'%s'" % _escape_unicode(value)

File "/home/v2ex/.local/lib/python3.6/site-packages/pymysql/converters.py", line 73, in _escape_unicode

return value.translate(_escape_table)

AttributeError: 'Timestamp' object has no attribute 'translate'

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值