代码 820 行为 db.session.commit()
错误代码
Traceback (most recent call last):
File "/home/app_sandbox/api/api-service/
app.py", line 820, in new_order
db.session.commit()
File "/usr/local/lib/python3.6/site-packages/sqlalchemy/orm/
scoping.py", line 162, in do
return getattr(self.registry(), name)(*args, **kwargs)
File "/usr/local/lib/python3.6/site-packages/sqlalchemy/orm/
session.py", line 1027, in commit
self.transaction.commit()
File "/usr/local/lib/python3.6/site-packages/sqlalchemy/orm/
session.py", line 494, in commit
self._prepare_impl()
File "/usr/local/lib/python3.6/site-packages/sqlalchemy/orm/
session.py", line 473, in _prepare_impl
self.session.flush()
File "/usr/local/lib/python3.6/site-packages/sqlalchemy/orm/
session.py", line 2459, in flush
self._flush(objects)
File "/usr/local/lib/python3.6/site-packages/sqlalchemy/orm/
session.py", line 2597, in _flush
transaction.rollback(_capture_exception=True)
File "/usr/local/lib/python3.6/site-packages/sqlalchemy/util/
langhelpers.py", line 68, in __exit__
compat.reraise(exc_type, exc_value, exc_tb)
File "/usr/local/lib/python3.6/site-packages/sqlalchemy/util/
compat.py", line 153, in reraise
raise value
File "/usr/local/lib/python3.6/site-packages/sqlalchemy/orm/
session.py", line 2557, in _flush
flush_context.execute()
File "/usr/local/lib/python3.6/site-packages/sqlalchemy/orm/
unitofwork.py", line 422, in execute
rec.execute(self)
File "/usr/local/lib/python3.6/site-packages/sqlalchemy/orm/
unitofwork.py", line 589, in execute
uow,
File "/usr/local/lib/python3.6/site-packages/sqlalchemy/orm/
persistence.py", line 245, in save_obj
insert,
File "/usr/local/lib/python3.6/site-packages/sqlalchemy/orm/
persistence.py", line 1138, in _emit_insert_statements
statement, params
File "/usr/local/lib/python3.6/site-packages/sqlalchemy/engine/
base.py", line 988, in execute
return meth(self, multiparams, params)
File "/usr/local/lib/python3.6/site-packages/sqlalchemy/sql/
elements.py", line 287, in _execute_on_connection
return connection._execute_clauseelement(self, multiparams, params)
File "/usr/local/lib/python3.6/site-packages/sqlalchemy/engine/
base.py", line 1107, in _execute_clauseelement
distilled_params,
File "/usr/local/lib/python3.6/site-packages/sqlalchemy/engine/
base.py", line 1248, in _execute_context
e, statement, parameters, cursor, context
File "/usr/local/lib/python3.6/site-packages/sqlalchemy/engine/
base.py", line 1468, in _handle_dbapi_exception
util.reraise(*exc_info)
File "/usr/local/lib/python3.6/site-packages/sqlalchemy/util/
compat.py", line 153, in reraise
raise value
File "/usr/local/lib/python3.6/site-packages/sqlalchemy/engine/
base.py", line 1244, in _execute_context
cursor, statement, parameters, context
File "/usr/local/lib/python3.6/site-packages/sqlalchemy/engine/
default.py", line 552, in do_execute
cursor.execute(statement, parameters)
File "/usr/local/lib64/python3.6/site-packages/MySQLdb/
cursors.py", line 202, in execute
args = tuple(map(db.literal, args))
File "/usr/local/lib64/python3.6/site-packages/MySQLdb/
connections.py", line 271, in literal
s = self.escape(o, self.encoders)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 11-12: ordinal not in range(128)
'ascii' codec can't encode characters in position 11-12: ordinal not in range(128)