[sqlalchemy] Re: MSSQL and LIMIT/OFFSET

2008-01-10 Thread Esceo
The hardest part I guess is when we encounter a _TextClause based order_by, assuming there is no builtin way to parse a _TextClause back down to column, table desc etc... On Jan 10, 6:47 pm, Esceo [EMAIL PROTECTED] wrote: Something more is probably needed. adding row_number will render a

[sqlalchemy] Re: MSSQL and LIMIT/OFFSET

2008-01-10 Thread Paul Johnston
Hi, adding row_number will render a distinct clause useless... Actually, this isn't a problem, as the distinct goes in an inner query, and the row_number is only in the outer query. I did have this mostly working, just need a final push to get it finished and committed. Paul

[sqlalchemy] Re: MSSQL and LIMIT/OFFSET

2008-01-10 Thread Esceo
Hi Paul, not quite, at least the patch above doesnt do that... Lei On Jan 10, 8:02 pm, Paul Johnston [EMAIL PROTECTED] wrote: Hi, adding row_number will render a distinct clause useless... Actually, this isn't a problem, as the distinct goes in an inner query, and the row_number is only

[sqlalchemy] Re: MSSQL and LIMIT/OFFSET

2008-01-10 Thread Esceo
soon to be attached is a slightly more involved patch (white space used is different from source), wraps the original query inside an alias _msr, and deals with TextClause based order_by as well... the order_by choosen for row_number over is oid in the case when there is no order_by specified,

[sqlalchemy] Re: MSSQL and LIMIT/OFFSET

2008-01-10 Thread lei you
patch is attached --~--~-~--~~~---~--~~ 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

[sqlalchemy] Re: MSSQL and LIMIT/OFFSET

2008-01-10 Thread Esceo
the other part of the patch is a rewrite of INSERT INTO (.+) \(\) VALUES \(\)$ (insertion of empty list of values) into INSERT INTO %s DEFAULT VALUES which is problematic when we insert into a table with only one field and it's identity On Jan 10, 9:43 pm, lei you [EMAIL PROTECTED] wrote:

[sqlalchemy] Re: Many to many and orphan deletion

2008-01-10 Thread Laurent Houdard
On Jan 9, 9:24 pm, Michael Bayer [EMAIL PROTECTED] wrote: So if I understand what youre looking to do here, youd like a keyword to be deleted when the last parent is removed ? That is exactly what I would like... if youd like to check for this condition after each flush you can do it

[sqlalchemy] SQLautocode 0.5.1 relased!

2008-01-10 Thread Simon Pamies
Hi, I'm very pleased to announce a new version of sqlautocode. It features many bugfixes and some refactored code. More information about sqlautocode: http://code.google.com/p/sqlautocode/ Special Thanks to Jason Kirtland - most of the refactoring and bugfixing was done by him! Simon Pamies

[sqlalchemy] Re: Many to many and orphan deletion

2008-01-10 Thread Laurent Houdard
On Jan 10, 4:00 pm, Michael Bayer [EMAIL PROTECTED] wrote: A statement issued in SessionExtension would fire unconditionally upon any flush(), so thats the trigger there. not sure what you mean by track here, if it means you want to know the keywords that were deleted, you'd just issue the

[sqlalchemy] Re: Many to many and orphan deletion

