feat(metabase): nuevos modulos — snippets, notifications, dashboard_filters
Tres modulos nuevos con funciones CRUD completas: - snippets: list, get, create, update, archive (SQL reutilizable) - notifications: list, create_card_alert, create_dashboard_subscription, update, delete - dashboard_filters: add_dashboard_filter (parameter_mappings sobre cards existentes) Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,64 @@
|
||||
---
|
||||
name: metabase_update_notification
|
||||
kind: function
|
||||
lang: py
|
||||
domain: infra
|
||||
version: "1.0.0"
|
||||
purity: impure
|
||||
signature: "def metabase_update_notification(client: MetabaseClient, notification_id: int, **fields) -> dict"
|
||||
description: "Actualiza una notificacion existente de Metabase (alerta o suscripcion). Permite modificar active, handlers, subscriptions o payload. Endpoint: PUT /api/notification/:id."
|
||||
tags: [metabase, notification, update, api, python]
|
||||
uses_functions: []
|
||||
uses_types: []
|
||||
returns: []
|
||||
returns_optional: false
|
||||
error_type: "error_go_core"
|
||||
imports: []
|
||||
params:
|
||||
- name: client
|
||||
desc: "instancia autenticada de MetabaseClient"
|
||||
- name: notification_id
|
||||
desc: "ID de la notificacion a modificar"
|
||||
- name: "**fields"
|
||||
desc: "campos a actualizar: active (bool), handlers (list[dict]), subscriptions (list[dict]), payload (dict)"
|
||||
output: "dict: notificacion actualizada con id, active, payload_type, payload, subscriptions, handlers, updated_at"
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "python/functions/metabase/notifications.py"
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```python
|
||||
# Desactivar una alerta
|
||||
updated = metabase_update_notification(client, 99, active=False)
|
||||
print(updated["active"]) # False
|
||||
|
||||
# Cambiar destinatarios
|
||||
updated = metabase_update_notification(
|
||||
client,
|
||||
99,
|
||||
handlers=[{
|
||||
"channel_type": "channel/email",
|
||||
"recipients": [
|
||||
{"type": "notification-recipient/user", "user_id": 2},
|
||||
],
|
||||
}],
|
||||
)
|
||||
|
||||
# Cambiar cron a diario a las 7am
|
||||
updated = metabase_update_notification(
|
||||
client,
|
||||
99,
|
||||
subscriptions=[{
|
||||
"type": "notification-subscription/cron",
|
||||
"cron_schedule": "0 7 * * *",
|
||||
}],
|
||||
)
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
Solo se envian los campos que se pasan como kwargs.
|
||||
Para reactivar una alerta previamente desactivada usar active=True.
|
||||
Reference in New Issue
Block a user