On 8 Sep 2013, at 02:36, Mohsen Pahlevanzadeh m.pahlevanza...@gmail.com wrote:
Suppose i need to send a set of table field and a value to search, i found
the following code:
///
q = session.query(myClass)
for attr, value in web_dict.items():
q
=
Suppose i need to send a set of table field and a value to search, i found
the following code:
///
q = session.query(myClass)for attr, value in web_dict.items():
q = q.filter(getattr(myClass, attr).like(%%%s%% % value))
///
[mailto:
sqlalchemy@googlegroups.com]
On
Behalf Of Sana
Sent: Thursday, 22 December 2011 2:50 AM
To: sqlalchemy
Subject: [sqlalchemy] SqlAlchemy dynamic query generation
Hi All,
I am trying to do query based on the user input as follows
condition = 'and_(db.User.id == id
-
From: sqlalchemy@googlegroups.com [mailto:sqlalchemy@googlegroups.com]
On
Behalf Of Sana
Sent: Thursday, 22 December 2011 2:50 AM
To: sqlalchemy
Subject: [sqlalchemy] SqlAlchemy dynamic query generation
Hi All,
I am trying to do query based on the user input as follows
condition
provide more details. What error are you
getting?
-Original Message-
From: sqlalchemy@googlegroups.com [mailto:sqlalchemy@googlegroups.com]
On
Behalf Of Sana
Sent: Thursday, 22 December 2011 2:50 AM
To: sqlalchemy
Subject: [sqlalchemy] SqlAlchemy dynamic query generation
@googlegroups.com [mailto:
sqlalchemy@googlegroups.com]
On
Behalf Of Sana
Sent: Thursday, 22 December 2011 2:50 AM
To: sqlalchemy
Subject: [sqlalchemy] SqlAlchemy dynamic query generation
Hi All,
I am trying to do query based on the user input as follows
condition = 'and_
Hi All,
I am trying to do query based on the user input as follows
condition = 'and_(db.User.id == id'
if user_name != ' ':
condition += ',db.User.name == user_name'
elif age != ' ':
condition += ',db.User.age == age'
elif place != ' ':
condition += ',db.User.place == place'
where =
You might get more help if you provide more details. What error are you getting?
-Original Message-
From: sqlalchemy@googlegroups.com [mailto:sqlalchemy@googlegroups.com] On
Behalf Of Sana
Sent: Thursday, 22 December 2011 2:50 AM
To: sqlalchemy
Subject: [sqlalchemy] SqlAlchemy dynamic
@googlegroups.com] On
Behalf Of Sana
Sent: Thursday, 22 December 2011 2:50 AM
To: sqlalchemy
Subject: [sqlalchemy] SqlAlchemy dynamic query generation
Hi All,
I am trying to do query based on the user input as follows
condition = 'and_(db.User.id == id'
if user_name != ' ':
condition
dynamic query generation
Hi All,
I am trying to do query based on the user input as follows
condition = 'and_(db.User.id == id'
if user_name != ' ':
condition += ',db.User.name == user_name'
elif age != ' ':
condition += ',db.User.age == age'
elif place != ' ':
condition
mailto:sqlalchemy@googlegroups.com
[mailto:sqlalchemy@googlegroups.com mailto:sqlalchemy@googlegroups.com]
On Behalf Of Sana
Sent: Thursday, 22 December 2011 2:50 AM
To: sqlalchemy
Subject: [sqlalchemy] SqlAlchemy dynamic query generation
Hi All,
I am trying to do query based
] Dynamic query
Dear all,
I've a form where people fill one or more fields to search in a db.
For the moment I solve it using a lot of if statement and a lot of
different query based on the filled fields. Something like that:
if start_date and end_date and instrument and details
Dear all,
I've a form where people fill one or more fields to search in a db.
For the moment I solve it using a lot of if statement and a lot of
different query based on the filled fields. Something like that:
if start_date and end_date and instrument and details and technician:
Given all this magic with .with_polymorphic(), I'm now wondering if
it's really worth to have a new Query class (by subclassing orm.Query)
per mapped object just to apply some filters...
At first I found quite elegant to have one Query object per mapped
class, but now I'm wondering if it's
On Oct 14, 2010, at 9:28 AM, Julien Cigar wrote:
Given all this magic with .with_polymorphic(), I'm now wondering if it's
really worth to have a new Query class (by subclassing orm.Query) per mapped
object just to apply some filters...
At first I found quite elegant to have one Query
On 10/12/2010 18:05, Julien Cigar wrote:
On 10/12/2010 17:09, Michael Bayer wrote:
On Oct 12, 2010, at 7:39 AM, Julien Cigar wrote:
Hello,
any idea why with
# Query
class BaseQuery(orm.Query):
@dynamic
def method_a(self):
...
def method_b(self):
...
class FooQuery(BaseQuery):
...
class
Hello,
any idea why with
# Query
class BaseQuery(orm.Query):
@dynamic
def method_a(self):
...
def method_b(self):
...
class FooQuery(BaseQuery):
...
class BarQuery(FooQuery):
@dynamic
def method_c(self):
On Oct 12, 2010, at 7:39 AM, Julien Cigar wrote:
Hello,
any idea why with
# Query
class BaseQuery(orm.Query):
@dynamic
def method_a(self):
...
def method_b(self):
...
class FooQuery(BaseQuery):
...
class
On 10/12/2010 17:09, Michael Bayer wrote:
On Oct 12, 2010, at 7:39 AM, Julien Cigar wrote:
Hello,
any idea why with
# Query
class BaseQuery(orm.Query):
@dynamic
def method_a(self):
...
def method_b(self):
...
class
Hello list
I have a simple mapping between a class and a table. What I'd like to
be able to do is dynamically change the query selection (based on some
HTTP param). More precisely I'd like that the ORM generate
SELECT some_sql_function(col1), col2, col3 FROM ...
instead of the default
SELECT
20 matches
Mail list logo