Dalius,
Thanks for reply.
It took me some time to figure out what is the reason for
the error:sa_exc.InvalidRequestError("No transaction is begun.")
Problem was in autocommit setting to ‘True’ instead of ‘False’
(model/__init__.py)sm = orm.sessionmaker(autoflush=True, autocommit=False,
bind=engine)
Hopefully it will help somebody who just started with the framework
to save some time.
It would be great if this thing would be fixed in the wiki
also.
Thanks,
Vadim
> Date: Tue, 6 Jan 2009 08:02:56 +0200
> From: [email protected]
> To: [email protected]
> Subject: Re: Using SQLAlchemy with Pylons -> Data queries and modifications
>
>
> Hello, Vadim,
>
> > def loadinfo(self):
> >
> > mr_jones = model.Person()
> >
> > mr_jones.name = 'Mr Jones'
> >
> > model.meta.Session.save(mr_jones)
> >
> > model.meta.Session.commit()
>
> The problem is in how you have created session. Since I don't know
> what's your SqlAlchemy version and how you create session I can't help
> you much.
>
> My guess is that you are using SqlAlchemy 0.4 and set transactional to False:
> http://www.sqlalchemy.org/docs/04/session.html#unitofwork_managing
>
> In that case you should begin your transaction: model.meta.Session.begin()
>
> --
> Dalius
> http://blog.sandbox.lt
>
> >
_________________________________________________________________
It’s the same Hotmail®. If by “same” you mean up to 70% faster.
http://windowslive.com/online/hotmail?ocid=TXT_TAGLM_WL_hotmail_acq_broad1_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
-~----------~----~----~----~------~----~------~--~---