3 messages in com.googlegroups.sqlalchemy[sqlalchemy] Re: Attribute error
FromSent OnAttachments
pyplexed26 Mar 2008 10:34 
Michael Bayer26 Mar 2008 12:02 
pyplexed28 Mar 2008 07:53 
Subject:[sqlalchemy] Re: Attribute error
From:Michael Bayer (mike@zzzcomputing.com)
Date:03/26/2008 12:02:57 PM
List:com.googlegroups.sqlalchemy

On Mar 26, 2008, at 1:34 PM, pyplexed wrote:

Hi all,

I'm a complete newcomer to SA, and I've tried to adapt an example I found on-line to look a bit more like the problem I'm trying to solve.

If I save an object to my session, and then flush it, I'm getting an error which Google can't help me with:

AttributeError: 'MetaData' object has no attribute 'contextual_connect'

I saw a post that said an attribute error can happen if the Metadata class name is mistakenly bound to an instance. I don't think that's the case in my script.

I wondered if anyone here would be able to take a quick look at my (no doubt lousy) code and let me know what I'm doing wrong?

The code is here:

http://pubcat.org/alchemyTest.py

sessionmaker needs to bind to the Engine, not the MetaData (this might be something we want to detect, its an understandable mistake):

Session = sessionmaker(bind=engine, autoflush=True, transactional=False)