HomeGuidesRecipesAPI ReferencePython SDK
Alation Help Center
Recipes

Refresh Access Tokens

This recipe checks if API and Refresh Tokens have expired and creates new ones when needed.

The idea is that the script can be run daily and it will make sure that a valid refresh and API token always exist so that other scripts that depend on them can always authenticate.

Written using Python 3.

IN THIS RECIPE
  1. Declare libraries
  2. Set the catalog url and token file name
  3. Open, read the token file, and close it
🦉
Refresh Access Tokens

This recipe checks if API and Refresh Tokens have expired and creates new ones when needed.

The idea is that the script can be run daily and it will make sure that a valid refresh and API token always exist so that other scripts that depend on them can always authenticate.

Written using Python 3.

13 Steps
🦉
Authentication with OAuth 2.0 API

This recipe shows how to use the OAuth 2.0 API v2 to authenticate Alation API calls. To use this recipe, you must be an Alation Cloud Service customer on the cloud-native architecture.

Written using Python 3.

8 Steps
🦉
Pagination Example 1

This recipe demonstrates how to use the Alation API pagination feature by paginating through all columns in a BI report. Pagination is the process of looping through batches of assets until all have been processed.

Almost all Alation APIs use the same pagination technique so this example can be applied as a general pattern beyond BI reports.

Written in Python 3.

3 Steps
🦉
Pagination Example 2

This recipe demonstrates how to use the Alation API pagination feature by paginating through all articles in a catalog. Pagination is the process of looping through batches of assets until all have been processed.

Almost all Alation APIs use the same pagination technique so this example can be applied as a general pattern beyond articles.

Written in Python 3.

5 Steps
🦉
Get Relational Schemas

This recipe uses the Relational API to get all the schemas for a specific data source.

Written in Python 3.

4 Steps
🦉
Get a Table that matches specific Id

This recipe uses the Relational Integration API to get the details for a table with a specific ID.

Written using Python 3.

3 Steps
🦉
Get Tables that match a custom field

This recipe uses the Relational Integration API to get all tables where a specific custom field is set to a specific value.

Written using Python 3.

3 Steps
🦉
Update Custom Fields for a Table

This recipe uses the Relational Integration API to update custom field values for a specific table.

It then uses the Job API to monitor and indicate when the update is completed.

Written using Python 3.

5 Steps
🦉
Create a Column

This recipe uses the Relational Integration API to create a new column for a specific table.

It then uses the Job API to monitor and indicate when the creation has completed.

Written using Python 3.

5 Steps
🦉
Create a Dataflow

This recipe uses the DataFlow API to create a new dataflow object.

It then uses the Job API to monitor and indicate when the creation is completed.

Written using Python 3.

4 Steps
🦉
Delete a Table

This recipe uses the Relational Integration API to delete a specific table.

It then uses the Job API to monitor and indicate when the delete is completed.

Written using Python 3.

4 Steps
🦉
Delete a Dataflow Object

This recipe uses the DataFlow API to delete a dataflow object.

It then uses the Job API to monitor and indicate when the deletion is completed.

Written using Python 3.

4 Steps
🦉
Get Info of Dataflow object

This recipe uses the DataFlow API to retrieve details of a dataflow object.

Written using Python 3.

3 Steps
🦉
Create lineage between two tables

This recipe uses the Lineage API to create a new lineage relationship between two tables.

It then uses the Job API to monitor and indicate when the creation is completed.

Written using Python 3.

4 Steps
🦉
Update custom metadata/descriptions for BI Objects

This recipe uses the BI Source API to find a specific BI folder in a BI source.

Then it uses the Custom Field ID to find the rich text custom fields on that BI folder and update its value.

1 Steps
🦉
Retrieve and update table description and flags

This recipe uses the Relational Integration API to get a specific table.

It then uses Upload Logical Metadata API to update two custom fields for the table.

Finally, it uses the Flag API to update a flag for the table.

1 Steps
🦉
Search API Example

This recipe uses the Search API to find all columns where the name includes 'lname'.

Written in Python 3.

5 Steps
🦉
Check for a Glossary's Existence

This recipe uses the Search API to find a specific glossary by name.

Written in Python 3.

5 Steps
🦉
Add Tags to Columns from CSV File

This recipe uses the Tags API to demonstrate how to read a pipe-delimited csv file and add tags to columns in an Alation catalog.

Written in Python 3.

6 Steps
🦉
Load Terms from a CSV File

This recipe uses the Term API to add terms with titles and descriptions to the catalog.

It reads from a CSV file and also checks to see if the term already exists.

Written in Python 3.

6 Steps
🦉
Get Steward Names for Columns

This recipe uses the Relational Integration API to retrieve the steward ID for a column. It then uses the Groups API or User API to get the name depending on whether the steward is a group or a user.

Written in Python 3.

6 Steps
🦉
Load Queries from a CSV File

This script uses a pipe-delimited CSV file containing query titles, descriptions, and SQL to create queries in a catalog data source and give them a name.

It's different from the builtin SQL upload capability in the following ways:

  • It creates Compose queries not historical queries
  • It gives the queries a name
  • It gives the queries a description
  • It allows the user to upload the queries as draft or saved
  • It gives queries a tag

The user should understand that it will not update existing queries. New queries
will be created each time. Also, keep in mind that queries can not be deleted (only discarded).

Written in Python 3.

4 Steps
🦉
Get Count of Total Columns in Catalog

This recipe uses the Search API to get the total number of columns in the catalog.

The number of columns is a byproduct of the search returning the total number of assets.

Written in Python 3.

5 Steps
🦉
Write Users to CSV File

This recipe uses the User API to loop through all users and write them out to a CSV file.

Written in Python 3.

4 Steps
🦉
Update Domain Membership

