CQSH - An XQuery Shell

down arrow Code & Downloads

cqsh is a command line interface for MarkLogic. cqsh was built to be an alternative to the web interface cq that comes with MarkLogic. It has Readline capabilities and allows you to issue queries, load files, and interact with Mark Logic from a shell environment. cqsh can also be run in batch mode by reading from stdin or passing in a file path using the -f flag.

New in version 0.5.0:

  • Updated code to use new Java XCC connectivity library
  • New load command options --permission, --collection, --quality

This project was contributed by Andy Bruno of O'Reilly Media.


  • It doesn't seem to work: $ cqsh -u <username> -p <password> -H <local-ipaddress> -P 8000 Failed to connect to Mark Logic. Invalid connection information. Error: Connection failed Goodbye. I can access qconsole on that port fine in the browser.
    • Hi Ernest. This project hasn't been updated since 2010 and is likely out of date. I'd encourage you to give <a href="http://docs.marklogic.com/guide/qconsole">Query Console</a> a try. Depending on what you're trying to do, you might also find <a href="https://github.com/lonhutt/mlrepl">mlrepl</a>, the <a href="https://github.com/marklogic/python_api">Python API</a>, <a href="https://github.com/marklogic/roxy">Roxy</a>, or other projects helpful.
      • I'm trying to find out if there's a way to script xqueries for these tasks: - backups, create user & attach it to a role, rename forest in linux. Qconsole is fine but this is still manual process and I'm looking a way to fully automate it. Is there a way to run xqueries from command line? Thank you