feat: add BigQuery Python functions and BQClient type
Funciones CRUD completas para BigQuery: auth, datasets, tables, queries, jobs, routines, load/export. Tipo BQClient como wrapper del SDK oficial.
This commit is contained in:
@@ -0,0 +1,51 @@
|
||||
---
|
||||
name: bq_delete_dataset
|
||||
kind: function
|
||||
lang: py
|
||||
domain: infra
|
||||
version: "1.0.0"
|
||||
purity: impure
|
||||
signature: "def bq_delete_dataset(client: BQClient, dataset_id: str, delete_contents: bool = False) -> None"
|
||||
description: "Elimina un dataset de Google BigQuery. IRREVERSIBLE. Usa client._client.delete_dataset() del SDK oficial."
|
||||
tags: [bigquery, gcp, dataset, delete, google-cloud, python]
|
||||
uses_functions: []
|
||||
uses_types: []
|
||||
returns: []
|
||||
returns_optional: false
|
||||
error_type: "error_go_core"
|
||||
imports: [google-cloud-bigquery]
|
||||
params:
|
||||
- name: client
|
||||
desc: "instancia autenticada de BQClient"
|
||||
- name: dataset_id
|
||||
desc: "nombre del dataset a eliminar (sin prefijo de proyecto)"
|
||||
- name: delete_contents
|
||||
desc: "si True elimina todas las tablas y vistas del dataset antes de borrarlo; si False falla si el dataset contiene objetos"
|
||||
output: "None"
|
||||
tested: false
|
||||
tests: []
|
||||
test_file_path: ""
|
||||
file_path: "python/functions/bigquery/datasets.py"
|
||||
---
|
||||
|
||||
## Ejemplo
|
||||
|
||||
```python
|
||||
from bigquery.client import bq_auth
|
||||
from bigquery.datasets import bq_delete_dataset
|
||||
|
||||
client = bq_auth("my-project")
|
||||
|
||||
# Eliminar dataset vacio
|
||||
bq_delete_dataset(client, "temp_dataset")
|
||||
|
||||
# Eliminar dataset con todas sus tablas
|
||||
bq_delete_dataset(client, "temp_analytics", delete_contents=True)
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
IRREVERSIBLE. Todos los datos del dataset se pierden permanentemente.
|
||||
Lanza `google.api_core.exceptions.NotFound` (404) si el dataset no existe.
|
||||
Lanza `google.api_core.exceptions.BadRequest` (400) si el dataset contiene tablas y `delete_contents=False`.
|
||||
Por seguridad el valor por defecto de `delete_contents` es `False` — requiere confirmacion explicita para borrar contenido.
|
||||
Reference in New Issue
Block a user