Generate Your Script

Pyramid's Generative AI integration lets you use AI (powered by your underlying LLM engine) to generate SQL, SOQL, MDX, DAX, Python, or R statements. This may be useful if you want to generate code quickly, or aren't confident with the syntax that you need to use.

You can generate a script by clicking the Gen AI icon from the Properties panel. The Generate Your Script dialog opens. In the text field at the top of the dialog, type a description of the query you want to perform in natural language and click Run. The AI uses its underlying LLM to generate a script for you.

Where is this available?

You can generate a script from the following locations:

  • Scripted Sources: Generate a Python or R script and use it as a data source.
  • Scripting Nodes: Generate Python or R scripts and inject them into the Data Flow.
  • Query Node: Generate SQL, SOQL, MDX, or DAX scripts to run queries against a data source.
  • Master Flow: Generate SQL expressions to directly query a database.

The Gen AI icon that you use to open the Generate Your Script dialog is present in the Properties panel.

Generate Your Script dialog

The Header for this dialog (Generate Your...) indicates the type of script that you are creating. It contains the following fields and buttons:

  • Header: The name of the dialog.
  • Text Field: Type a prompt that describes the query you want your new script to perform (purple arrow above). Click the arrow to submit your query description and return an AI generated script.
  • Schemas: (Query only.) The database schema (orange highlight); you can select the dimensions, elements, and views that are relevant to your description to simplify the query. See below for more information.
  • Script Window: The AI-generated script opens in the scripting window (green highlight).
  • Explain Code: Open a dialog containing an AI-generated explanation of the script in the scripting window (yellow arrow).
  • Apply: Apply the script to the Query node.
  • Cancel: Close the dialog without applying any changes.

Schemas panel

When generating a script for a Query node (SQL, SOQL, MDX, or DAX), the dialog includes a Schemas panel, which shows the database schema. You can use this panel to select the model data (dimensions, elements, and views) that are relevant to your script.

Selecting only relevant model data in this panel:

  • Simplifies the query, allowing the results to be generated and returned as quickly as possible. This is particularly important if you have a very large data model.
  • Excludes data from being passed to the LLM for analysis. This allows you to keep your data secure and private.

Tip: You can search the Schemas panel for particular objects. Click the magnifier (blue arrow, above) to open the search field and type either the first few characters in the object name or the asterisk wildcard (*) and a string contained anywhere in the object name.

Explain Script

Use the Explain Script function to produce an AI-generated explanation of what the script does (note this is available even if the script was not itself AI-generated). Note: Each time you click the Explain Script button, a new explanation is generated. For more information, see Explain Script.

Warning: When using LLMs, your assets are generated using public domain algorithms. This can produce erroneous and inconsistent or random results. Use at your own risk.