Hi Robert Forkel,
You got it right i am trying to have a combination of expression combined
in and_.
I need to add the attribute only when it is not equal to null.So i tried to
check if it is not null and then from the expression and pass it to filter
.But this does not work.
I went through the
conditions = [db.User.id==id]
if user_name != ' ':
conditions.append(db.User.name == user_name)
elif age != ' ':
conditions.append(db.User.age == age)
elif place != ' ':
conditions.append(db.User.place == place)
result = db.User.filter(and_(*conditions)).all()
might do the trick
I tried it but i still get the same error.
On Thu, Dec 22, 2011 at 2:31 PM, Robert Forkel xrotw...@googlemail.comwrote:
conditions = [db.User.id==id]
if user_name != ' ':
conditions.append(db.User.name == user_name)
elif age != ' ':
conditions.append(db.User.age == age)
elif place !=
Hey list,
this sounds like it should be a FAQ, didn't find anything though:
I want to use the ORM in a declarative style and have the table
definition reflected, eg sth like:
class A(declarative_base()):
__tablename__ = 'A'
__table_args__ = {'autoload' : True}
However to do this SA
On Dec 22, 2011, at 9:37 AM, peter sabaini wrote:
Hey list,
this sounds like it should be a FAQ, didn't find anything though:
I want to use the ORM in a declarative style and have the table
definition reflected, eg sth like:
class A(declarative_base()):
__tablename__ = 'A'
Hey!
This works for me -- almost :-)
In my use case I need to override a column (to provide an artificial FK --
some *erm old school mysql db) which seems to trigger SA into trying to
reflect early
Observe:
from sqlalchemy import *
from sqlalchemy.orm import *
from sqlalchemy.ext.declarative
On Dec 22, 2011, at 11:48 AM, peter sabaini wrote:
Hey!
This works for me -- almost :-)
In my use case I need to override a column (to provide an artificial FK --
some *erm old school mysql db) which seems to trigger SA into trying to
reflect early
Observe:
from sqlalchemy
On Dec 22, 2011, at 7:28 PM, Michael Bayer wrote:
this could work really nicely with extend_existing, which has been enhanced
in 0.7.4, but there seem to be some glitches preventing it from being super
nice, so I can't get that to work right now. Just send in those columns via
your own