Skip to main content

Management command for commandline querying

Project description

Copyright (c) 2009-2012 Dennis Kaarsemaker <> A command-line interface to query the Django ORM

  • python install
  • Add cli_query to the INSTALLED_APPLICATIONS setting in your

Usage: cd your_project_dir; ./ query [options] [filters]

The django ORM will be queried with the filters on the commandline. Records will be separated with newlines, fields with the specified separator (the default is a comma). Alternatively, a template can be specified which will be passed the result of the query as the ‘objects’ variable

Query key/value pairs can be prefixed with a ‘!’ or ‘~’ to negate the query. The __in filter works, use a comma separated string of arguments

  • Display name and assettag of all mc01 servers ./ query -a servers -m Server name__startswith=mc01 -f name,assettag
  • Get a list of name, ip, mac for all servers where the does not contain .82. ./ query -a servers -m Interface !ip_address__contains=’.82.’ -f,ip_address,mac_address
  • Use a template to get the roles, depending on mac address ./ query -a servers -m Server interface__mac_address=00:17:A4:8D:E6:BC -t ‘{{ objects.0.role_set.all|join:”,” }}’
  • List all eth0/eth1 network interfaces ./ query -a servers -m Interface name__in=eth0,eth1 -f ip_address,mac_address
  • Update the status of many servers at once ./ query -a servers -m Server name__contains=builder- -u status=spare

Project details

Release history Release notifications

History Node


History Node


This version
History Node


History Node


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Filename, size & hash SHA256 hash help File type Python version Upload date
django-cli-query-1.1.linux-i686.tar.gz (6.1 kB) Copy SHA256 hash SHA256 Dumb Binary any Sep 2, 2012
django-cli-query-1.1.tar.gz (4.2 kB) Copy SHA256 hash SHA256 Source None Sep 2, 2012

Supported by

Elastic Elastic Search Pingdom Pingdom Monitoring Google Google BigQuery Sentry Sentry Error logging CloudAMQP CloudAMQP RabbitMQ AWS AWS Cloud computing Fastly Fastly CDN DigiCert DigiCert EV certificate StatusPage StatusPage Status page