SQL Completion

SQL Completion

SQL Completion is an advanced feature integrated within the Y42 platform designed to enhance the efficiency of data professionals. It acts as a smart assistant for writing and optimizing SQL queries, seamlessly connecting with your existing Y42 data workflows to provide real-time guidance and suggestions.

The SQL Completion engine has context of assets in your repository and their respective columns.

Enabling the SQL Completion

To enable the SQL Completion feature:

  1. Open the space Settings.
  2. Navigate to Features.
  3. Locate the Enable GenAI section. Select Enabled from the dropdown to activate it for your workspace.

Working with SQL Completion

From the main menu, select the List / Lineage / Code view in the Asset Editor. Select any SQL model asset and navigate to the Query tab.

Once you are in an editor window, you can see SQL suggestions appearing in real-time as you type in SQL code. You can accept suggestions by pressing Tab for the entire code suggestion or CMD + → (Mac) / CTRL + →(Windows) for individual word sugggestions.

Code completion suggestions.

Code completion suggestions.

To alternate between completions, hover over the suggested code and use the navigation arrows to rotate through suggestions.

Rotating through code completion alternatives.

Rotating through code completion alternatives.

Best Practices

  • For more accurate or full code block suggestions, add a SQL comment, explaining what the model should do in the form of a prompt:

    Example: -- Join table X and Y where X.value is less than Y.value