Re: [sqlalchemy] On query level overriding multi tentant setup

2014-03-10 Thread sjoerd
Thanks! On Thursday, March 6, 2014 7:21:49 PM UTC+1, Michael Bayer wrote: I don’t use Flask but this is the reason I don’t really like the whole Model.query thing. If you query from your Session, there’s no issue. The Session should be determining the nature of the query. That said,

[sqlalchemy] On query level overriding multi tentant setup

2014-03-06 Thread sjoerd
Hai, I have a multitenancy flask and sqlalchemy application. Models I have given an extra column client_id and a custom query_class. This query_class then automatically filters on the client_id stored in the session. Works like a charm! But now, I want to build a second flask application that

Re: [sqlalchemy] Calculate birthdays

2013-08-30 Thread sjoerd
Nice to start some discussion and sorry about the unclarity. Gulli, you are spot on with your code. Thanks! Next challange is to get all the birthdays of the next 7 days. This code does *not *do the trick; members_next = Member.query.filter( \ (extract(MONTH,

[sqlalchemy] Calculate birthdays

2013-08-28 Thread sjoerd
Hi, I want to retrieve all the people who are born at today's date. I'm using Flask with sqlalchemy; class Member(db.Model): ... dateofbirth = Column(Date) ... In my view.py; from datetime import date, timedelta today = date.today() members_today =

[sqlalchemy] Automatic unique Many-To-Many Relationships

2013-01-06 Thread sjoerd
(Integer, primary_key=True) roles = relationship(UserRole, secondary=lambda: UserUserRoleTable, backref=users) Code:: r1 = UserRole('news_add') db.session.add(r1) r3 = UserRole('news_del') db.session.add(r3) me = Administrator() me.fullname = 'Sjoerd Huisman

[sqlalchemy] automatic company_id insertion

2013-01-03 Thread sjoerd
Hi, I have one set of tables and I want to automate the insertion of the company_id in queries at certain tables. So I need to define in the models which tables are effected, no worries there, but where do I need to implement the query manipulation? The SQLAlchemy object is shared between

Re: [sqlalchemy] automatic company_id insertion

2013-01-03 Thread sjoerd
On Thursday, January 3, 2013 8:05:29 PM UTC+1, Michael Bayer wrote: On Jan 3, 2013, at 12:51 PM, sjo...@congressus.nl javascript: wrote: Hi, I have one set of tables and I want to automate the insertion of the company_id in queries at certain tables. So I need to define in the models

Re: [sqlalchemy] automatic company_id insertion

2013-01-03 Thread sjoerd
On Thursday, January 3, 2013 9:31:37 PM UTC+1, Michael Bayer wrote: On Jan 3, 2013, at 3:17 PM, sjo...@congressus.nl javascript: wrote: In this MyQuery two things need to happen; A) check whether the queried table has the certain company_id field and B) automatically implement the

[sqlalchemy] multi tenancy with Flask / SQL Alchemy

2012-12-17 Thread sjoerd
each, Multiple Connections - Multiple Flask Allps, One SqlAlchemy each, One Session each, One Connection each Or look into multi-threading and use one thread per tenant? Hope you can shed some light on my issue! Thanks Sjoerd Huisman -- You received this message because you