Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion datajoint/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ def kill(restriction=None, connection=None, order_by=None): # pragma: no cover
view and kill database connections.
:param restriction: restriction to be applied to processlist
:param connection: a datajoint.Connection object. Default calls datajoint.conn()
:param order_by: order by string clause for output ordering. defaults to 'id'.
:param order_by: order by a single attribute or the list of attributes. defaults to 'id'.

Restrictions are specified as strings and can involve any of the attributes of
information_schema.processlist: ID, USER, HOST, DB, COMMAND, TIME, STATE, INFO.
Expand All @@ -39,6 +39,9 @@ def kill(restriction=None, connection=None, order_by=None): # pragma: no cover
if connection is None:
connection = conn()

if order_by is not None and not isinstance(order_by, str):
order_by = ','.join(order_by)

query = 'SELECT * FROM information_schema.processlist WHERE id <> CONNECTION_ID()' + (
"" if restriction is None else ' AND (%s)' % restriction) + (
' ORDER BY %s' % (order_by or 'id'))
Expand Down