Hello @thari
To answer this issue you are facing:
What’s actually happening here is that when you try to write to a Delta table managed by Unity Catalog within a QueryExecutionListener’s callback, Spark’s security context isn’t set up correctly. That means the process/thread handling the listener code doesn’t have the required Unity Catalog “credential scope” to authorize the table write, which triggers the MissingCredentialScopeException.
This isn’t just a weird bug—it’s by design. Unity Catalog expects all privileged operations (like Delta writes) to run in a proper user session context, and the threads running listeners like QueryExecutionListener simply don’t have that context. In other words, the Spark engine is running your callback code in a background thread that knows nothing about who you are, so there’s nothing to pass along as credentials to Unity Catalog.
The fix is to move your Delta write logic out of the QueryExecutionListener and into the main job flow.
Hope this answers your doubt.