[sqlalchemy] SQLAlchemy with Flask -- hybrid models?

2012-08-22 Thread David McKeone
I've been using SQLAlchemy with Flask via the Flask extension Flask-SQLAlchemy. Everything works great so far, but I foresee a potential problem once I start to use my database model outside of Flask. In the future I'd like to be able to use my models with non-Flask SQLAlchemy (a worker

Re: [sqlalchemy] SQLAlchemy with Flask -- hybrid models?

2012-08-22 Thread Simon King
On Wed, Aug 22, 2012 at 12:51 PM, David McKeone davidmcke...@gmail.com wrote: I've been using SQLAlchemy with Flask via the Flask extension Flask-SQLAlchemy. Everything works great so far, but I foresee a potential problem once I start to use my database model outside of Flask. In the future

Re: [sqlalchemy] SQLAlchemy with Flask -- hybrid models?

2012-08-22 Thread David McKeone
On Wednesday, August 22, 2012 2:23:28 PM UTC+1, Simon King wrote: On Wed, Aug 22, 2012 at 12:51 PM, David McKeone davidm...@gmail.comjavascript: wrote: I've been using SQLAlchemy with Flask via the Flask extension Flask-SQLAlchemy. Everything works great so far, but I foresee a

Re: [sqlalchemy] SQLAlchemy with Flask -- hybrid models?

2012-08-22 Thread David McKeone
On Wednesday, August 22, 2012 2:33:01 PM UTC+1, David McKeone wrote: On Wednesday, August 22, 2012 2:23:28 PM UTC+1, Simon King wrote: On Wed, Aug 22, 2012 at 12:51 PM, David McKeone davidm...@gmail.com wrote: I've been using SQLAlchemy with Flask via the Flask extension

Re: [sqlalchemy] SQLAlchemy with Flask -- hybrid models?

2012-08-22 Thread Simon King
On Wed, Aug 22, 2012 at 2:44 PM, David McKeone davidmcke...@gmail.com wrote: On Wednesday, August 22, 2012 2:33:01 PM UTC+1, David McKeone wrote: On Wednesday, August 22, 2012 2:23:28 PM UTC+1, Simon King wrote: On Wed, Aug 22, 2012 at 12:51 PM, David McKeone davidm...@gmail.com wrote:

Re: [sqlalchemy] SQLAlchemy with Flask -- hybrid models?

2012-08-22 Thread David McKeone
On Wednesday, August 22, 2012 3:12:02 PM UTC+1, Simon King wrote: On Wed, Aug 22, 2012 at 2:44 PM, David McKeone davidm...@gmail.comjavascript: wrote: On Wednesday, August 22, 2012 2:33:01 PM UTC+1, David McKeone wrote: On Wednesday, August 22, 2012 2:23:28 PM UTC+1,

Re: [sqlalchemy] SQLAlchemy with Flask -- hybrid models?

2012-08-22 Thread David McKeone
On Wednesday, August 22, 2012 3:12:02 PM UTC+1, Simon King wrote: On Wed, Aug 22, 2012 at 2:44 PM, David McKeone davidm...@gmail.comjavascript: wrote: On Wednesday, August 22, 2012 2:33:01 PM UTC+1, David McKeone wrote: On Wednesday, August 22, 2012 2:23:28 PM UTC+1,

Re: [sqlalchemy] SQLAlchemy with Flask -- hybrid models?

2012-08-22 Thread Michael Bayer
On Aug 22, 2012, at 7:51 AM, David McKeone wrote: I've been using SQLAlchemy with Flask via the Flask extension Flask-SQLAlchemy. Everything works great so far, but I foresee a potential problem once I start to use my database model outside of Flask. In the future I'd like to be able to

[sqlalchemy] Re: strange attributeerror module object has no attribute exc when using sqlalchemy from a mod_wsgi handle

2012-08-22 Thread Brendan Volheim
So I read the doc you posted above and the User/group that my apache user uses is www and I assumed. I went as far as chmod the entire web directory, which owns the wsgi file, to 777. That didn't work. I then chgrp, chown the entire directory to www. That still didn't work. Can you explain the

Re: [sqlalchemy] SQLAlchemy with Flask -- hybrid models?

2012-08-22 Thread David McKeone
On Wednesday, August 22, 2012 5:36:22 PM UTC+1, Michael Bayer wrote: On Aug 22, 2012, at 7:51 AM, David McKeone wrote: I've been using SQLAlchemy with Flask via the Flask extension Flask-SQLAlchemy. Everything works great so far, but I foresee a potential problem once I start to use my

Re: [sqlalchemy] SQLAlchemy with Flask -- hybrid models?

2012-08-22 Thread Michael Bayer
On Aug 22, 2012, at 3:51 PM, David McKeone wrote: I was wondering if you could just clarify how I might convert a standard model object into a flask-sqlalchemy model object. why do you need to do this ?What flask-sqlalchemy-specific features would you hope for the model objects to

[sqlalchemy] x y z shouldn't result in x y SQL

2012-08-22 Thread ThiefMaster
I think this is a bug; it should either result in an error or work as expected - in python this **is** valid after all: str(X.query.filter(2 X.id 5)) 'SELECT x.id AS x_id \nFROM x \nWHERE x.id :id_1' This shouldn't generate the following SQL str(X.query.filter(2 X.id)) 'SELECT x.id AS

Re: [sqlalchemy] x y z shouldn't result in x y SQL

2012-08-22 Thread Michael Bayer
On Aug 22, 2012, at 4:37 PM, ThiefMaster wrote: I think this is a bug; it should either result in an error or work as expected - in python this **is** valid after all: str(X.query.filter(2 X.id 5)) 'SELECT x.id AS x_id \nFROM x \nWHERE x.id :id_1' This shouldn't generate the

Re: [sqlalchemy] SQLAlchemy with Flask -- hybrid models?

2012-08-22 Thread David McKeone
On Wednesday, August 22, 2012 9:03:55 PM UTC+1, Michael Bayer wrote: On Aug 22, 2012, at 3:51 PM, David McKeone wrote: I was wondering if you could just clarify how I might convert a standard model object into a flask-sqlalchemy model object. why do you need to do this ?What

Re: [sqlalchemy] SQLAlchemy with Flask -- hybrid models?

2012-08-22 Thread David McKeone
On Wednesday, August 22, 2012 10:21:59 PM UTC+1, David McKeone wrote: On Wednesday, August 22, 2012 9:03:55 PM UTC+1, Michael Bayer wrote: On Aug 22, 2012, at 3:51 PM, David McKeone wrote: I was wondering if you could just clarify how I might convert a standard model object into a

[sqlalchemy] NOT LIKE

2012-08-22 Thread Warwick Prince
Hi When creating a basic query, how does one code a NOT LIKE using SA? I can do this; query = table.select().where(like_op(table.c.name, 'fred%')) I can not find a NOT LIKE operator. The ones there notlike_op and notilike_op raise NotImplemented. I've placed it in as text('%s NOT LIKE %s')

Re: [sqlalchemy] NOT LIKE

2012-08-22 Thread Michael Bayer
not sure why the like_op and nolike_op have come into your normal vocabulary here as they are usually just the ops used internally. LIKE is column.like(other) and NOT LIKE is ~column.like(other). On Aug 22, 2012, at 9:15 PM, Warwick Prince wrote: Hi When creating a basic query, how does

Re: [sqlalchemy] SQLAlchemy with Flask -- hybrid models?

2012-08-22 Thread Michael Bayer
On Aug 22, 2012, at 5:33 PM, David McKeone wrote: I suppose I should be more clear. This is really a long term question, I was just looking for some kind of answer now because I don't want to code myself into a corner in the short term. Currently I can make requests outside of a flask

Re: [sqlalchemy] NOT LIKE

2012-08-22 Thread Warwick Prince
Thanks Michael I struggle sometimes to find examples of the simple things, so eventually searched out the like_op as it was in the same place as eq() etc. So, on that subject - is it better to use query.where(eq(a, b)) or query.where(a==b), or does it make no difference really? not sure