Dear list, I've been using Pylons for years. Now I want to create a web app in Pyramid using MongoDB. I followed http://docs.pylonsproject.org/projects/pyramid_cookbook/en/latest/database/mongodb.html and the approach works well. I can access the MongoDB database using request.db from my views.py.
What I'm wondering is how to abstract my data models properly. In Pylons I was used to import my "myapp.models" and just use that module to communicate with my persistent storage. Usually that was an SQL database that SQLAlchemy was talking to. I wonder what the proper Pyramid pattern would be. On #pyramid (freenode IRC) other developers recommended that I just pass the request.db object around to models.py. Sure I can do that. But it feels wrong to me. My idea was actually to "import myapp.models" and use that as the only way to use the MongoDB backend. The views shouldn't have a notion of a "db" object at all so later I could perhaps replace MongoDB by something else but have all the abstraction in the models.py. On IRC I was scared with connection pooling and thread locals and whatnot. I'm not a thread guru. I just want to use MongoDB with Pyramid in a half-decent MVC fasion. :) Hints welcome. Thanks in advance. …Christoph -- A distributed system is one in which I cannot get something done because a machine I've never heard of is down. (Leslie Lamport) -- You received this message because you are subscribed to the Google Groups "pylons-discuss" group. To post to this group, send email to pylons-discuss@googlegroups.com. To unsubscribe from this group, send email to pylons-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/pylons-discuss?hl=en.