[sqlalchemy] Re: Attribute error

2008-03-28 Thread pyplexed

That's fixed it. Thanks very much.

On Mar 26, 7:03 pm, Michael Bayer [EMAIL PROTECTED] wrote:
 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)
--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: Attribute error

2008-03-26 Thread Michael Bayer


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)

--~--~-~--~~~---~--~~
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 more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---