Issues

Issue #2940 resolved

postgresql ARRAY + UUID

Mike Bayer
repo owner created an issue

Comments (8)

  1. Mike Bayer reporter

    easy workarounds, and the per-connection should just be patched in to psycopg2 where hstore/json is and we're done:

    import psycopg2.extras
    psycopg2.extras.register_uuid()
    
    from sqlalchemy.engine import Engine
    from sqlalchemy import event
    
    @event.listens_for(Engine, "connect")
    def connect(dbapi_connection, connection_record):
       psycopg2.extras.register_uuid(None, dbapi_connection)
    
  2. Mike Bayer reporter
    • Repaired support for Postgresql UUID types in conjunction with the ARRAY type when using psycopg2. The psycopg2 dialect now employs use of the psycopg2.extras.register_uuid() hook so that UUID values are always passed to/from the DBAPI as UUID() objects. The :paramref:.UUID.as_uuid flag is still honored, except with psycopg2 we need to convert returned UUID objects back into strings when this is disabled. fixes #2940

    → <<cset b2189da65019>>

  3. Mike Bayer reporter
    • Repaired support for Postgresql UUID types in conjunction with the ARRAY type when using psycopg2. The psycopg2 dialect now employs use of the psycopg2.extras.register_uuid() hook so that UUID values are always passed to/from the DBAPI as UUID() objects. The :paramref:.UUID.as_uuid flag is still honored, except with psycopg2 we need to convert returned UUID objects back into strings when this is disabled. fixes #2940

    (cherry picked from commit b2189da65019ed2f44e77933a122619489319c5a)

    → <<cset 927f1cb95143>>

  4. Log in to comment