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
+48
View File
@@ -0,0 +1,48 @@
---
name: bq_get_table
kind: function
lang: py
domain: infra
version: "1.0.0"
purity: impure
signature: "def bq_get_table(client: BQClient, dataset_id: str, table_id: str) -> dict"
description: "Obtiene los metadatos completos de una tabla BigQuery incluyendo schema, estadisticas y configuracion. Usa client._client.get_table() del SDK oficial."
tags: [bigquery, gcp, table, get, google-cloud, python]
uses_functions: []
uses_types: []
returns: []
returns_optional: false
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 consultar"
output: "dict con metadata completa: table_id, dataset_id, project, full_id, schema (lista de dicts), num_rows, num_bytes, created (ISO 8601), modified (ISO 8601), type, partitioning, clustering, description, labels"
tested: false
tests: []
test_file_path: ""
file_path: "python/functions/bigquery/tables.py"
---
## Ejemplo
```python
from bigquery import bq_auth, bq_get_table
client = bq_auth("mi-proyecto")
tabla = bq_get_table(client, "ventas_ds", "transacciones")
print(tabla["full_id"]) # mi-proyecto.ventas_ds.transacciones
print(tabla["num_rows"]) # filas totales
print(tabla["num_bytes"]) # bytes almacenados
for col in tabla["schema"]:
print(col["name"], col["type"], col["mode"])
```
## Notas
`num_rows` y `num_bytes` son estadisticas actualizadas por BigQuery periodicamente (pueden tener un pequeno retraso). El campo `type` puede ser TABLE, VIEW, MATERIALIZED_VIEW o EXTERNAL. `partitioning` es None si la tabla no tiene particionamiento. `created` y `modified` estan en formato ISO 8601.