2008-01-10 Thread Michael Bayer
On Jan 10, 2008, at 6:51 AM, Laurent Houdard wrote: if youd like to check for this condition after each flush you can do it with SessionExtension, using after_flush(). it could be done in a single DELETE statement, i.e. delete from keywords where not exists(select 1 from

[sqlalchemy] Depreciation warning

2008-01-10 Thread Alexandre da Silva
Sorry previous message, I've pressed a magic combination keys here and message was sent. however The least problem with the warning is that it not inform what table and column are wrong the traceback returns:

[sqlalchemy] Re: Many to many and orphan deletion

2008-01-10 Thread Laurent Houdard
how about, go into sessionextension.after_flush(), make a new session local to the operation, issue a Query with the Select for all orphan keywords, delete them all and flush that sub-session, then expunge() those keywords from the parent session sent to after_flush, like this: [...]

[sqlalchemy] Re: Depreciation warning

2008-01-10 Thread Michael Bayer
sure ive reopened 912 again so we can add that On Jan 10, 2008, at 11:04 AM, Alexandre da Silva wrote: Sorry previous message, I've pressed a magic combination keys here and message was sent. however The least problem with the warning is that it not inform what table and column

[sqlalchemy] Doing a dynamic Update

2008-01-10 Thread Mike
Hi, I just started trying to figure out SQLAlchemy today as I was hoping to translate my current SQL queries into a database agnostic format. I admit that this OO way is kind of confusing to me. Anyway, my question is how do I translate the following SQL statement into SQLAlchemy format? sql =

[sqlalchemy] Re: Doing a dynamic Update

2008-01-10 Thread Rick Morrison
For a stepwise migration from raw, SQL, it will probably be easier to get your mind around the SQL-expression side of the library, and then adopt ORM features as you feel comfortable with them. On the SQL-expression side of the library, you'll find that your Table() object has a collection called

[sqlalchemy] Get default value

2008-01-10 Thread Alexandre da Silva
Hello all, is there a way that I can get the default value defined on Column(default=something) ? the default I get is a ColumDefault, and I don't know how to get it's value. any suggestion? -- Alexandre da Silva Analista de Sistemas - Bacharel em Sistemas de Informação (2003-2007)

[sqlalchemy] Re: Get default value

2008-01-10 Thread Rick Morrison
Isn't it just column.default ? --~--~-~--~~~---~--~~ 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] Re: Get default value

2008-01-10 Thread Rick Morrison
Ah, I read too fast, you are getting back the ColumnDefault object try column.default.arg --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this group, send email to

[sqlalchemy] Re: Get default value

2008-01-10 Thread jason kirtland
Alexandre da Silva wrote: Hello all, is there a way that I can get the default value defined on Column(default=something) ? the default I get is a ColumDefault, and I don't know how to get it's value. any suggestion? The value is in its .arg property: col.default.arg

[sqlalchemy] Re: Get default value

2008-01-10 Thread Alexandre da Silva
Em Qui, 2008-01-10 às 17:13 -0800, jason kirtland escreveu: col.default.arg Yes, exactly this. another question How many levels I can inherit classes/tables without get something wrong? let me show a simplest sample hierarchy: resource / \

[sqlalchemy] Exclude Autogenerated Timestamp Column

2008-01-10 Thread deanH
Hello, I am having a problem inserting an object into a MS SQL table that contains a timestamp field (now) that is generated automatically - sqlalchemy is defaulting this column to None and when it is generating the SQL insert. Is there a way to configure the mapper so that it ignores specific

[sqlalchemy] Re: Get default value

2008-01-10 Thread Rick Morrison
You're mixing single-table inheritance (using the discriminator column), with concrete inheritance (using multiple tables). You have to pick one scheme or the other. Either use a single inheritance chain, or separate the two class hierarchies into two separate chains that don't inherit from each

[sqlalchemy] Re: Exclude Autogenerated Timestamp Column

2008-01-10 Thread Rick Morrison
I'm not sure I understand what you're looking for...you want the column to remain NULL after an insert? Then take off the default from the column definition and make it a datetime field instead of a timestamp. On Jan 10, 2008 9:15 PM, deanH [EMAIL PROTECTED] wrote: Hello, I am having a

[sqlalchemy] Re: Get default value

2008-01-10 Thread Alexandre da Silva
Em Qui, 2008-01-10 às 21:20 -0500, Rick Morrison escreveu: You're mixing single-table inheritance (using the discriminator column), with concrete inheritance (using multiple tables). You have to pick one scheme or the other. Either use a single inheritance chain, or separate the two class

[sqlalchemy] Re: Get default value

2008-01-10 Thread Alexandre da Silva
Em Qui, 2008-01-10 às 21:20 -0500, Rick Morrison escreveu: You're mixing single-table inheritance (using the discriminator column), with concrete inheritance (using multiple tables). You have to pick one scheme or the other. Either use a single inheritance chain, or separate the two class

[sqlalchemy] Re: MSSQL and LIMIT/OFFSET

2008-01-10 Thread Esceo
There is some part in the patch which modifies the aliased_select method global (global for the visit_select method) that didn't quite work out, the locals()['aliased_select'] part the solution was to put aliased_select inside an array... The need to modify aliased_select comes in because we

[sqlalchemy] polymorphic inheritance

2008-01-10 Thread Alexandre da Silva
Hello all, sa developers, is too dificult try to implement inheritance works by that form? I don't know the SA core, so I think is no so difficult to make this working. for now, I accept this code changed to work properly, as it works removing the session.clear() thank's a lot

[sqlalchemy] Re: Get default value

2008-01-10 Thread sdobrev
How many levels I can inherit classes/tables without get something wrong? my tests go to 4, all works. And as all corner cases are already there, i guess any level above will work too. mixed inheritance (joined+concrete) also can be made to work, as long as polymoprhic_union() is fixed