---
name: metabase_get_permission_graph
kind: function
lang: py
domain: infra
version: "1.0.0"
purity: impure
signature: "def metabase_get_permission_graph(client: MetabaseClient) -> dict"
description: "Obtiene el grafo de permisos de datos (databases/schemas/tables) de Metabase. Endpoint: GET /api/permissions/graph. El campo revision es crítico para concurrency control en el PUT posterior."
tags: [metabase, permissions, graph, databases, schemas, access-control, api, python]
uses_functions: []
uses_types: []
returns: []
returns_optional: false
error_type: "error_go_core"
imports: []
params:
  - name: client
    desc: "instancia autenticada de MetabaseClient con permisos de superusuario"
output: "dict: grafo completo con revision (int) y groups (group_id -> db_id -> {schemas, native}). El campo revision es obligatorio para el PUT."
tested: false
tests: []
test_file_path: ""
file_path: "python/functions/metabase/permissions.py"
---

## Ejemplo

```python
graph = metabase_get_permission_graph(client)
print("revision:", graph["revision"])
for group_id, dbs in graph["groups"].items():
    for db_id, perms in dbs.items():
        print(f"group={group_id} db={db_id}: {perms}")
```

## Notas

Siempre hacer GET fresco justo antes del PUT. El `revision` es el mecanismo de concurrency control nativo de Metabase — ver `metabase_update_permission_graph` para el patrón completo.
