---
name: metabase_update_snippet
kind: function
lang: py
domain: infra
version: "1.0.0"
purity: impure
signature: "def metabase_update_snippet(client: MetabaseClient, snippet_id: int, **fields) -> dict"
description: "Actualiza campos de un SQL snippet en Metabase. Acepta name, content, description, collection_id, archived via **fields."
tags: [metabase, snippet, update, api, python]
uses_functions: []
uses_types: [MetabaseClient_go_infra]
returns: []
returns_optional: false
error_type: "error_go_core"
imports: [httpx]
params:
  - name: client
    desc: "instancia autenticada de MetabaseClient"
  - name: snippet_id
    desc: "ID numerico del snippet a actualizar"
  - name: "**fields"
    desc: "campos a modificar: name (str), content (str), description (str), collection_id (int), archived (bool)"
output: "dict: snippet actualizado con todos los campos incluyendo updated_at"
tested: false
tests: []
test_file_path: ""
file_path: "python/functions/metabase/snippets.py"
---

## Ejemplo

```python
# Actualizar solo el contenido SQL
updated = metabase_update_snippet(
    client, 42,
    content="WITH supply_full AS (SELECT * FROM supply_orders)",
    description="Version simplificada sin JOINs",
)
print(updated["updated_at"])

# Renombrar
metabase_update_snippet(client, 42, name="supply_orders_simple_cte")

# Mover a otra coleccion
metabase_update_snippet(client, 42, collection_id=7)

# Archivar (o usar metabase_archive_snippet)
metabase_update_snippet(client, 42, archived=True)
```

## Notas

Solo los campos reconocidos (name, content, description, collection_id, archived) se incluyen en el body.
Campos desconocidos en **fields se ignoran silenciosamente para evitar errores 400.
Para archivar en una sola llamada, preferir metabase_archive_snippet.
