cfdf515228
- .claude/CLAUDE.md - .claude/commands/subagentes.md - .claude/rules/INDEX.md - .mcp.json - bash/functions/cybersecurity/analyze_dns.md - bash/functions/cybersecurity/audit_http_headers.md - bash/functions/cybersecurity/audit_ssh_config.md - bash/functions/cybersecurity/check_firewall.md - bash/functions/cybersecurity/detect_suspicious_users.md - bash/functions/cybersecurity/encrypt_file.md - ... Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
3.0 KiB
3.0 KiB
name, kind, lang, domain, version, purity, signature, description, tags, uses_functions, uses_types, returns, returns_optional, error_type, imports, params, output, tested, tests, test_file_path, file_path
| name | kind | lang | domain | version | purity | signature | description | tags | uses_functions | uses_types | returns | returns_optional | error_type | imports | params | output | tested | tests | test_file_path | file_path | ||||||||||||||||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| bq_create_routine | function | py | infra | 1.0.0 | impure | def bq_create_routine(client: BQClient, dataset_id: str, routine_id: str, body: str, routine_type: str = 'SCALAR_FUNCTION', language: str = 'SQL', arguments: list[dict] | None = None, return_type: str = '', description: str = '') -> dict | Crea una routine (UDF scalar, tabla o stored procedure) en BigQuery. Soporta SQL, JavaScript y Python. |
|
false | error_go_core |
|
|
dict con routine_id, dataset_id, project, routine_type, language, body, description, created y modified (ISO 8601) | false | python/functions/bigquery/routines.py |
Ejemplo
from bigquery.client import bq_auth
from bigquery.routines import bq_create_routine
client = bq_auth("my-project")
# UDF escalar SQL
fn = bq_create_routine(
client,
dataset_id="analytics",
routine_id="double_value",
body="x * 2",
arguments=[{"name": "x", "data_type": "INT64"}],
return_type="INT64",
description="Duplica un entero",
)
print(fn["routine_id"], fn["routine_type"], fn["language"])
# double_value SCALAR_FUNCTION SQL
# Stored procedure SQL
bq_create_routine(
client,
dataset_id="analytics",
routine_id="refresh_summary",
body="INSERT INTO summary SELECT * FROM raw WHERE date = CURRENT_DATE();",
routine_type="PROCEDURE",
)
Notas
Lanza google.api_core.exceptions.Conflict (409) si la routine ya existe. Para actualizar una routine existente, eliminarla primero con bq_delete_routine y recrearla, o usar client._client.update_routine() directamente.
Los data_type de los argumentos deben ser constantes de bigquery.StandardSqlTypeNames: INT64, FLOAT64, STRING, BOOL, BYTES, DATE, DATETIME, TIMESTAMP, TIME, NUMERIC, BIGNUMERIC, JSON, ARRAY, STRUCT.
Las routines JavaScript permiten librerias externas via imported_libraries (no expuesto en este wrapper).