feat: funciones Python para API Metabase
Añade módulo Python con funciones para la API de Metabase en dominio infra. Incluye cliente HTTP, auth, y CRUD de cards, dashboards y users. Proyecto gestionado con uv (pyproject.toml).
This commit is contained in:
@@ -0,0 +1,39 @@
|
||||
---
|
||||
name: metabase_update_dashboard
|
||||
kind: function
|
||||
lang: py
|
||||
domain: infra
|
||||
version: "1.0.0"
|
||||
purity: impure
|
||||
signature: "def metabase_update_dashboard(client: MetabaseClient, dashboard_id: int, **fields) -> dict"
|
||||
description: "Actualiza dashboard incluyendo metadata, cards y tabs via kwargs. dashcards es el estado completo deseado: nuevas con ID negativo, existentes con positivo, omitidas se eliminan. Endpoint: PUT /api/dashboard/:id."
|
||||
tags: [metabase, dashboard, update, cards, api, python]
|
||||
uses_functions: []
|
||||
uses_types: []
|
||||
returns: []
|
||||
returns_optional: false
|
||||
error_type: "error_go_core"
|
||||
imports: [httpx]
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "python/functions/metabase/dashboards.py"
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```python
|
||||
# Agregar card
|
||||
dash = metabase_get_dashboard(client, 1)
|
||||
cards = list(dash["dashcards"])
|
||||
cards.append({"id": -1, "card_id": 55, "size_x": 6, "size_y": 4, "col": 0, "row": 0})
|
||||
metabase_update_dashboard(client, 1, dashcards=cards)
|
||||
|
||||
# Archivar
|
||||
metabase_update_dashboard(client, 1, archived=True)
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
dashcards = estado completo. ID negativo = nueva, positivo = existente, omitida = eliminada.
|
||||
Campos: name, description, archived, dashcards, tabs, parameters, collection_id.
|
||||
Reference in New Issue
Block a user