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.

There is not a lot of code to rewrite if you want to eliminate SqlAlchemy 
and start from scratch - probably only 100-400 lines worth, and as Arndt 
Droullier said it is pretty straightforward -- but you're going to have to 
maintain that, and the entrypoints are somewhat rough.  Even in that 
situation, starting with the sqlalchemy cookiecutter is your best option as 
it will give you a better idea as to where your code needs to go.


On Thursday, August 11, 2022 at 12:38:36 PM UTC-4 mmer...@gmail.com wrote:

> As Laurent said, if I were starting from scratch a new project I would 
> personally use the pyramid-cookiecutter-starter sqlalchemy and then rip out 
> what I didn’t need but only one part of that cookie cutter is the ORM. It 
> has several other features that you need to solve one way or another so 
> you’d at least want to know what you’re getting rid of. It is modular and 
> you can pick the layers you want.
>
>  

-- 
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/fd53e026-af8b-45ed-b4fe-df073e50f0e7n%40googlegroups.com.

Reply via email to