feat: metabase_setup Python, fix list_databases, volumen Docker en init_metabase
Nueva función metabase_setup para setup inicial via API. Fix list_databases que no extraía data del response wrapper. Pipeline init_metabase soporta --mb-volumes para montar SQLite como volumen con fix de permisos automático. Añadido .env a gitignore. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
---
|
||||
name: metabase_add_database
|
||||
kind: function
|
||||
lang: py
|
||||
domain: infra
|
||||
version: "1.0.0"
|
||||
purity: impure
|
||||
signature: "def metabase_add_database(client: MetabaseClient, name: str, engine: str, details: dict) -> dict"
|
||||
description: "Agrega una nueva database a Metabase via POST /api/database. Soporta cualquier engine (sqlite, postgres, mysql, etc.)."
|
||||
tags: [metabase, database, add, create, api, python]
|
||||
uses_functions: []
|
||||
uses_types: [MetabaseClient_go_infra]
|
||||
returns: []
|
||||
returns_optional: false
|
||||
error_type: "error_go_core"
|
||||
imports: [httpx]
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "python/functions/metabase/databases.py"
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```python
|
||||
# SQLite
|
||||
db = metabase_add_database(client, "Ops DB", "sqlite", {"db": "/data/operations.db"})
|
||||
print(db["id"])
|
||||
|
||||
# Postgres
|
||||
db = metabase_add_database(client, "Prod PG", "postgres", {
|
||||
"host": "localhost",
|
||||
"port": 5432,
|
||||
"dbname": "myapp",
|
||||
"user": "reader",
|
||||
"password": "secret",
|
||||
})
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
Requiere permisos de superusuario. El campo `details` depende del engine:
|
||||
para SQLite solo necesita `{"db": "/ruta/archivo.db"}`.
|
||||
Retorna la database creada con su `id` asignado por Metabase.
|
||||
Reference in New Issue
Block a user