본문으로 건너뛰기
Skillpedia
분석 및 스프레드시트40k · #7093

bigquery-pipeline-audit

하는 일

이 도구는 BigQuery를 사용하는 Python 코드를 분석해, 많은 비용이 들거나 오류를 일으킬 수 있는 문제를 찾습니다. 코드가 운영 환경에 안전한지, 그리고 데이터를 망가뜨리지 않고 다시 실행할 수 있는지 확인합니다.

사용하는 경우

  • ✓BigQuery 쿼리를 실행하는 Python 스크립트가 있을 때.
  • ✓비용 예상치 못한 청구를 막기 위해 스크립트를 배포하기 전에.
  • ✓스크립트를 다시 시작해도 데이터가 중복되지 않도록 확실히 하고 싶을 때.

스킬 링크

https://github.com/github/awesome-copilot/blob/main/skills/bigquery-pipeline-audit/SKILL.md

복사해서 AI(Claude, ChatGPT, Cursor)에 붙여넣고 지침을 따르도록 요청하세요.

사용 방법

가장 쉬운 방법입니다. 메시지를 복사해 AI에 붙여넣으세요. AI가 스킬을 읽고 지침을 따릅니다.

바로 붙여넣을 수 있는 메시지

Use this skill to help me: https://github.com/github/awesome-copilot/blob/main/skills/bigquery-pipeline-audit/SKILL.md Read the SKILL.md file at that link and follow its instructions for my task.
AI가 이런 스킬을 알아서 찾아 쓰길 원하시나요?무료 Skillpedia MCP를 설치하세요. 한 줄이면 작업마다 스킬 15,000+개 중에서 검색합니다.1분 만에 설치 →

AI에게 요청하는 예시

“이 BigQuery용 Python 스크립트를 분석해서 비용이 많이 들거나 데이터 문제를 일으킬 가능성이 있는지 알려 주세요.”

매주 새 스킬 5개. 읽는 데 1분.

작동 방식

도구는 Python 코드를 읽고, 과다 지출이나 오류로 이어질 수 있는 특정 패턴을 찾습니다. 쿼리가 실행되는 방식, 데이터가 안전하게 기록되는지, 문제가 생겼을 때의 대응 계획이 있는지 확인합니다.

기술 내용 (원본 SKILL.md)

작성자의 영어 원문을 GitHub에서 그대로 가져왔습니다.

BigQuery Pipeline Audit: Cost, Safety and Production Readiness

You are a senior data engineer reviewing a Python + BigQuery pipeline script. Your goals: catch runaway costs before they happen, ensure reruns do not corrupt data, and make sure failures are visible.

Analyze the codebase and respond in the structure below (A to F + Final). Reference exact function names and line locations. Suggest minimal fixes, not rewrites.


A) COST EXPOSURE: What will actually get billed?

Locate every BigQuery job trigger (client.query, load_table_from_*, extract_table, copy_table, DDL/DML via query) and every external call (APIs, LLM calls, storage writes).

For each, answer:

  • Is this inside a loop, retry block, or async gather?
  • What is the realistic worst-case call count?
  • For each client.query, is QueryJobConfig.maximum_bytes_billed set? For load, extract, and copy jobs, is the scope bounded and counted against MAX_JOBS?
  • Is the same SQL and params being executed more than once in a single run? Flag repeated identical queries and suggest query hashing plus temp table caching.

Flag immediately if:

  • Any BQ query runs once per date or once per entity in a loop
  • Worst-case BQ job count exceeds 20
  • maximum_bytes_billed is missing on any client.query call

B) DRY RUN AND EXECUTION MODES

Verify a --mode flag exists with at least dry_run and execute options.

  • dry_run must print the plan and estimated scope with zero billed BQ execution (BigQuery dry-run estimation via job config is allowed) and zero external API or LLM calls
  • execute requires explicit confirmation for prod (--env=prod --confirm)
  • Prod must not be the default environment

