/ Published in: Python
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
# select distinct author from blogtable where keyword = "dust"; class Blog(SQLObject): class sqlmeta: table = 'blogtable' author = StringCol() keyword = StringCol() Blog.select(Blog.q.keyword=='dust', distinct=True) Version 2 select = Select( [Blog.q.author], Blog.q.keyword=='dust', distinct=True, ) sql = connection.sqlrepr(select) for author in connection.queryAll(sql): print author