我使用的SQLAlchemy当Postgres的有以下异常:SQLAlchemy的和无法适应
raise exc.DBAPIError.instance(statement, parameters, e, connection_invalidated=is_disconnect)
ProgrammingError: (ProgrammingError) can't adapt 'UPDATE doc_data SET content=%(content)s WHERE doc_data.serial_id = %(doc_data_serial_id)s' {'content': 'Programas de publicidad - Soluciones Empresariales - Todo acerca de Google - Google.com in English \xc2\xa92010 - Privacidad', 'doc_data_serial_id': 3181L, 'title': 'Google'}
文字是出现在www.google.com.ar(底部)的一个...“Progmas de publicidad - Soluciones Empresariales - 谷歌Google - Google.com ©2010 - Privacidad”。内容是unicode ....
的模型是:
class DocData(Data):
__tablename__ = 'doc_data'
serial_id = Column(Integer, ForeignKey('data.serial_id', ondelete='cascade'),
primary_key=True)
content = Column(UnicodeText)
和数据库是:
CREATE TABLE doc_data
(
serial_id integer NOT NULL,
"content" text
)
WITH (OIDS=FALSE);
的,为什么错误发生的任何想法?当对postgres进行相同的查询时,我得到一个警告:“提示:对转义使用转义字符串语法,例如E'\ r \ n'。”。 BUT我不明白为什么会发生这种情况,因为我正在使用该模型来进行查询,所以SQLALchemy(我认为)应该逃避事件。
在此先感谢
粘贴代码导致错误,否则就没有办法去发现为什么在查询占位符不匹配参数。 – 2010-01-19 11:48:39