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,45 @@
|
||||
---
|
||||
name: bq_get_dataset
|
||||
kind: function
|
||||
lang: py
|
||||
domain: infra
|
||||
version: "1.0.0"
|
||||
purity: impure
|
||||
signature: "def bq_get_dataset(client: BQClient, dataset_id: str) -> dict"
|
||||
description: "Obtiene los detalles completos de un dataset de Google BigQuery. Usa client._client.get_dataset() del SDK oficial."
|
||||
tags: [bigquery, gcp, dataset, 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: "instancia autenticada de BQClient"
|
||||
- name: dataset_id
|
||||
desc: "nombre del dataset a consultar (sin prefijo de proyecto)"
|
||||
output: "dict con dataset_id, project, full_id, location, description, labels, created, modified, default_table_expiration_ms"
|
||||
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_get_dataset
|
||||
|
||||
client = bq_auth("my-project")
|
||||
ds = bq_get_dataset(client, "analytics")
|
||||
print(ds["location"], ds["description"])
|
||||
print(ds["created"]) # ISO 8601: "2024-01-15T10:30:00+00:00"
|
||||
```
|
||||
|
||||
## Notas
|
||||
|
||||
Lanza `google.api_core.exceptions.NotFound` (404) si el dataset no existe.
|
||||
Los campos `created` y `modified` son strings ISO 8601 con timezone UTC, o `None` si el SDK no los retorna.
|
||||
`labels` es un dict vacio `{}` si el dataset no tiene labels.
|
||||
Reference in New Issue
Block a user