I would like to generate this query:
SELECT a.pk, aa.response
FROM attendee as a
JOIN field as f on f.conference_pk = a.conference_pk
LEFT JOIN attendee_answer as aa ON aa.field_pk = f.pk
AND aa.attendee_pk = a.pk;
Using the ORM, I came up
Hi all,
I'm experimenting a bit with postgresql arrays of uuid's.
Unfortunately I'm running into a bug or I'm not really understanding
it :-)
My schema definition is as follow:
table = Table('example', metadata,
Column('timestamp', DateTime(timezone=False), primary_key=True),
Hi all,
I'm experimenting a bit with postgresql arrays of uuid's.
Unfortunately I'm running into a bug or I'm not really understanding
it :-)
My schema definition is as follow:
table = Table('example', metadata,
Column('timestamp', DateTime(timezone=False), primary_key=True),
On Jan 2, 2013, at 8:33 AM, John Anderson wrote:
I would like to generate this query:
SELECT a.pk, aa.response
FROM attendee as a
JOIN field as f on f.conference_pk = a.conference_pk
LEFT JOIN attendee_answer as aa ON aa.field_pk = f.pk
On Wednesday, January 2, 2013 1:39:28 PM UTC-3, Michael Bayer wrote:
On Jan 2, 2013, at 8:33 AM, John Anderson wrote:
I would like to generate this query:
SELECT a.pk, aa.response
FROM attendee as a
JOIN field as f on f.conference_pk = a.conference_pk
On Jan 2, 2013, at 11:53 AM, John Anderson wrote:
you can specify the columns:
q = session.query(Attendee.pk, AttendeeAnswer.response)...
Is there a way to do Attendee.*, AttendeeAnswer.response instead of listing
all individually?
It should work if you put the Table object in
Thanks for the detailed response! Inserting the values seems to work
fine now. Only retrieving them again doesn't work.
I've updated the gist at https://gist.github.com/4433940
The problem seems that psycopg2 now returns the array as a string
({uuid1, uuid2}) and sqlalchemy iterates over the
psycopg2 does have some adapters for this:
http://initd.org/psycopg/docs/extras.html?highlight=uuid#uuid-data-type
ideally using those would work transparently with ARRAY types, but its not
clear if they do or not. They should, or if not you'd probably need to
build a more comprehensive
Again, thanks for the detailed response! I went with the
psycopg2.extras.register_uuid() method and that works without problems
for now.
I did have to remove the as_uuid=True since psycopg2 already returned
it as an uuid type.
For future references the working test code is here
that adapter works both ways, so you can drop the custom type completely:
table = Table('example_2', metadata,
Column('timestamp', DateTime(timezone=False), primary_key=True),
Column('num', Integer),
Column('guids', ARRAY(UUID, dimensions=1))
)
On Jan 2, 2013, at 2:10 PM, Michael
I'm starting to work with an existing MySQL setup, where there's a master
database (or, effectively, schema, it is all within one MySQL instance)
with tables of general usefulness, and separate schemas for each specific
project. So there is a table master.users with all the basic information
Hi all,
I need to use in_(), but in oracle it has a limit of 1000 values,
there's an alternative syntax that can be used successful in oracle and
it is:
(field,-1) in ( (123,-1), (333,-1), ... )
I tryed this:
session.query(Mytable).filter((Mytable.c.id,-1).in_([(123,-1),(333,-1)]) )
12 matches
Mail list logo