If missing, propose a minimal argparse patch with safe defaults.


C) BACKFILL AND LOOP DESIGN

Hard fail if: the script runs one BQ query per date or per entity in a loop.

Check that date-range backfills use one of:

  1. A single set-based query with GENERATE_DATE_ARRAY
  2. A staging table loaded with all dates then one join query
  3. Explicit chunks with a hard MAX_CHUNKS cap

Also check:

  • Is the date range bounded by default (suggest 14 days max without --override)?
  • If the script crashes mid-run, is it safe to re-run without double-writing?
  • For backdated simulations, verify data is read from time-consistent snapshots (FOR SYSTEM_TIME AS OF, partitioned as-of tables, or dated snapshot tables). Flag any read from a "latest" or unversioned table when running in backdated mode.

Suggest a concrete rewrite if the current approach is row-by-row.


D) QUERY SAFETY AND SCAN SIZE

For each query, check:

  • Partition filter is on the raw column, not DATE(ts), CAST(...), or any function that prevents pruning
  • No SELECT *: only columns actually used downstream
  • Joins will not explode: verify join keys are unique or appropriately scoped and flag any potential many-to-many
  • Expensive operations (REGEXP, JSON_EXTRACT, UDFs) only run after partition filtering, not on full table scans

Provide a specific SQL fix for any query that fails these checks.


E) SAFE WRITES AND IDEMPOTENCY

Identify every write operation. Flag plain INSERT/append with no dedup logic.

Each write should use one of:

  1. MERGE on a deterministic key (e.g., entity_id + date + model_version)
  2. Write to a staging table scoped to the run, then swap or merge into final
  3. Append-only with a dedupe view: QUALIFY ROW_NUMBER() OVER (PARTITION BY <key>) = 1

Also check:

  • Will a re-run create duplicate rows?
  • Is the write disposition (WRITE_TRUNCATE vs WRITE_APPEND) intentional and documented?
  • Is run_id being used as part of the merge or dedupe key? If so, flag it. run_id should be stored as a metadata column, not as part of the uniqueness key, unless you explicitly want multi-run history.

State the recommended approach and the exact dedup key for this codebase.


F) OBSERVABILITY: Can you debug a failure?

Verify:

  • Failures raise exceptions and abort with no silent except: pass or warn-only
  • Each BQ job logs: job ID, bytes processed or billed when available, slot milliseconds, and duration
  • A run summary is logged or written at the end containing: run_id, env, mode, date_range, tables written, total BQ jobs, total bytes
  • run_id is present and consistent across all log lines

If run_id is missing, propose a one-line fix:

…

자주 묻는 질문

‘멱등성(idempotency)’이란 무엇인가요?

같은 작업을 여러 번 실행해도 한 번 실행한 것과 같은 결과가 나온다는 뜻입니다. 데이터의 경우, 스크립트가 실패해 다시 시작되더라도 레코드가 중복으로 생기지 않도록 막아 줍니다.

‘운영 준비성’이란 무엇인가요?

코드가 안전성, 모니터링, 문제 없이 다시 시작할 수 있는 능력을 갖춰 실제 환경에서 사용할 준비가 되었는지를 뜻합니다.

‘비용 노출’이란 무엇인가요?

돈이 드는 BigQuery 쿼리나 작업을 실행할 수 있는 코드의 모든 부분을 뜻합니다. 특히 제어 없이 여러 번 실행될 수 있는 경우가 문제입니다.

상세 정보

작성자의 원본 설명

Audits Python + BigQuery pipelines for cost safety, idempotency, and production readiness. Returns a structured report with exact patch locations.

repo: github/awesome-copilot

인기도

GitHub 스타
40k
순위
#7093
라이선스
MIT
업데이트
2026. 10. 15.

이 스킬이 유용한가요?

0

로그인 투표하려면 로그인하세요.

댓글

  • …

이 저장소의 다른 스킬

비슷한 스킬