Query Editor

The Query Editor allows you to create, edit and execute CQL scripts.

DataStax DevCenter is compatible with DataStax Enterprise (DSE) versions up to 5.0.

Editing 

Create and edit a CQL script in a tab. Each tab is associated with a connection and the CQL script can be executed with a single click.

Besides normal editing functionality, such as cutting, copying, and pasting, the Query Editor also has:
  • syntax highlighting for CQL
  • code completion
  • real-time error detection (errors are underlined in red, and hovering over the red error icon reveals the error)

Query editor contextual menu 

Right-clicking on an element in the CQL displays a contextual menu. The Source submenu consists of:
Source > Toggle Comment
toggles a comment on or off; works with single or multiple lines
Source > Format
formats CQL statement
Source > Content Assist

Run using connection 

Associate a tab in the Query Editor to:
  • run with any of the connections in the Connection Manager
  • use a chosen default keyspace
  • limit the number of rows returned by a statement (limit 1000 rows returned)

Execute CQL Script  

Execute all the CQL statements in the current editor tab.

By default, CQL statements are executed with a consistency level of ONE, but this can be changed to QUORUM or ALL. You can choose a different consistency level by clicking on the arrow to the right of the Execute CQL Script button and selecting the level.

Execute selected statement 

Execute a single or multiple statements by highlighting them:
  • Mac OS X: typing ⌥+F11
  • Alt+F11 (Linux, Windows).
The statement may be partially highlighted also. When you execute a partially highlighted statement, the entire statement is first selected and then executed.

Code completion 

The Query Editor has two types of code completion (activated by pressing Ctrl-Spacebar).
  • code snippets: predefined complete CQL statements
  • keywords and database identifiers: contextual code completion

Add your own code snippets by using the Preferences dialog by selecting File > Preferences > Cql > Templates.

Real-time error detection and correction 

Errors are detected by DevCenter in real-time (before a script is executed) based on the selected connection, keyspace, and other metadata about the cluster. The error is indicated by a red underline. By hovering the mouse cursor over the error a list containing possible quick fixes displays.

Preventing execution of CQL scripts containing syntax errors 

If you try to execute CQL with a syntactic error in it, the code does not execute, and a dialog displays. This prevents DevCenter from sending incorrect or incomplete CQL statements. A syntax error disables the execution of the entire script.

DSE search support 

The Query Editor supports the following DSE Search features:
  • Automatic routing of Solr queries to Solr node on execution
    • Aware of DSE nodes and their workload
  • String and JSON query formats
  • Query parameter name and type checking
  • Separate grouping in Schema View for Search Indices
  • Validations
  • Content Assist
  • Code Snippets (Templates)
  • Solr REST to CQL conversion