do that?
def functionr(live, y=None):
if y:
versione=" AND y = %s"
else:
versione = ""
sql = """
SELECT ...
WHERE live=%s AND ban = 0%s
GROUP BY seller) AS tmp
""" % ('%s', versione)
if y:
x = query_select(sql, live, y)
else:
x = query_select(sql, live)
return x
Probably the best solution for this case to use any query builder
Firstly: if x: #x is treated True except for all empty data types [],{},(),'',0 False, and None if x is not None # which works only on None
Обсуждают сегодня