Engine.execute() and Engine.text() return string columns as str despite convert_unicode=True

Issue #1120 resolved
Former user created an issue

When creating an engine with convert_unicode=True, Engine.execute() and Engine.text() return any string columns as str objects, while the equivalent Table.select() returns these columns as unicode objects. Tested this on sqlite and Postgres, the problem only occurs with Postgres.

Comments (2)

  1. Mike Bayer repo owner

    result types need to be specified for text():

    result = engine.execute(text(
                """
                SELECT content FROM test
                """,
                typemap={'content':sa.String()},
        )).fetchall()
    
  2. Log in to comment