Overview
QuerySurge AI Query Intelligence revolutionizes how users build and refine SQL by enabling them to create or modify queries through a simple, conversational interface. Instead of writing complex SQL from scratch, users can describe what they want in natural language, and QuerySurge AI will generate or adjust the query accordingly — automatically incorporating the schema information available from the selected connection. This intelligent assistant streamlines query development across QueryPairs, Staging Queries, and Reusable Query Snippets, making data validation faster, more intuitive, and accessible to users of all skill levels.
Using QuerySurge AI Query Intelligence
To launch QuerySurge AI Query Intelligence, click the AI icon in the Query Editor toolbar.
The wizard will open up to the Welcome card, which provides a description of how Query Intelligence works and the benefits it provides.
Click the Next button to move on to the Connection card.
Configuring your Connection
There are a few setup steps to complete before you can start talking to your data.
- Connection — an existing Connection to one of your data sources
- Schema Information — whether or not you'd like to give QI access to your schema
- Query Dialect — the dialect QI should use when generating your SQL
After selecting your Connection (note, this will automatically populate if you've already chosen one in the Query Editor), you'll see the high-level metadata. You have the option to initiate a metadata refresh at this point.
The query dialect matching this Connection will be automatically populated.
Some driver classes support more than one dialect, so you can modify this as you see fit by selecting a different dialect from the dropdown menu. If your desired dialect isn't available in the dropdown menu, you type it into the text field.
By default, the option to include schema information associated with your chosen Connection is toggled on. We recommend keeping this setting, as it improves the accuracy and overall usefulness of the wizard. However, if you wish to explicitly exclude all schema information, you can toggle it off.
You'll be able to specify the exact tables and columns that will be made available to QI later. Click the Next button to advanced to the Schema Selector card,
Choosing your Schema Information
From here, you can choose the precise tables and columns you wish to make accessible to QI. While it may be tempting to give it access to everything, please understand the implications this may have.
All models have a limited context window. And while these limits are getting bigger with each new generation of models, providing your entire set of schemas may exceed this limit. Even if the model can handle all of your schemas, tables, and columns, it can increase the number of tokens significantly.
We recommend exercising a bit more selectivity. It's important that the model has an understanding of the relationships between your tables and columns, but you don't want to overload it with thousands of tables that are wholly unrelated to the task at hand.
The schemas, tables, and columns on the left are what is available based on your Connection. To make them accessible to the model, move them to the right using the Add button, double-clicking a record, or right-clicking a record and using the context menu.
Of note, the context menu allows you to move records in bulk.
- Add (or Remove) all selected columns — moves all selected records
- Add (or Remove) all columns in this table — moves all records for the selected table
- Remove all columns — moves all records (only available for removals)
The Add and Remove buttons allow you to move all selected records, but the context menu provides a bit more flexibility and convenience.
Click the Next button to move on the QI chat card.
Talking to your Data
With the setup steps behind us, now you can start chatting with QuerySurge AI to craft your SQL queries.
Ask a question about your data or how to query it, and let the magic of QuerySurge AI do the heavy lifting.
It's as simple as that. Message back-and-forth just like you would on any messaging service, and let QuerySurge AI refine your SQL to your specifications.
Code Block Actions
There are a number of convenience functions available in the code block, each of which can be accessed by the buttons in the top-right corner of the markdown.
From left-to-right, the available icons represent the following actions.
- Copy to clipboard — copies the content of the code block to the clipboard
- Copy to message — copies the content of the code block and injects it into the editor (as a new code block)
- Copy to Source (or Target) editor — copies the content of the code block to the Query Editor
- Maximize (or Restore) — maximizes (or restores to its original size) the code block
Each code block has its own set of action icons, which operate independently of one another.
Code Editor
The message editor allows for formatted code blocks. To insert a code block, click the button in the bottom-left corner of the editor. You can now provide a syntax-highlighted SQL for QuerySurge AI to analyze.
Alternatively, you use the Copy to message icon to copy an entire SQL statement from one of the code blocks directly to the message editor.
Schema Panel
As you're interacting with QI, it's often helpful to remind yourself of the schema information you made accessible to QuerySurge AI. To do so, simply click the icon to view the Included Schema Information panel.
You can continue chatting while the panel is open if you so choose. And there you have it — the power of QuerySurge AI is at your fingertips.