Re: [sqlalchemy] dynamic schema with postgresql

2013-09-15 Thread Joe Martin
Thank you for your kind help; it was really helpful. On Fri, Sep 13, 2013 at 2:40 AM, Michael Bayer mike...@zzzcomputing.comwrote: On Sep 11, 2013, at 10:36 PM, Joe Martin jandos...@gmail.com wrote: Thank you for your reply. Then I thought the following would work:

Re: [sqlalchemy] dynamic schema with postgresql

2013-09-12 Thread Michael Bayer
On Sep 11, 2013, at 10:36 PM, Joe Martin jandos...@gmail.com wrote: Thank you for your reply. Then I thought the following would work: company_schema = 'c' + str(company_id) db.session.execute(CreateSchema(company_schema)) db.session.commit()

Re: [sqlalchemy] dynamic schema with postgresql

2013-09-11 Thread Michael Bayer
On Sep 10, 2013, at 11:48 PM, Joe Martin jandos...@gmail.com wrote: 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__ =

Re: [sqlalchemy] dynamic schema with postgresql

2013-09-11 Thread Joe Martin
Thank you for your reply. Then I thought the following would work: company_schema = 'c' + str(company_id) db.session.execute(CreateSchema(company_schema)) db.session.commit() meta = db.MetaData(bind=db.engine) for table in

[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,