Strategy ONE
Auto SQL in Mosaic Studio
Auto SQL helps you write freeform SQL queries to populate tables within your Mosaic models. This tool leverages artificial intelligence to guide and streamline the process of SQL query creation, making it more accessible and efficient.
Access and Use Freeform Auto SQL
-
Choose a database instance and click Connect.
-
Click Add free-form SQL.
The free-form SQL workspace displays and the Auto SQL Chatbot displays on the right.
-
Click your target data source. Expand the required tables.
-
Right-click a table and select Add to the Chat. If necessary, you can multi-select multiple tables.
Strategy recommends adding multiple tables for more accurate SQL generation.
-
Type your question.
Auto SQL generates the SQL for you.
-
To automatically send the generated SQL into the Freeform SQL input box, click Insert.
-
Verify the generated SQL and make edits as necessary.
-
Click Execute SQL and view the results in the Data Preview pane.
-
Click Add Table.
-
Click Save.
Use Auto SQL to Explain SQL
Auto SQL analyzes the SQL and provides a concise summary of your query:
-
Copy your SQL to the input field and hit
Enter
. -
Under your entry, click Explain.
Auto SQL analyzes the SQL and provides a concise summary for your query.
Use Auto SQL to Optimize SQL
Auto SQL analyzes your SQL and provides you with guidance to improve your query:
-
Copy your SQL to the input field and hit
Enter
. -
Under your entry, click Optimize.
Auto SQl analyzes the SQL and provides you with guidance to improve your query.
Best Practices for Using Auto SQL
-
Know your Mosaic model: Auto SQL does not know any details about the structure of your tables and data, it instead helps to combine the SQL. Understand your Mosaic model to fully leverage Auto SQL capabilities. Auto SQL picks tables by their name, not the content, meaning you need to understand if the object is sourced from a correct table.
-
Narrow down: Use Add to the Chat to add tables to the conversation to increase generated SQL quality and response time. Vast schemas can quickly cross the maximum available question size.
-
Be specific: Provide as many details as possible for your input. Try using the names of columns that exist in your database.
-
Iterate: Build incremental queries, add new fields, and give more details on your question. With corrections and adjustments, you can create a good SQL structure that can serve as a starting point for you to continue.
-
Ensure data quality: Auto SQL does not check if columns are empty or contain nulls. If your prompt returns no rows, verify the quality of data and filtering conditions.
Known Limitations
Auto SQL is supported for database sources only.