News for hackers. Stuff that matters.
Re:Choosing a Web Framework: Django, Flask, or Pyramid by bkeroack on Tuesday October 07, 2014 @02:26PM (#8422971)
For Mongo I write a data layer that has methods like GetFoo() or UpdateFoo() where the methods have implicit knowledge of key structure (and query model objects for validation, etc)

For SQL I would do something similar but use (for example) SQLAlchemy Core (not ORM) to do DB-agnostic SQL generation. That would essentially give me a SQL API somewhat similar to pymongo.

Re:Choosing a Web Framework: Django, Flask, or Pyramid by ryan_sb on Tuesday October 07, 2014 @02:55PM (#8423169)
For some things ORM's get in the way, but avoiding them by your own data layer sounds like a pretty big time-suck.

Being able to write a single line of SQLAlchemy to build relationships into your models seems way simpler than implementing relationships in a custom data layer.

Re:Choosing a Web Framework: Django, Flask, or Pyramid by bkeroack on Tuesday October 07, 2014 @05:11PM (#8424034)
I don't deny that it's more work. The question is whether it's worth the investment. I think for large, complex codebases (not little one-off apps) the gains in performance and long-term maintainability are worth it. Having the ability to know the exact performance implications of a query (and not having to waste brain cycles on questions about lazy vs eager loading, etc) is more desirable.
Re:Choosing a Web Framework: Django, Flask, or Pyramid by mayhew on Tuesday October 07, 2014 @03:51PM (#8423578)
Yeah, I think the sweet spot is using SQLAlchemy's ORM for simple queries and dropping down to core for more advanced usage. Best of both worlds.
Re:Choosing a Web Framework: Django, Flask, or Pyramid by ryan_sb on Tuesday October 07, 2014 @07:26PM (#8424559)
Even for advanced queries (ok, not super advanced) SQLAlchemy can hold its own, especially if you're willing to dip into the sqlalchemy.core modules.