47fac22230
- .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>
2.3 KiB
2.3 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_copy_table | function | py | infra | 1.0.0 | impure | def bq_copy_table(client: BQClient, source_dataset: str, source_table: str, dest_dataset: str, dest_table: str, write_disposition: str = 'WRITE_EMPTY') -> dict | Copia una tabla BigQuery a otro dataset o tabla dentro del mismo proyecto usando copy_table del SDK. Espera la finalizacion del CopyJob. |
|
false | error_go_core |
|
|
dict con {job_id: ID del CopyJob, status: DONE o FAILED} | false | python/functions/bigquery/queries.py |
Ejemplo
from bigquery.client import bq_auth
from bigquery.queries import bq_copy_table
client = bq_auth("my-project")
# Copia de produccion a staging (falla si ya existe)
result = bq_copy_table(
client,
"production", "users",
"staging", "users_backup",
)
print(f"Copia completada: {result['status']} — job: {result['job_id']}")
# Copia sobreescribiendo destino
result = bq_copy_table(
client,
"raw", "events_2024",
"processed", "events_latest",
write_disposition="WRITE_TRUNCATE",
)
Notas
copy_table solo funciona dentro del mismo proyecto GCP. Para copiar entre proyectos,
usar bq_export_to_gcs + bq_load_from_gcs.
Si la tabla destino no existe, BigQuery la crea con el schema de la tabla origen
independientemente del write_disposition.
El CopyJob es asincrono; job.result() bloquea hasta completar. La copia no mueve
datos fisicamente — BigQuery usa referencias de bloques internamente hasta que se
modifica la copia.