sadpandajoe commented on code in PR #44126:
URL: https://github.com/apache/superset/pull/44126#discussion_r4075858399


##########
docs/admin_docs/configuration/configuring-superset.mdx:
##########
@@ -606,6 +606,39 @@ def FLASK_APP_MUTATOR(app: Flask) -> None:
     app.before_request_funcs.setdefault(None, 
[]).append(make_session_permanent)
 ```
 
+## Reacting to chart and dashboard creation
+
+`AFTER_ASSET_CREATE` is an optional hook that runs after a chart or dashboard
+is created, letting deployments react to new assets without forking the
+creation commands or views — for example to auto-categorize the asset, write
+an audit log entry, or fire a notification.
+
+The hook receives the model instance and the asset type string (`"chart"` or
+`"dashboard"`):
+
+```python
+# superset_config.py
+def _after_asset_create(model, asset_type):
+    audit_log.write(f"{asset_type} {model.id} created by {model.created_by}")
+
+
+AFTER_ASSET_CREATE = _after_asset_create
+```
+
+It defaults to `None`, which is a no-op: with nothing configured, chart and
+dashboard creation behaves exactly as it did before this hook existed.
+
+The hook runs before the surrounding database transaction commits, so an
+exception raised inside it aborts the chart or dashboard creation. Keep it
+fast and side-effect-light, and avoid raising unless you intend to cancel
+the creation.
+
+The hook fires for any chart or dashboard created through the REST API

Review Comment:
   This also omits REST copies: `POST /api/v1/dashboard/<id>/copy/` creates a 
dashboard (and optionally cloned charts) without this hook, so an audit or 
notification integration silently misses those assets. Could this narrow the 
claim to the REST create endpoints, or document the copy/import exclusions?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to