On Mon, Aug 15, 2022 at 3:46 PM Jonathan Vanasco <[email protected]> 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. -- 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 [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/pylons-discuss/CAH9f%3DuqT58npmt6_sbfXJpVZ4hX7PNJdj1WqYXeXo7rJfhwPQQ%40mail.gmail.com.
