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:
2026-04-07 18:45:02 +02:00
parent c9f28aa603
commit 9f5e6791db
33 changed files with 2720 additions and 0 deletions
@@ -0,0 +1,51 @@
---
name: bq_delete_table
kind: function
lang: py
domain: infra
version: "1.0.0"
purity: impure
signature: "def bq_delete_table(client: BQClient, dataset_id: str, table_id: str) -> None"
description: "Elimina permanentemente una tabla de BigQuery. IRREVERSIBLE. Usa client._client.delete_table() del SDK oficial."
tags: [bigquery, gcp, table, delete, google-cloud, python]
uses_functions: []
uses_types: []
returns: []
returns_optional: true
error_type: "error_go_core"
imports: [google-cloud-bigquery]
params:
- name: client
desc: "cliente autenticado BQClient obtenido con bq_auth"
- name: dataset_id
desc: "ID del dataset que contiene la tabla"
- name: table_id
desc: "nombre (ID) de la tabla a eliminar"
output: "None. Lanza excepcion si la tabla no existe o no hay permisos"
tested: false
tests: []
test_file_path: ""
file_path: "python/functions/bigquery/tables.py"
---
## Ejemplo
```python
from bigquery import bq_auth, bq_delete_table
client = bq_auth("mi-proyecto")
# Eliminar tabla temporal
bq_delete_table(client, "mi_dataset", "tabla_temporal_2024")
# Verificar que no existe (capturar excepcion)
from google.api_core.exceptions import NotFound
try:
bq_delete_table(client, "mi_dataset", "tabla_que_no_existe")
except NotFound as e:
print(f"No encontrada: {e}")
```
## Notas
La eliminacion es PERMANENTE — BigQuery no tiene papelera de reciclaje para tablas. Considerar exportar los datos a GCS antes de eliminar si hay posibilidad de necesitarlos. Si el dataset tiene `defaultTableExpirationMs` configurado, las tablas se pueden dejar expirar automaticamente en vez de eliminar manualmente. Requiere permiso `bigquery.tables.delete` sobre el dataset.