[sqlalchemy] Connecting to SIMPLIFIED CHINESE_CHINA.ZHS16GBK

2009-07-27 Thread ast
Hello Can i connect to different database with SA. I want it to connect with SIMPLIFIED CHINESE_CHINA.ZHS16GBK Oracle db. Is it possible ? Thanks in advance --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups

[sqlalchemy] Session mapper and Class.query() method

2009-07-27 Thread naktinis
I've seen that Session.mapper is deprecated. While I agree that auto- adding objects to a session may be a bad idea, I don't see why is it so bad to add the query() method directly to the mapped class. Is there a reason, why I shouldn't do it?

[sqlalchemy] Re: Session mapper and Class.query() method

2009-07-27 Thread King Simon-NFHD78
-Original Message- From: sqlalchemy@googlegroups.com [mailto:sqlalch...@googlegroups.com] On Behalf Of naktinis Sent: 27 July 2009 13:07 To: sqlalchemy Subject: [sqlalchemy] Session mapper and Class.query() method I've seen that Session.mapper is deprecated. While I agree that

[sqlalchemy] default values in reflected tables

2009-07-27 Thread Jamie Bullock
Hi, Is there a way in SQLalchemy to have the values of a mapped reflected table object set to default column values derived from the database backend? e.g. if column 'bar' of table 'foo' in my database has a default of True, I would like to be able to do the following: foo_table =

[sqlalchemy] ColumnProperty.columns is a list

2009-07-27 Thread Carlos Rivolta
Hi, i see that ColumnProperty.columns is a list. I could only produce examples of ColumnProperties with two values in joins with conflicting names of attribute from different tables (And SA warns you to use explicit properties). Are there situation in which it's legitimate to have more that one

[sqlalchemy] Re: Connecting to SIMPLIFIED CHINESE_CHINA.ZHS16GBK

2009-07-27 Thread Michael Bayer
ast wrote: Hello Can i connect to different database with SA. I want it to connect with SIMPLIFIED CHINESE_CHINA.ZHS16GBK Oracle db. Is it possible ? as far as I know. nothing special should be needed. you might want to set NLS_LANG to that value although with current versions of

[sqlalchemy] Re: Session mapper and Class.query() method

2009-07-27 Thread Michael Bayer
naktinis wrote: I've seen that Session.mapper is deprecated. While I agree that auto- adding objects to a session may be a bad idea, I don't see why is it so bad to add the query() method directly to the mapped class. Is there a reason, why I shouldn't do it? you are free to do it, using a

[sqlalchemy] Re: default values in reflected tables

2009-07-27 Thread Michael Bayer
Jamie Bullock wrote: Hi, Is there a way in SQLalchemy to have the values of a mapped reflected table object set to default column values derived from the database backend? e.g. if column 'bar' of table 'foo' in my database has a default of True, I would like to be able to do the

[sqlalchemy] Re: ColumnProperty.columns is a list

2009-07-27 Thread Michael Bayer
Carlos Rivolta wrote: Hi, i see that ColumnProperty.columns is a list. I could only produce examples of ColumnProperties with two values in joins with conflicting names of attribute from different tables (And SA warns you to use explicit properties). Are there situation in which it's

[sqlalchemy] Re: ColumnProperty.columns is a list

2009-07-27 Thread Carlos Rivolta
Thanks /c --~--~-~--~~~---~--~~ 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: delete-orphan assigning fk. Related to FAQ 5.13

2009-07-27 Thread Alessandro Dentella
Movie is attached to a Director or not. like the FAQ says, we choose not to get into generating events from foreign keys being set. which is not a forever rule, but if you look in trac there are about 300 ORM issues open that I'd rather get resolved before I have the time to

[sqlalchemy] Re: session.refresh() bug with adjacency lists?

2009-07-27 Thread David Gardner
I was able to reproduce this issue in a simple test using sqlite, submitted as a bug http://www.sqlalchemy.org/trac/ticket/1485 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups sqlalchemy group. To post to this

[sqlalchemy] Re: session.refresh() bug with adjacency lists?

2009-07-27 Thread Michael Bayer
David Gardner wrote: I was able to reproduce this issue in a simple test using sqlite, submitted as a bug http://www.sqlalchemy.org/trac/ticket/1485 four levels of inheritance ?! hardly simple. turn off the lazy=False for now, its an eager loading issue.

[sqlalchemy] Re: session.refresh() bug with adjacency lists?

2009-07-27 Thread David Gardner
By simple I mean it isn't based on my schema, and reproducable :) Michael Bayer wrote: four levels of inheritance ?! hardly simple. turn off the lazy=False for now, its an eager loading issue. -- David Gardner Pipeline Tools Programmer Jim Henson Creature Shop

[sqlalchemy] Re: session.refresh() bug with adjacency lists?

2009-07-27 Thread Michael Bayer
refresh() isnt doing things the same as expire() does. which is not necessarily wrong, but if you use expire() for now, you'll get better results. or turn off the lazy=False. but yes its a bug. David Gardner wrote: By simple I mean it isn't based on my schema, and reproducable :) Michael

[sqlalchemy] Re: default values in reflected tables

2009-07-27 Thread Jamie Bullock
On 27 Jul 2009, at 16:32, Michael Bayer wrote: what's elegant to me is: f = Foo() Session.add(f) Session.flush() # or commit f.bar True consider that Foo() wouldn't know about server generated defaults if not associated with the database. The database association is achieved

[sqlalchemy] Session-Aware Mapper deprecation page

2009-07-27 Thread Brad Wells
Single table inheritance is broken in the given mapper creating function on the deprecation guide page. Returning the mapper corrects the issue. def session_mapper(scoped_session): def mapper(cls, *args, **kwargs): cls.query = scoped_session.query_property() return

[sqlalchemy] Re: default values in reflected tables

2009-07-27 Thread Michael Bayer
Jamie Bullock wrote: Only issue now is that if you have a NOT NULL constraint on a field, an IntegrityError exception gets raised when flush() is called. One way round this is to supply a dummy value for the field in question. Is there a better way to prevent the exception? thats what the

[sqlalchemy] Re: Session-Aware Mapper deprecation page

2009-07-27 Thread Michael Bayer
Brad Wells wrote: Single table inheritance is broken in the given mapper creating function on the deprecation guide page. Returning the mapper corrects the issue. def session_mapper(scoped_session): def mapper(cls, *args, **kwargs): cls.query = scoped_session.query_property()

[sqlalchemy] Re: session.refresh() bug with adjacency lists?

2009-07-27 Thread David Gardner
Thanks for looking into this. If it helps you any, this isn't an urgent problem for me. It isn't production code that is having this problem, and as you mentioned I do have an adequate workaround. Michael Bayer wrote: refresh() isnt doing things the same as expire() does. which is not

[sqlalchemy] Hierarchical data: Get all (sub-) children? Parents?

2009-07-27 Thread AF
Hello, Given hierarchical data similar to: http://www.sqlalchemy.org/docs/05/mappers.html?#adjacency-list-relationships With out resorting to brute force recursive queries in my objects: 1) Is there any way to retrieve all a node's children / sub-children? 2) Is there a way to retrieve the