[sqlalchemy] Re: foreign key info lost across metadata pickling?

2011-11-07 Thread botz
les['a'] > b2 = m2.tables['b'] > > assert b2.c.y.references(a2.c.x) > assert not b2.c.y.references(a2.c.z) > > On Nov 5, 2011, at 7:30 AM, Michael Bayer wrote: > > > > > > > > > can you provide a very simple and pared down test case using table metadata

[sqlalchemy] foreign key info lost across metadata pickling?

2011-11-05 Thread botz
version 0.7.3. I have tables with foreign keys defined, and the orm mapping (with relationships corresponding to the foreign keys) works fine with autoload=True on the tables. If I persist the metadata then with pickle, and then reload the app using pickled metadata and autoload=False, I get the

[sqlalchemy] Re: using window functions in expressions

2011-04-15 Thread botz
Yeah SQL 2003 standard says no comma between window specification details generally, and postgresql, oracle at least aren't expecting it. (ansi 2003 draft:) 7.11 ... ::= [ ] [ ] [ ] [ ] ::= PARTITION BY ... ::= [ ] ::= ORDER BY etc. On Apr 14, 10:14 pm, botz

[sqlalchemy] Re: using window functions in expressions

2011-04-14 Thread botz
Great, thanks for the quick fix. Found another minor bug with the window functions, syntax should be ( partition by x order by y) not ( partition by x, order by y) ... at least for postgresql. On Apr 14, 8:51 pm, botz wrote: > Here's a quick example: > > the query form i&#

[sqlalchemy] using window functions in expressions

2011-04-14 Thread botz
Here's a quick example: the query form i'm aiming for is: select x - lag(x) over ( order by x ) from a; meta=MetaData() a = Table('a', meta, Column('x',Integer)) print select([ a.c.x , over( func.lag(a.c.x), order_by = a.c.x ) ] ) # no problem print select([ a.c.x - over( func.lag(a.c.x),

[sqlalchemy] Re: Different behavior with pickling metadata with 0.7

2011-03-24 Thread botz
wonderful, thanks. On Mar 23, 3:41 pm, Michael Bayer wrote: > created ticket 2104 for this which is now fixed. > > On Mar 23, 2011, at 4:09 PM, botz wrote: > > -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to

[sqlalchemy] Different behavior with pickling metadata with 0.7

2011-03-23 Thread botz
Not sure if pickling of metadata is supported, but between 0.6.6 and 0.7b4 behavior has changed. The following works under 0.6.6, breaks under 0.7b4 . I've included the error below. #!/usr/bin/env python import pickle import sqlalchemy from sqlalchemy import * from sqlalc

[sqlalchemy] Re: using set returning function in a relationship

2010-08-11 Thread botz
And really if I could just plug in the argument for the foo_props call, at least in this case it would remove the need for the foreign key altogether as the join is really handled by the semantics of the foo_props call, which happens to only return the one related row. I suppose this could all be

[sqlalchemy] Re: using set returning function in a relationship

2010-08-11 Thread botz
Thanks for that... I didn't manage to get it to work straight off, but it seems like I'm close. Tried a couple things just to force it to behave as I wanted. # defined the selectable selectable = select( [ sql.column( 'x' ), sql.column('y')], from_obj = [ func.foo_

[sqlalchemy] Re: using set returning function in a relationship

2010-08-10 Thread botz
oops, didn't mean to submit that quite yet. crazy dog... anyways, given that I have foo_props() which acts as a kind of from- clause as in select * from foo_props( 123); I'd like to use that in relationship to a Foo class i.e. mapper( Foo, foo_table, properties( props = relationship( FooProps

[sqlalchemy] using set returning function in a relationship

2010-08-10 Thread botz
Hi, create type foo_props_type ( foo_id integer, foo_a int , foo_b int ); create function foo_props( foo_id integer ) returns setof foo_props_type language sql as $$ -- some crazy nested query taking foo_id as param $$; class FooProps(object): pass -- You received this message because you are

[sqlalchemy] using set returning function in a relationship

2010-08-10 Thread botz
Hi, create type foo_props_type ( foo_id integer, foo_a int , foo_b int ); create function foo_props( foo_id integer ) returns setof foo_props_type language sql as $$ -- some crazy nested query taking foo_id as param $$; class FooProps(object): pass -- You received this message because you are

[sqlalchemy] class definition missing from docs?

2010-08-03 Thread botz
http://www.sqlalchemy.org/docs/mappers.html#association-object refers to an Assocation class here: --- mapper(Parent, left_table, properties={ 'children':relationship(Association) }) mapper(Association, association_table, properties={ 'child':relationship(Child) }) --- but it doesn't se

[sqlalchemy] oracle flashback query

2009-01-25 Thread botz
Hi, I'm wondering if there's a way I can add a string to the tablename in a select query without affecting reflection, aliases, etc. Eg. given: t = Table( 'c1', column( 'c1', Integer, primary_key=True) I'd like to be able to generate: SELECT scntest.c1 AS scntest_c1 FROM scntest AS OF SCN 123