[sqlalchemy] Why is explicit 'and_' required for filter but not filter_by?

2007-09-13 Thread Ryan Fugger

In 0.4: Is there any reason that I (as far as i can tell) need an
explicit 'and_' to use multiple parameters with Query.filter, as
opposed to filter_by, where I don't need an explicit 'and_'?  I think
the latter is cleaner.

Ryan

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] ForeignKey + schema

2007-09-13 Thread Rick Morrison
SA 0.3* doesn't seem to handle relationships between tables in different
schemas very well:  it seems to think that

  schema.A -> public.B

   is:

  schema.A -> schema.B

and even specifying "primaryjoin=" in the mapper won't help it. There seems
to be no directive to say "use the default / primary schema"

(I'm using MSSQL, but I've seen very similar q's regarding both PG and
Oracle, so I suspect it's not a db-specific issue)


Just curious if there's been any work in this area on 0.4 in this area? I've
been avoiding jumping in to 0.4 so far, but this could be the issue that
gives me the push.

Thx,
Rick

--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Load Lazy Relation in Separate Thread

2007-09-13 Thread Koen Bok

Hi, I am doing some optimizations on our app, and one thing I was
wondering is if I can have a lazy relation loading in a separate
thread.

The way I'd like to use it is like this. I have a list with products,
and these products show a graph with stock levels. To draw this graph,
the object fetches it's relation stock. The stock object is built like
this:

SELECT
amount - (SELECT sum(qty) FROM orders WHERE
id_product=stock.id_product) as available
FROM stock
WHERE id_product=1234;

This is because we need to correct stock levels with the already
placed orders to get a good idea of availability.

This query takes fairly long (depending on the orders) so I'd like to
draw a gray bar initially, start a thread to fetch the stock object
and draw it once we have that result. Is this possible? If so, can
anyone give me a hint how to start?

Thanks,

Koen


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] db independent way to get id from sequence

2007-09-13 Thread che

Hi,

Are there any database independent way to get the id from some
sequence - for databases that supports it? For postgres this can be
done by issueing "select nextval('name_of_the_sequence')" statement,
but for other databases like oracle, firebird it is maybe different.
It seems that there is no such protocol in SA source, but maybe i am
missing something obvious.

I assume that to distinguish the databases that support sequences
metadata.bind.dialect.preexecute_sequences boolean can be used. am i
right?

regards,
stefan

p.s. currently i use the following code in postgres, but plan to use
something in other databases too:
sql = "select nextval('\"%s\"')" % name_of_the_sequence
oid =
db.connect().execute( sql.encode( db.dialect.encoding)).scalar()
print oid


--~--~-~--~~~---~--~~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---