[Twisted-Python] adbapi, PostgreSQL and Unicode
Matt Goodall
matt at pollenation.net
Wed May 11 08:51:28 EDT 2005
Michal Eldar wrote:
> I keep getting - Unhandled error in Deferred
You should attach an errback to the deferred and handle, or at least
log, the exception. That's what "Unhandled error in Deferred" means ;-).
>
> I'm trying to perform an INSERT on my db (using adbapi with *pgdb*
> module).
> INSERT which comprises *Unicode* string
> e.g. -
> unicodeChar1 = u"Character=[\N{GREEK CAPITAL LETTER GAMMA}]"
>
> the db is defined to Unicode
> *client_encoding* value is set to *Unicode* when checking its value in
> *cp_openfun *called function
> execute the same INSERT directly with *pgdb *works great
>
> Does anyone has experience with adbapi with Unicode db ?!?!
Yes, but only using psycopg and pgasync. It works fine for me.
> Do I need to define something special for this to happen ??
You shouldn't need to. adbapi is nothing more that a wrapper around the
real (blocking) database module that dispatches db calls to a thread.
Attach the errback first and find out what the exception actually is
before trying to fix anything. It could be something as simple as a typo
that you haven't spotted or it could be something subtle. It's
impossible to know at this stage.
I suspect you're building the a complete SQL string and passing that to
execute() when you should be passing a SQL string with insertion markers
and a tuple/dict of args. But, that's just a guess ;-).
Hope this helps.
Cheers, Matt
--
__
/ \__ Matt Goodall, Pollenation Internet Ltd
\__/ \ w: http://www.pollenation.net
__/ \__/ e: matt at pollenation.net
/ \__/ \ t: +44 (0)113 2252500
\__/ \__/
/ \ Any views expressed are my own and do not necessarily
\__/ reflect the views of my employer.
More information about the Twisted-Python
mailing list