- assigned issue to
array_accum
Hello,
I use the array_accum function of PostgreSQL quite frequently and I noticed a small problem (bug ?) when convert_unicode is set to True on the engine layer. The result of an array_accum is converted to a Python list (by the psycopg2 driver I guess). The problem is that if you have a text column (char, varchar, ...), and thus the output is a list of strings in this case, those strings are not of type unicode, but of type str, for example :
>>> select([t.c.name](t.c.name)).execute().fetchone()
(u'Poisson-chat am\xe9ricain',)
>>> select([func.array_accum(t.c.name)](func.array_accum(t.c.name))).execute().fetchone()
([am\xc3\xa9ricain', 'Gib\xc3\xa8le', ...]('Poisson-chat),)
This is a bit problematic because you have to take this into account when you write things (and thus add an additional test). I tried type_=PGArray(Unicode) in the func() but the result is the same
Comments (4)
-
repo owner -
Account Deleted (original author: ants) Sorry, missed this during the holidays. Fixed in efb89f211319b19231260572422e4814639cace7.
-
Account Deleted (original author: ants) Oh, and for the func.array_accum case you'll still need the type_=PGArray(Unicode) param because SQLAlchemy doesn't know the return type of the function otherwise.
-
repo owner - removed milestone
Removing milestone: 0.4.3 (automated comment)
- Log in to comment
hoping ants has time to take a look at this, otherwise we'll try to get around to it.