python peewee - how to use distinct -


i'm trying code working peewee:

distinct_list = qsales.select(qsales.account, qsales.tax_code).distinct().where(qsales.trans_num == 3717) print distinct_list 

but print command result is: select distinct t1.account, t1.tax_code q_sales t1 (t1.trans_# = %s) [3717]

running above select statement in mysql editor (copy print result editor) returns correct result.

i tried:

distinct_list = qsales.select(fn.distinct(qsales.account, qsales.tax_code)).where(qsales.trans_num == 3717) 

but got same result

what doing wrong?

thank you.

sleeping on it, realized that code should follows:

distinct_list = qsales.select(qsales.account, qsales.tax_code).distinct().where(qsales.trans_num == 3717) item in distinct_list:     print item.account     print item.tax_code 

this closed now. thank you.


Comments