Writing Queries Faster and Embedding Code Snippets¶
Alation Cloud Service Applies to Alation Cloud Service instances of Alation
Customer Managed Applies to customer-managed instances of Alation
Most analysts have pieces of code they use over and over. You can use our embed functionality to easily embed the code you reuse the most in your queries in a few keystrokes. You can embed code in two different ways:
Embed and edit snippets of code you use frequently
Create standard un-editable pieces of code that can be used across teams
Embedding editable snippets of code¶
Many analysts use the same joins or clauses frequently. To save yourself time, and not rewrite these snippets of code over and over, we allow you to embed existing queries into new queries in Compose using the embed functionality of hotkeys.
Setting up your snippets¶
Create a query, like any other query in Alation.
Title the query #[name of snippet]. The “#” lets us know it is a snippet and intended to be expanded.
Save the query with your snippet in it and describe it.
Using your snippets¶
1. Click the embed button or use the Embed hotkeys (Help > Learn Hot Keys) - Type the name of your snippet, select it and press Shift + Enter. This will populate the code saved in the macro.