Hi there,

I have code that does this:

Session.query(Region). \
filter(Region.deleted==False). \
filter(Region.region_id.in_(from_statement_query))

Where "from_statement_query" is explicit SQL that returns only a region id.

The SQL that is produced by this code looks like:

SELECT region.region_id AS region_region_id, region.code AS region_code,
region.name AS region_name, region.parent_id AS region_parent_id,
region.deleted AS region_deleted
FROM region
WHERE region.deleted = %(deleted_1)s
AND region.region_id IN (
            select r2.region_id
            from region_user ru,  region r2
            where ru.user_id = %(user_id)s
            and ru.region_id = r2.region_id
      )

{'user_id': UUID('01aefd99-d00d-4e7e-ac38-3f30f1f07326'), 'deleted_1':
False}

Which, when I replace the placeholders with the values indicated, runs
perfectly well in psql.  However, SA is giving me the error:

"ProgrammingError: (ProgrammingError) can't adapt type 'UUID'"

The system is otherwise handling the UUID fields fine (they are in many
tables and we can query, update, fetch etc without issue) but not in the
case above.

Any ideas?

Thanks,
Kirk

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To post to this group, send email to sqlalchemy@googlegroups.com.
To unsubscribe from this group, send email to 
sqlalchemy+unsubscr...@googlegroups.com.
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en.

Reply via email to