RE: [sqlalchemy] Re: open session blocks metadata create_all method

2010-07-29 Thread King Simon-NFHD78
On Wed, 28 Jul 2010 15:17:09 +0530 (IST), Faheem Mitha fah...@email.unc.edu wrote: Hi, When calling create_all on a metadata instance after a session has alrady been opened causes the create_all to hang, I assume because the session is blocking the create_all. Is there

[sqlalchemy] Support for Common Table Expressions (CTE)?

2010-07-29 Thread phrrn...@googlemail.com
Is there any support yet in SQLAlchemy for Common Table Expressions e.g. WITH foo(blurp, bletch) AS (SELECT bar*2, bletch from banana where bletch 3) SELECT f.* FROM foo as f where blurp 1 I have not been following SA development for some months (due to a job move) so I am not yet up to speed

[sqlalchemy] error:Could not determine relationship direction for primaryjoin condition

2010-07-29 Thread robert rottermann
hi there i get an error: Could not determine relationship direction for primaryjoin condition 'cisdata.`ID_cis` = cisbr.`ID_cisbr`', on relationship Branchen.branche. Do the columns in 'foreign_keys' represent only the 'foreign' columns in this join condition ? when I use the following

[sqlalchemy] Re: open session blocks metadata create_all method

2010-07-29 Thread Faheem Mitha
On Thu, 29 Jul 2010 11:36:43 +0100, King Simon-NFHD78 simon.k...@motorola.com wrote: You can tell meta.create_all() to use the same underlying DB connection as the session by using the session.connection() method with the 'bind' parameter to create_all(). Ie. connection =

Re: [sqlalchemy] Re: open session blocks metadata create_all method

2010-07-29 Thread Wichert Akkerman
On 7/29/10 17:18 , Faheem Mitha wrote: Hi Simon, Thanks. Do you understand why this blocking takes place? I assume by default create_all tries to make a different connection, and fails for some reason? My guess is that it does not fail, but your database is blocking the create_all statements

[sqlalchemy] User DataType for casting

2010-07-29 Thread Kent
I'm using an Oracle legacy database and can't add a primary key to a table with none, so I am using ROWID as the primary key so sqlalchemy has a unique id. I'm also using (attempting to use) this table pornographically (Concrete Table Inheritance). The trouble I'm having is that Oracle complains

[sqlalchemy] Re: User DataType for casting

2010-07-29 Thread Kent
Oops! I didn't check my spell checker closely I meant 'polymorphically' not 'pornographically'!! -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this group,

[sqlalchemy] Re: User DataType for casting

2010-07-29 Thread Kent
I worked out this solution: class RowID(Unicode): def _compiler_dispatch(self, type_): return ROWID Please let me know if there are any obvious implications that I may have overlooked. Thanks -- You received this message because you are subscribed to the Google Groups sqlalchemy

Re: [sqlalchemy] Re: User DataType for casting

2010-07-29 Thread Michael Bayer
the idiomatic solution would be: class RowID(Unicode): pass from sqlalchemy.ext.compiler import compiles @compiles(RowId): def compile_rowid(compiler, element, **kw): return ROWID we should add ROWID to the oracle dialect. On Jul 29, 2010, at 12:54 PM, Kent wrote: I worked out this

[sqlalchemy] window functions

2010-07-29 Thread ellonweb
Hi, just wondering if there's support for window functions, or if there's any plans to add this yet? Thanks -- You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to sqlalch...@googlegroups.com. To unsubscribe from this

[sqlalchemy] Polymorphic union of two sibling classes (no real inheritance)

2010-07-29 Thread Kent
I'm getting a messy error that could be a bug, but is very likely related to my setup of a set of 2 polymorphic classes I am attempting to map. One entity is a transaction and the other is a transaction_archive record. The table structure is therefore very similar for both tables and it seems to

Re: [sqlalchemy] Re: open session blocks metadata create_all method

2010-07-29 Thread Kyle Schaffrick
On Thu, 29 Jul 2010 15:18:33 + (UTC) Faheem Mitha fah...@email.unc.edu wrote: On Thu, 29 Jul 2010 11:36:43 +0100, King Simon-NFHD78 simon.k...@motorola.com wrote: You can tell meta.create_all() to use the same underlying DB connection as the session by using the session.connection()

Re: [sqlalchemy] window functions

2010-07-29 Thread Michael Bayer
it is a TODO as ticket #1844. You can implement with the compiler extension for now. On Jul 29, 2010, at 2:22 PM, ellonweb wrote: Hi, just wondering if there's support for window functions, or if there's any plans to add this yet? Thanks -- You received this message because you are

