mirror of
https://github.com/simonw/sqlite-utils.git
synced 2026-07-26 02:44:33 +02:00
sqlite-utils rows --order option, closes #469
This commit is contained in:
parent
f4fb78fa95
commit
7a9a6363ff
4 changed files with 16 additions and 0 deletions
|
|
@ -1985,6 +1985,7 @@ def search(
|
|||
@click.argument("dbtable")
|
||||
@click.option("-c", "--column", type=str, multiple=True, help="Columns to return")
|
||||
@click.option("--where", help="Optional where clause")
|
||||
@click.option("-o", "--order", type=str, help="Order by ('column' or 'column desc')")
|
||||
@click.option(
|
||||
"-p",
|
||||
"--param",
|
||||
|
|
@ -2011,6 +2012,7 @@ def rows(
|
|||
dbtable,
|
||||
column,
|
||||
where,
|
||||
order,
|
||||
param,
|
||||
limit,
|
||||
offset,
|
||||
|
|
@ -2037,6 +2039,8 @@ def rows(
|
|||
sql = "select {} from [{}]".format(columns, dbtable)
|
||||
if where:
|
||||
sql += " where " + where
|
||||
if order:
|
||||
sql += " order by " + order
|
||||
if limit:
|
||||
sql += " limit {}".format(limit)
|
||||
if offset:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue