- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-20-2026 10:42 AM
Hi everyone,
I am looking to create a notebook that, when executed by a user, performs the following actions:
Retrieves all Databricks jobs created by the current user
Checks whether a specific role already has permissions on those jobs
Automatically adds the required role permission if it is missing
The goal is to ensure that all jobs created within our team are visible and manageable by a common team role for better collaboration.
I am looking for the best approach, sample implementations, or best practices would be appreciated.
Thank you!
- Labels:
-
Delta Lake
-
Spark
-
Workflows
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-21-2026 03:18 AM
Hi @Raj_DB
You can use databricks SDK to retrieve all jobs filter them by selecting only those where owner is current user
something like this
from databricks.sdk import WorkspaceClient
w = WorkspaceClient()
# Specify the user email/username you want to filter for
current_user = w.current_user.me()
# Retrieve and filter jobs
user_jobs = [
job for job in w.jobs.list()
if job.creator_user_name == current_user.userName
]
# Print the results
for job in user_jobs:
print(f"Job ID: {job.job_id}, Name: {job.settings.name}")
permissions = w.jobs.get_permissions(job_id=job.job_id)
for access_control in permissions.access_control_list:
print(f"Principal: {access_control.user_name or access_control.group_name}")
print(f"Permission Level: {access_control.all_permissions[0].permission_level}")
APIs of interest
https://docs.databricks.com/api/workspace/jobs/get
https://docs.databricks.com/api/workspace/jobs/getpermissions
https://docs.databricks.com/api/workspace/jobs/updatepermissions