New .rows_where(select=) argument

This commit is contained in:
Simon Willison 2020-09-22 16:10:14 -07:00
commit 71782311ce
3 changed files with 11 additions and 4 deletions

View file

@ -532,10 +532,10 @@ class Queryable:
def rows(self):
return self.rows_where()
def rows_where(self, where=None, where_args=None, order_by=None):
def rows_where(self, where=None, where_args=None, order_by=None, select="*"):
if not self.exists():
return []
sql = "select * from [{}]".format(self.name)
sql = "select {} from [{}]".format(select, self.name)
if where is not None:
sql += " where " + where
if order_by is not None: