我使用的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