Forum Discussion

kjetil_hamre's avatar
kjetil_hamre
Frequent Visitor
9 months ago
Solved

setting onelake security column level security programmatically

Hi,

I am very keen to see Onelake security in production. However, I would like to set column level security programmatically in a metadata driven setup of ingest into a medallion architecture. 

 

I hear that the fabric rest api is the most mature programming interface. However I cannot see anything documented on onelake security. Indeed, when I set schema enabled on a lakehouse, I cannot even list tables.

import requests
token_string = mssparkutils.credentials.getToken(https://api.fabric.microsoft.com/)
header = {'Content-Type':'application/json','Authorization': f'Bearer {token_string}'}
response = requests.get(url=https://api.fabric.microsoft.com/v1/workspaces/{WORKSPACE_ID}/lakehouses/{LAKEHOUSE_ID}/tables, headers=header)

print("Status Code:", response.status_code)
print("Response JSON:", response.json())

------
Status Code: 400
Response JSON: Response JSON: {'requestId': 'blablah', 'errorCode': 'UnsupportedOperationForSchemasEnabledLakehouse', 'message': 'The operation is not supported for Lakehouse with schemas enabled.'}

And I find no mention of any attributes regarding onelake security! Anybody has any information on if there is something available now, or if there is going to be something on this soon? Or if there is some other way of setting these things programmatically. 

Thank you
K

2 Replies