[sqlalchemy] dynamic schema with postgresql

2013-09-10 Thread Joe Martin
I need to create a new schema with some tables in it whenever a new company record is added. Below are my entities (defined with Flask-SqlAlchemy framework extension): class Company(db.Model): __tablename__ = 'company' __table_args__ = {"schema":"app"} id = db.Column(db.Integer, prima

RE: [sqlalchemy] Unit testing, mocking and dependency injection with SA Declarative.

2013-09-10 Thread Toph Burns
Could you use an in-memory, sqlite db for your testing? For our applications, we have an initialization function that loads the database connection strings from a config (.ini) file, passing those on to create_engine. In production it's a postgresql connection string, for test, it's a "sqlite:

Re: [sqlalchemy] Re: django user (using django ORM) + sqlalchemy for other db tables

2013-09-10 Thread Jonathan Vanasco
On Tuesday, September 10, 2013 6:47:41 AM UTC-4, Dennis wrote: > > Thanks for the advice -- your recommendations against this configuration > were a surprise to me... > It's making me rethink what I want (and how much I want it). > I'll post this as a comment to the first stackoverflow question s

Re: [sqlalchemy] Unit testing, mocking and dependency injection with SA Declarative.

2013-09-10 Thread Michael Bayer
you want to mock the entire relational database at the engine level? that sounds kind of tough?you should mock at the highest level possible in order to test the actual code you're testing.unles you're testing that "select * from table" returns what you expect, I'm not sure you'd be moc

Re: [sqlalchemy] Re: django user (using django ORM) + sqlalchemy for other db tables

2013-09-10 Thread Dennis
Thanks for the advice -- your recommendations against this configuration were a surprise to me... It's making me rethink what I want (and how much I want it). I'll post this as a comment to the first stackoverflow question so others are made aware. On Monday, September 9, 2013 10:17:10 PM UTC+8

[sqlalchemy] Unit testing, mocking and dependency injection with SA Declarative.

2013-09-10 Thread Michel Albert
I am trying to wrap my head around how to do Dependency Injection with SQLAlchemy and I am walking in circles. I want to be able to mock out SA for most of my tests. I trust SA and don't want to test serialisation into the DB. I just want to test my own code. So I was thinking to do dependency