It is rolling back in some of my testing when there's no
insert/delete/update, but I want to make sure it always does, just in
case something somehow modifies the database when we didn't intend to.
It's not that big a deal but it's what I'd like. I'm not sure if
SQLAlchemy is issuing rollback if there were no changes, or if it will
always do so.

On Tue, Aug 16, 2022 at 8:42 AM Mike Orr <sluggos...@gmail.com> wrote:
>
> On Mon, Aug 15, 2022 at 3:46 PM Jonathan Vanasco <jvana...@gmail.com> wrote:
> >
> >
> > I second what Michael said.  The sqlalchemy starter template is the right 
> > way to go.
> >
> > The major thing this template does, is provide you with the glue between a 
> > SQLAlchemy "Session" and the pyramid request.  See : 
> > https://github.com/Pylons/pyramid-cookiecutter-starter/blob/latest/%7B%7Bcookiecutter.repo_name%7D%7D/%7B%7Bcookiecutter.repo_name%7D%7D/sqlalchemy_models/__init__.py#L87-L127
> >
> > If you run pyramid_tm (https://pypi.org/project/pyramid-tm/) you can then 
> > use zope.sqlalchemy (https://pypi.org/project/zope.sqlalchemy/) to bind the 
> > session to the transaction.
> >
> > You don't need to use SQLAlchemy's ORM.  You can just use SQLAlchemy Core 
> > (https://docs.sqlalchemy.org/en/14/core/) to do everything.  You can also 
> > access the underlying psycopg2 connections through SQLAlchemy when you want.
>
> Is there a way to make 'pyramid_tm' always roll back even on success?
> I looked in the code and there seemed to be no flag for that, and I'd
> either have to call 'transaction.doom()' in a subscriber or patch the
> obscure code several levels deep.



-- 
Mike Orr <sluggos...@gmail.com>

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to pylons-discuss+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/pylons-discuss/CAH9f%3Dup49Ag0ZZgTQ9j%3DRMAFqP-PCcF9AN8zSRiQqcefrwNVcw%40mail.gmail.com.

Reply via email to