cancel
Showing results for 
Search instead for 
Did you mean: 
Data Governance
Join discussions on data governance practices, compliance, and security within the Databricks Community. Exchange strategies and insights to ensure data integrity and regulatory compliance.
cancel
Showing results for 
Search instead for 
Did you mean: 

Enable lineage data system tables

Hubert-Dudek
Esteemed Contributor III

Execute the below Python code in your databricks workspace to enable lineage system tables

 

import requests
ctx = dbutils.notebook.entry_point.getDbutils().notebook().getContext()
api_url = ctx.tags().get("browserHostName").get()
api_token = ctx.apiToken().get()
headers = {'Authorization': f'Bearer {api_token}'}
account_id = ctx.tags().get("accountId").get()
# get metastore id
url = f'https://{api_url}/api/2.1/unity-catalog/metastores'
metastore_id = requests.get(url, headers=headers).json()['metastores'][0]['metastore_id']
# enable lineage tables
url = f'https://{api_url}/api/2.0/unity-catalog/metastores/{metastore_id}/systemschemas/access'
requests.put(url, headers=headers)

 

ezgif-1-9a34272eba.gif

1 REPLY 1

iplantevin
New Contributor III

Great, I wondered why I didn't see them 👍