This recipe uses the Domains API to demonstrate how to add or remove an asset from membership in the domain.

Written in Python 3.

4 Steps
🦉
Write Queries to CSV

This recipe writes all the queries for a data source to a CSV file.

Written in Python 3.

8 Steps
🦉
Get Queriers of Schemas

This recipe finds the top queries for each data source schema.

Written in Python 3.

7 Steps
🦉
Add Compose Query Results to a Dataframe

This recipe uses the Query API to retreive the latest results of Compose queries and add them to a Pandas dataframe.

Written in Python 3.

7 Steps
🦉
Report on Data & BI Source Health

This recipe uses the Relational Integration API, BI Source API, Article API, Flag API, and Token API.

It checks for flags on each source and creates a single HTML health status table that is updated in the body of an article.

It can be used to give users a single, consolidated view of data source health.

9 Steps
🦉
Set Up a New Alation Agent

This recipe uses the Alation Agent API to download, install, and configure an Alation Agent and connect the Agent to Alation. This recipe is written to work on all supported Linux varieties out of the box.

Written in Python 3.

16 Steps
🦉
Agent Re-Setup

Use this recipe to set up an existing Agent on a new machine. This recipe uses the Alation Agent API to download, install, and configure an Alation Agent and connect the Agent to Alation, then reinstall its connectors. This recipe is written to work on all supported Linux varieties out of the box.

Written in Python 3.

16 Steps
🦉
Agent Resync

This recipe will reinstall all connectors on an existing agent.

Written in Python 3.

8 Steps
🦉
Get All Objects Belonging to a Domain

This recipe demonstrates how to use the search API to find all objects belonging to a domain

7 Steps
🦉
Create Custom Fields in Bulk

This recipe uses the Custom Field API to create Custom Fields in bulk. It will return a Job ID, which can be used in the Job API to monitor and indicate when the bulk creation has completed.

Written in Python 3

4 Steps
🦉
Create Business Policies in Bulk

This recipe can be used to create one or more business policies.

Written using Python 3.

4 Steps
🦉
Update Business Policies in Bulk

This recipe can be used to update one or more business policies.

Written using Python 3.

4 Steps
🦉
Create Workflow Requests in Bulk

This recipe can be used to create one or more workflow change requests.

NOTE - The Create a request endpoint only allows a single workflow request at a time. This script shows how to create the workflow requests with sequential API requests.

Written using Python 3.

6 Steps
🦉
Review Workflow Requests in Bulk

This recipe can be used to review one or more workflow change requests.

NOTE - The Approve a review request and Reject a review request endpoints only allow a single workflow request review at a time. This script shows how to review the workflow requests with sequential API requests.

Written using Python 3.

5 Steps
🦉
Migrate Article Children

This recipe demonstrates how to migrate child articles to a new parent article in the Alation catalog.

Written using Python 3.

7 Steps
🦉
Upload Data Dictionaries

This recipe can be used to upload one or more data dictionary CSV files. Examples are included for data dictionaries starting at the data source level, schema level, and table level.

Written using Python 3, Shell (Bash), Node JS, and PHP (curl).

8 Steps
🦉
Managing Member Permissions

This recipe can be used to manage user and group permissions for one or more tables in the data catalog.

Written using Python 3, Shell (Bash), Node JS, and PHP (curl).

8 Steps
🦉
Create Documents in Bulk

This recipe can be used to bulk create documents in the data catalog using JSON payload define in a separate file.

The expected JSON payload can be created using the Create documents endpoint.

Written using Python 3, Shell (Bash), Node JS, and PHP (curl).

7 Steps
🦉
Update Multipicker Custom Field Values for a List of Objects

The script uses Alation REST APIs to update multipicker custom fields for a set of objects specified in a CSV file. It preserves existing values and appends new ones based on predefined variables.

Written in Python 3.

9 Steps
🦉
Add Data to a NoSQL Data Source in Bulk

This recipe can be used to bulk add data into a virtual NoSQL data source in the data catalog using a JSON payload defined in a separate file.

The expected JSON payload can be created using the Create NoSQL metadata endpoint.

Written using Python 3, Shell (Bash), Node JS, and PHP (curl).

7 Steps
🦉
Determine Folder Template Built-In and Custom Fields

This recipe can be used to get a listing of built-in and custom fields that are configured in the folder templates assigned to each Document Hub folder.

This recipe does not need external files, only the base URL and access token values need to be updated.

Written using Python 3, Shell (Bash), Node JS, and PHP (curl).

7 Steps
🦉
Add Folders to Document Hubs in Bulk

This recipe can be used to bulk create folders in one or more different Document Hubs in the data catalog using a JSON payload defined in a separate file.

The expected JSON payload can be created using the Create folders endpoint.

Written using Python 3, Shell (Bash), Node JS, and PHP (curl).

6 Steps
🦉
Managing the Search Synonym Manifest

This recipe can be used to manage the synonym manifest that is used for Synonym Search.

The expected JSON payload must contain a properly formatted listing of synonym pairs.

Written using Python 3, Shell (Bash), Node JS, and PHP (curl).

10 Steps
🦉
Update Group Homepage Preferences in Bulk

This recipe can be used to manage homepage preferences for one or more groups using a CSV file.

Written using Python 3, Shell (Bash), Node JS (node-fetch), and PHP (curl).

10 Steps
🦉
Find All Article Attachments

This recipe is intended to help you identify articles that have attachments in your instance of Alation.

This information should help you rationalize the attachments that currently reside on your instance in order to retire them or move them to a different platform before performing article migration to the new document structure.

NOTE: Currently, Legacy Attachments are migrated, but will be inaccessible soon. New attachments cannot be added to documents.

Written using Python 3, Shell (Bash), Node JS (node-fetch), and PHP (curl).

6 Steps