-
Notifications
You must be signed in to change notification settings - Fork 887
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Move code for sqlalchemy from scaffold to its own package #2857
Comments
@mfrlin I'm not clear what you mean. Pyramid currently comes with 3 scaffolds. We have plans to remove the scaffolds from Pyramid, and have taken steps in that direction in #2384 cookiecutters are in separate packages now: https://github.com/Pylons?q=cookiecutter |
I'm talking about 2 files mainly: and https://github.com/Pylons/pyramid/blob/master/pyramid/scaffolds/alchemy/%2Bpackage%2B/models/meta.py They basically integrate SQLAlchemy into your Pyramid project. But would not be better if you included the package that would done that for you instead of generating/copy pasting code? |
I still don't understand why a separate package would be better, unless it's a cookiecutter like we have already done and are already in the process of moving toward. The scaffold or cookiecutter does the generation of the project for you, copying files from the scaffold, filling in the slugs, and saving them into a destination directory. |
@stevepiercy: Consider the following two examples:
This issue proposes to create a new (officially supported, in Pylons repo, ...) |
This is something I've been thinking about for a very very long time and may be close to a possible design. I appreciate the concern but it's not at all easy to come up with something that works well in a variety of projects. The current scaffold could be considered a test bed for the design and so far people have seemed to be very happy with it. Also thanks to work done by @miohtama in websauna there's even more patterns that could be pulled out.
Yes, it's very tricky to do right for a variety of scenarios. The advantage of having this code in the scaffolds is that it's directly editable by people who have more advanced use cases which is basically anything under the sun from multiple databases or multiple bases to simply adding various hooks. Finally, the integration of SQLAlchemy with Pyramid is basically a single file ( |
There are various tickets where we have discussed this almost ad nasium. Changing from threadlocal to non-threadlocal and using request.dbsession in an external package would have been a breaking change. Pulling this out into a separate package doesn't make much sense |
I have to disagree with this one. Scaffolds, as I see it, are meant for newcomers, not advanced users. If a user has to edit the integration code because of advanced use case, the user is advanced enough to move the integration code into their project and edit it there. But such an advanced user is not the target audience for scaffolds. Also, I've been using pyramid in production for over three years, serving over 5000 customers. Not once have I had a need to for multiple SQL databases. For users such as me, the integration code just sits there and does not really change. And as such, it makes sense to keep it out of the business logic code and in a supporting package. |
I have to disagree with @zupo - I always start a new project with a scaffold. That things are spelled out in the scaffold is a big plus over Django, where one doesn't have any clue about how the magic works. And Flask-SA is just... well, let's leave it there. |
Coming from other frameworks I was surprised that scaffolding generated
sqlalchemy
integration code. What if I did not use sqlalchemy scaffold or what if best practice for integration changed?I think it would be better to create a package, that you just include like
pyramid_debugtoolbar
and it sets up the session on request and has importableBase
for models.I did some research and there are already
pyramid_sqlalchemy
andpyramid_basemodel
, but from my understanding they use thread locals for accessing the session.Are there any issues or concerns about moving the code, that is currently in scaffolds to its own package?
The text was updated successfully, but these errors were encountered: