Skip to content

Commit d54c250

Browse files
Merge pull request #783 from ixcat/issue-668
datajoint/admin.py: dj.kill order_by extension 1/N (#779)
2 parents bd36d08 + 703c36e commit d54c250

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

datajoint/admin.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ def kill(restriction=None, connection=None, order_by=None): # pragma: no cover
2626
view and kill database connections.
2727
:param restriction: restriction to be applied to processlist
2828
:param connection: a datajoint.Connection object. Default calls datajoint.conn()
29-
:param order_by: order by string clause for output ordering. defaults to 'id'.
29+
:param order_by: order by a single attribute or the list of attributes. defaults to 'id'.
3030
3131
Restrictions are specified as strings and can involve any of the attributes of
3232
information_schema.processlist: ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO.
@@ -39,6 +39,9 @@ def kill(restriction=None, connection=None, order_by=None): # pragma: no cover
3939
if connection is None:
4040
connection = conn()
4141

42+
if order_by is not None and not isinstance(order_by, str):
43+
order_by = ','.join(order_by)
44+
4245
query = 'SELECT * FROM information_schema.processlist WHERE id <> CONNECTION_ID()' + (
4346
"" if restriction is None else ' AND (%s)' % restriction) + (
4447
' ORDER BY %s' % (order_by or 'id'))

0 commit comments

Comments
 (0)