Hi all!

 

I’m going through Using
SQLAlchemy with Pylons tutorial and having problems with population of
database. (Data queries and modifications).  Tables from tutorials were created 
without problems.

 

I have methode in my hello.py file:

 

def loadinfo(self):

        mr_jones = model.Person()

        mr_jones.name =
'Mr Jones'

        model.meta.Session.save(mr_jones)

        model.meta.Session.commit()

 

when I try to load http://localhost:5000/hello/loadinfo
in my browser, I’m getting the following error:

 

Module helloworld.controllers.hello:24
in loadinfo        

<<         
mr_jones.name
= 'Mr Jones'

           
model.meta.Session.save(mr_jones)

            model.meta.Session.commit()>>  model.meta.Session.commit()

Module sqlalchemy.orm.scoping:121
in do        

<<  def instrument(name):

        def
do(self, *args, **kwargs):

           
return getattr(self.registry(),
name)(*args,
**kwargs)

        return
do

    for meth in Session.public_methods:>>  return getattr(self.registry(),
name)(*args,
**kwargs)

Module sqlalchemy.orm.session:668
in commit        

<<                 
self.begin()

               
else:

                   
raise sa_exc.InvalidRequestError("No transaction is begun.")

    

           
self.transaction.commit()>> 
raise sa_exc.InvalidRequestError("No transaction is begun.")

<class 'sqlalchemy.exc.InvalidRequestError'>: No transaction is begun.

 

Please hint, what is wrong?

 

Thank you,

 

Vadim


_________________________________________________________________
Send e-mail anywhere. No map, no compass.
http://windowslive.com/oneline/hotmail?ocid=TXT_TAGLM_WL_hotmail_acq_anywhere_122008
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to