Re: [sqlalchemy] Polymorphic union of two sibling classes (no real inheritance)

2010-07-29 Thread Michael Bayer
On Jul 29, 2010, at 2:31 PM, Kent wrote: I'm getting a messy error that could be a bug, but is very likely related to my setup of a set of 2 polymorphic classes I am attempting to map. One entity is a transaction and the other is a transaction_archive record. The table structure is

Re: [sqlalchemy] Polymorphic union of two sibling classes (no real inheritance)

2010-07-29 Thread Kent Bower
No, in fact, there is no ArTranBase table at all. If I remove concrete inheritance, how do I issue a UNION of the two tables and have the objects polymorphically loaded? On 7/29/2010 4:18 PM, Michael Bayer wrote: On Jul 29, 2010, at 2:31 PM, Kent wrote: I'm getting a messy error that

[sqlalchemy] Re: Polymorphic union of two sibling classes (no real inheritance)

2010-07-29 Thread Kent
This seems to work, but I didn't find examples of this. Does this look correct (assuming there is no parent table in the database and all I really want is 2 'normal' mappers and a 3rd that performs a polymorphoric_union)? == artran_union =

Re: [sqlalchemy] Re: Polymorphic union of two sibling classes (no real inheritance)

2010-07-29 Thread Michael Bayer
What I meant was, if you want to say session.query(ArTranBase), which it appears that you do, then you are querying against ArTranBase. Since it seems like you want the polymorphic_union here, when you query ArTranBase and you want it to eagerly load trancode and paymenttype, it would need

Re: [sqlalchemy] Re: Polymorphic union of two sibling classes (no real inheritance)

2010-07-29 Thread Kent Bower
Right. I understand. Thanks for pointing that out, you are correct. My bigger concern was getting the ArTranBase mapper correct. Apparently there is no need in this case to specify with_polymorphic= in the mapper. Did I miss documentation on using 'polymorphic_union' without

Re: [sqlalchemy] Re: Polymorphic union of two sibling classes (no real inheritance)

2010-07-29 Thread Michael Bayer
On Jul 29, 2010, at 5:00 PM, Kent Bower wrote: Right. I understand. Thanks for pointing that out, you are correct. My bigger concern was getting the ArTranBase mapper correct. Apparently there is no need in this case to specify with_polymorphic= in the mapper. Did I miss

[sqlalchemy] Re: Support for Common Table Expressions (CTE)?

2010-07-29 Thread phrrn...@googlemail.com
I see that a ticket has just been opened up on this topic. http://www.sqlalchemy.org/trac/ticket/1859 I will follow up there. thanks, pjjH On Jul 29, 8:33 am, phrrn...@googlemail.com phrrn...@googlemail.com wrote: Is there any support yet in SQLAlchemy for Common Table Expressions e.g.

Re: [sqlalchemy] Re: Support for Common Table Expressions (CTE)?

2010-07-29 Thread Michael Bayer
oh weird, someone asked about window functions, and I got the two kind of confused and responded to that person but not to you. On Jul 29, 2010, at 6:43 PM, phrrn...@googlemail.com wrote: I see that a ticket has just been opened up on this topic. http://www.sqlalchemy.org/trac/ticket/1859

[sqlalchemy] Re: What is a good pattern for using sqlalchemy+psycopg2+gevent in a pylons app

2010-07-29 Thread afrotypa
Sorry I wasnt monitoring this thread. Didnt get a response right away and thought no one had responded. I also think that theoretically there really would be not much of a change to using sqlalchemy (within pylons - pylons already creates a scopedsession object for every web request anyhow) in a

[sqlalchemy] Assigning column defaults after definition?

2010-07-29 Thread Russell Warren
I've got a bunch of old sqlalchemy code using the declarative framework where the default field values could be assigned after the initial definition, as in this reduced example: ### from sqlalchemy import * from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import

Re: [sqlalchemy] Assigning column defaults after definition?

2010-07-29 Thread Michael Bayer
On Jul 29, 2010, at 11:08 PM, Russell Warren wrote: I've got a bunch of old sqlalchemy code using the declarative framework where the default field values could be assigned after the initial definition, as in this reduced example: ### from sqlalchemy import * from

[sqlalchemy] how to use primary/secondary join when there are no foreign keys

2010-07-29 Thread robert rottermann
hi there I would like to define a m:n relation between two tables that are linked by an association table. I am using MySQL 5.1 and SA 0.6.3 this is the select that I want to implement: select * from cisdata c, cisbr cb branchen b, where c.ID_cis = cb.ID_cisbr and cb.ID_br