Lighthouse has a new layout. Prefer the old one? Return to the old layout, and switch back any time from the link at the top of each page.

This project is archived and is in readonly mode.

support unicode strings in column list for copy_from()

#70

It would be a nice feature if the copy_from() method supported unicode strings. For example:

import psycopg2

conn = psycopg2.connect("host=192.168.0.33 user=chris password=postgres dbname=certified_mail_ccc")
cursor = conn.cursor()

cursor.execute("drop table if exists foo")
cursor.execute("create table foo (a varchar(100), b varchar(100))")

import StringIO
source = StringIO.StringIO()
source.write("foo\tbar")
source.seek(0)

# this does not work
#cursor.copy_from(source, "foo", null="None", columns=[u"a", u"b"])

# this does work
#cursor.copy_from(source, "foo", null="None", columns=["a", "b"])

Reported by Chris Curvey · September 16th, 2011 @ 03:12 PM

State: invalid
Milestone: none
Assigned to: nobody

Activity

  1. Daniele Varrazzo
    Daniele Varrazzo
    • State changed from new to invalid

    What psycopg version are you using?

    The current head works fine: the problem has been most likely fixed in Psycopg 2.3 one year ago.

    September 22nd, 2011 @ 09:10 AM