[sqlalchemy] KeyError: u'oid' when reflecting postgres db

2009-01-19 Thread robert rottermann
hi there, when I try to reflect a postges db like this: Base2 = declarative_base(engine) Base2.metadata.reflect() I get a key error (see below). however, if I define its class using autoload, things are fine class dokstatus(Base2): #__table__ = tables2[dokstatus] __tablename__ =

[sqlalchemy] Re: Order of INSERTs for children of an object

2009-01-19 Thread Tomasz Nazar
Thanks Michael, it works for simple case and solved my issue for now. In SqlA 0.4 import is wrong. proper one is: from sqlalchemy.orm.session import SessionExtension So, for A-B dependency it works. 'Inserts' seem not be random any more. I wanted to play a bit more with that feature and can I

[sqlalchemy] Re: KeyError: u'oid' when reflecting postgres db

2009-01-19 Thread Michael Bayer
we do need to see the CREATE TABLE for the table in question. Look perhaps to see which table is using OID as one of the columns in an INDEX. the oid concept is being deprecated from postgres.As a last resort, use pdb within SQLA to see what table specifically is blowing up. any

[sqlalchemy] Re: Order of INSERTs for children of an object

2009-01-19 Thread Michael Bayer
On Jan 19, 2009, at 9:10 AM, Tomasz Nazar wrote: Thanks Michael, it works for simple case and solved my issue for now. In SqlA 0.4 import is wrong. proper one is: from sqlalchemy.orm.session import SessionExtension So, for A-B dependency it works. 'Inserts' seem not be random any

[sqlalchemy] Re: Order of INSERTs for children of an object

2009-01-19 Thread Tomasz Nazar
On Mon, Jan 19, 2009 at 4:33 PM, Michael Bayer mike...@zzzcomputing.com wrote: So, for A-B dependency it works. 'Inserts' seem not be random any more. I wanted to play a bit more with that feature and can I configure many dependencies in that way? I was thinking if can tell SQLA to have kind

[sqlalchemy] Re: Order of INSERTs for children of an object

2009-01-19 Thread Michael Bayer
On Jan 19, 2009, at 11:17 AM, Tomasz Nazar wrote: Hmm, the circular dependency: I do have some mappers configured that some cycle exists in fact. Is this what you're talking about? Conference- (has many) ConferenceInterpreter -(related to one) User - (created many) Conference - . I

[sqlalchemy] Re: Order of INSERTs for children of an object

2009-01-19 Thread Tomasz Nazar
On Mon, Jan 19, 2009 at 5:37 PM, Michael Bayer mike...@zzzcomputing.com wrote: if you actually have foreign keys expressing multiple paths to the same things then there would be a cycle. It's hard to tell from your mappings, your tables don't seem to have cycles from a foreign key

[sqlalchemy] Bulk insert operation

2009-01-19 Thread MikeCo
I have a use case where detail data is collected during operation then copied periodically to a history table. In SA, tables look something like this: #history data history = Table('history', metadata, Column('id', Integer, primary_key=True), Column('naturalkey', String, unique=True,

[sqlalchemy] Re: Bulk insert operation

2009-01-19 Thread Michael Bayer
insert() from a select() is currently a TODO. On Jan 19, 2009, at 1:13 PM, MikeCo wrote: I have a use case where detail data is collected during operation then copied periodically to a history table. In SA, tables look something like this: #history data history = Table('history',

[sqlalchemy] Loading JPG images into an Oracle Long Raw field

2009-01-19 Thread Gregg Parks
I'm trying to load jpg images in an Oracle Long Raw field using the following code: engine = create_engine('oracle://sysadm:c00l...@testhr:1530/hrupg') conn= engine.raw_connection() cursor1 = conn.cursor() f = os.path.join(i.root, i.filename) file_size = os.path.getsize(f) ifile

[sqlalchemy] Saving the results of a sqlalchemy join using Python

2009-01-19 Thread boudewijnector
Hi Guys, Currently I'm maintaining a python-2.5 (pylons) webapplication, which uses sqlaclhemy as its ORM. I've been messing around for some time with this (quite stupid) problem, but still can't het it to work the way I want it to. Situation: There's 2 tables, Fiber and Line. A line consists

[sqlalchemy] cascades and many-to-many

2009-01-19 Thread Jon
The recent upgrade to 0.5.0 (again, thank you) from 0.5.0rc4 brought with it a new message regarding many-to-many relationships and cascades (specifically, delete cascades). I have a few questions - one is general and the other has to do with a more specific problem. First, the general

[sqlalchemy] Re: cascades and many-to-many

2009-01-19 Thread Michael Bayer
On Jan 19, 2009, at 5:32 PM, Jon wrote: The recent upgrade to 0.5.0 (again, thank you) from 0.5.0rc4 brought with it a new message regarding many-to-many relationships and cascades (specifically, delete cascades). I have a few questions - one is general and the other has to do with a

[sqlalchemy] Re: Saving the results of a sqlalchemy join using Python

2009-01-19 Thread az
mmh, cant really grasp what u want to do. what are Line.* attributes? .filter does and(), so this can be simplified: q = query(Line).filter( models.Line.LineDiscarded == LineDiscarded ) if ...: return q.filter( sites...) else: return q.filter( sites...) On Monday 19 January 2009 23:28:55