[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill:01M78JJ0V9XR60403DTDZT5M7Z":3,"skill-same:01M78JJ0V9XR60403DTDZT5M7Z":62},{"skillNo":4,"name":5,"nameZh":6,"description":7,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":16,"categories":17,"keywords":18,"publishedAt":19,"linkOnly":20,"markdownContent":21,"markdownBody":22,"frontMatter":23,"refName":27,"commitSha":28,"skillDirectory":29,"forksCount":30,"repositoryHtmlUrl":31,"repositoryHomepageUrl":6,"ownerHtmlUrl":32,"ownerBlogUrl":33,"ownerDescription":34,"updatedAt":35,"install":36,"resources":49},"01M78JJ0V9XR60403DTDZT5M7Z","bigquery-migration-data-loader",null,"Provisions BigQuery datasets, ingests staged Parquet files directly into native BigQuery tables by using bq load, and deploys already-translated views from local or Cloud Storage BigQuery Migration Service (BQMS) translation outputs. Use when provisioning target BigQuery datasets for warehouse migrations, batch loading staged Parquet files into native BigQuery tables by using bq load, auditing loaded table row counts, or deploying already-translated BigQuery views into a target dataset. Don't use for extracting source database catalog metadata, translating SQL queries, views, stored procedures, or DDL schemas to GoogleSQL (use bigquery-migration-sql-translator), exporting or unloading source database tables (such as Snowflake, Databricks, Teradata, or Oracle) to Parquet on Cloud Storage, or running post-migration cross-database data validation.","google\u002Fskills","google","https:\u002F\u002Favatars.githubusercontent.com\u002Fu\u002F1342004?v=4","01M698VYEFDM0VJBZDYYJ2T83S","Google","01M698WR0H76ENHE587T9EJT89",24235,"Apache-2.0","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fcloud\u002Fbigquery-migration-data-loader\u002FSKILL.md",[],[],"2026-11-15 14:19:17",false,"---\nname: bigquery-migration-data-loader\nmetadata:\n  version: \"1.0.0\"\n  category: BigDataAndAnalytics\n  publisher: google\ndescription: >-\n  Provisions BigQuery datasets, ingests staged Parquet files directly into\n  native BigQuery tables by using bq load, and deploys already-translated views\n  from local or Cloud Storage BigQuery Migration Service (BQMS) translation\n  outputs. Use when provisioning target BigQuery datasets for warehouse\n  migrations, batch loading staged Parquet files into native BigQuery tables by\n  using bq load, auditing loaded table row counts, or deploying\n  already-translated BigQuery views into a target dataset. Don't use for\n  extracting source database catalog metadata, translating SQL queries, views,\n  stored procedures, or DDL schemas to GoogleSQL (use\n  bigquery-migration-sql-translator), exporting or unloading source database\n  tables (such as Snowflake, Databricks, Teradata, or Oracle) to Parquet on\n  Cloud Storage, or running post-migration cross-database data validation.\n---\n\n# BigQuery Migration Data Loader\n\nThis skill coordinates the automated provisioning of BigQuery datasets, direct\ningestion of staged Parquet files into native BigQuery tables by using the\n`bq load` command, and automated view deployment directly from BigQuery\nMigration Service (BQMS) translation output directories (local or Cloud\nStorage).\n\n## Usage attribution\n\n**MUST READ**: Before executing any `gcloud`, REST API, or MCP command, you\nMUST read and follow the instructions in\n[Usage Attribution](references\u002Fattribution.md).\n\n## Before you begin\n\n1.  **Google Cloud CLI, project, and location setup**: Install the\n    [Google Cloud CLI](https:\u002F\u002Fcloud.google.com\u002Fsdk\u002Fdocs\u002Finstall) (including\n    the `gcloud` and `bq` command-line tools), confirm that your Google Cloud\n    project has an active Cloud Billing account attached, and configure the\n    target project and default Compute Engine region:\n\n    ```bash\n    gcloud config set project PROJECT_ID\n    gcloud config set compute\u002Fregion REGION\n    ```\n\n    `gcloud config set compute\u002Fregion` sets the default Compute Engine region;\n    the `bq` CLI does not read `compute\u002Fregion` and defaults to `US` unless\n    `--location` is passed on `bq` commands or set in `~\u002F.bigqueryrc` (or\n    configured through a project or organization `default_location`). BigQuery\n    is retiring the *multi-region* designation—including `US` and `EU` in the\n    single-regions list colocated with `us-central1` and `europe-west4`, with no\n    change to existing data residency (see\n    [BigQuery locations](https:\u002F\u002Fcloud.google.com\u002Fbigquery\u002Fdocs\u002Flocations))—so\n    always pass an explicit `--location` on `bq` commands that matches your\n    staged Cloud Storage bucket, as described in step 5 (check regional\n    service availability at\n    [Google Cloud locations](https:\u002F\u002Fcloud.google.com\u002Fabout\u002Flocations)).\n\n2.  **Enable the APIs**: Ask the user before enabling APIs, then enable the\n    BigQuery and Cloud Storage APIs (`bigquery.googleapis.com` and\n    `storage.googleapis.com`):\n\n    ```bash\n    gcloud services enable bigquery.googleapis.com storage.googleapis.com\n    ```\n\n3.  **Authentication and required IAM roles**: Authenticate with `gcloud auth\n    login` and `gcloud auth application-default login` (or set\n    `GOOGLE_APPLICATION_CREDENTIALS` for service account authentication). Verify\n    that your identity or service account has the required IAM roles on each\n    resource:\n\n    *   Grant **BigQuery Job User** (`roles\u002Fbigquery.jobUser`) on the target\n        Google Cloud project.\n    *   Grant **BigQuery Data Editor** (`roles\u002Fbigquery.dataEditor`) on the\n        target Google Cloud project (to create new datasets with `bq mk`) or on\n        an existing target dataset (to create or overwrite tables and views).\n    *   Grant **Storage Object Viewer** (`roles\u002Fstorage.objectViewer`) on the\n        Cloud Storage bucket holding staged Parquet files and translation\n        metadata.\n\n4.  **Python environment**: Ask the user for confirmation before installing\n    Python packages, then install PyYAML in a virtual environment:\n\n    ```bash\n    pip install pyyaml==6.0.2\n    ```\n\n5.  **Location, cost, and cleanup**: Use the location of your staged Cloud\n    Storage bucket for the dataset and every `bq` command: the bucket's region\n    for a regional bucket, or `US` or `EU` for a `US` or `EU` multi-region\n    bucket. Default to `us-central1` only when you also choose the bucket\n    location. Loading from a bucket in a different location incurs data\n    transfer charges (see\n    [BigQuery locations](https:\u002F\u002Fcloud.google.com\u002Fbigquery\u002Fdocs\u002Flocations)).\n    Review\n    [Google Cloud pricing](https:\u002F\u002Fcloud.google.com\u002Fpricing) before loading\n    large datasets or running audit queries. Ask the user for confirmation\n    before deleting temporary staged Parquet files\n    (`gcloud storage rm -r gs:\u002F\u002FBUCKET\u002FEXPORT_PREFIX`) or test datasets\n    (`bq rm -r -f PROJECT_ID:DATASET_ID`) when no longer needed.\n\n--------------------------------------------------------------------------------\n\n## 1. Loader workflow overview\n\nThe following diagram illustrates the four-stage ingestion and view deployment\npipeline:\n\n```mermaid\nflowchart TD\n    subgraph 1. Inputs\n        A1[\"Translation Output Directory \u002F Cloud Storage URI\u003Cbr>gs:\u002F\u002Fbucket\u002Ftranslation_output\u002Fmetadata\u002F\"]\n        A2[\"Staged Parquet Files\u003Cbr>gs:\u002F\u002Fbucket\u002Fdata_unload\u002FTABLE\u002F*.parquet\"]\n    end\n\n    subgraph 2. Ingestion Pipeline\n        B1[\"1. Ensure Dataset Exists\u003Cbr>bq mk --dataset --location=LOCATION DATASET\"]\n        B2[\"2. Concurrent Parquet Ingestion\u003Cbr>bq load --source_format=PARQUET --replace=true\u003Cbr>Auto-creates native tables\"]\n        B3[\"3. Row Count Audit\u003Cbr>Print BigQuery Row Counts for Comparison\"]\n        B4[\"4. Deploy Consumption Views\u003Cbr>Deploys views directly from consolidated views.sql or relations\u002F\"]\n    end\n\n    A1 & A2 --> B1 --> B2 --> B3 --> B4\n```\n\n--------------------------------------------------------------------------------\n\n## 2. Direct translation output ingestion\n\n> [!TIP] **Migration workflow context**: Before running the loader, translate\n> source schemas and views into GoogleSQL by using the\n> `bigquery-migration-sql-translator` skill and stage exported source table\n> Parquet files in Cloud Storage. After loading tables and deploying views,\n> compare row counts and data aggregates against the source database.\n\nThe data loader directly consumes BQMS translation output directories (the\n`--translation-metadata-dir` flag):\n\n*   **Zero-DDL native ingestion**: Table schemas are inferred and created\n    automatically from staged Parquet files during `bq load`. Inferred types\n    follow the Parquet types, not the translated DDL: naive source timestamps\n    (no time zone) load as `TIMESTAMP` instead of `DATETIME`, and\n    `STRING(n)` and `NUMERIC(p, s)` parameters are dropped (see Step 2 in\n    Section 3).\n*   **Automated object discovery**: Base tables and views are auto-discovered\n    directly from the translation output metadata. Pass the BQMS `metadata\u002F`\n    directory (or its parent), which contains `config\u002FDATABASE\u002FSCHEMA\u002F*.yaml`\n    files whose `sourceName` names each object (table configs also set\n    `externalTableName` or `externalTableDdlPath`; the others are views) and\n    view DDL in `relations\u002Fdb_DATABASE\u002Fschema_SCHEMA\u002FVIEW.sql` (or a single\n    `views.sql`).\n*   **Automated view deployment**: Translated views are deployed directly into\n    the target dataset with source references rewritten to the target BigQuery\n    project and dataset. Plain `CREATE VIEW` statements are deployed as\n    `CREATE OR REPLACE VIEW` so that reruns don't fail on existing views.\n*   **Flexible Parquet path resolution**: Under the `--parquet-base-uri`\n    (`BASE_URI`) flag, the loader automatically checks schema-scoped\n    subfolders (`BASE_URI\u002FSCHEMA\u002FTABLE\u002F*.parquet`) first if present and falls\n    back to flat table paths (`BASE_URI\u002FTABLE\u002F*.parquet`). For example,\n    `gcloud storage cp -r LOCAL_DIR\u002FSCHEMA gs:\u002F\u002FBUCKET\u002Fdata_unload\u002F` stages a\n    local schema folder of table subfolders under `data_unload\u002FSCHEMA\u002F`.\n*   **Single target dataset**: All discovered schemas load into one\n    `--dataset` by table or view name. If tables or views from different\n    source databases or schemas share a name, the loader stops before creating\n    the dataset and lists the conflicting objects; load each schema into its\n    own dataset instead.\n\n--------------------------------------------------------------------------------\n\n## 3. CLI execution interface (`bq load`)\n\n### Step 1: Provision the target dataset\n\nSet the shell variables for your environment, and then create the target\ndataset if it doesn't already exist:\n\n```bash\nPROJECT_ID=\"PROJECT_ID\"\nDATASET_ID=\"DATASET_ID\"\nLOCATION=\"LOCATION\"\nTABLE_NAME=\"TABLE_NAME\"\nBUCKET=\"BUCKET\"\nPREFIX=\"data_unload\"\n\nbq show --dataset --project_id=${PROJECT_ID} ${DATASET_ID} >\u002Fdev\u002Fnull 2>&1 || \\\nbq mk --dataset --project_id=${PROJECT_ID} --location=${LOCATION} ${DATASET_ID}\n```\n\nReplace the following:\n\n*   `PROJECT_ID`: the target Google Cloud project ID.\n*   `DATASET_ID`: the target BigQuery dataset ID.\n*   `LOCATION`: the BigQuery location for the dataset and load jobs (for\n    example, `us-central1`).\n*   `TABLE_NAME`: the name of the table to load.\n*   `BUCKET`: the name of the Cloud Storage bucket that holds the staged\n    Parquet files.\n\n### Step 2: Ingest Parquet tables (auto-creates native table schema)\n\nPass `--decimal_target_types=NUMERIC --decimal_target_types=BIGNUMERIC\n--decimal_target_types=STRING` so BigQuery selects the smallest compatible type\n(`NUMERIC` → `BIGNUMERIC` → `STRING`) based on each Parquet `DECIMAL(p, s)`\ncolumn's precision and scale: columns with `p - s \u003C= 29, s \u003C= 9` map to\n`NUMERIC`, columns with `p - s \u003C= 38, s \u003C= 38` (such as `DECIMAL(38, 10)`) widen\nto `BIGNUMERIC`, and larger `DECIMAL256` precisions or scales fall back to\n`STRING`:\n\n```bash\nbq load \\\n    --project_id=${PROJECT_ID} \\\n    --location=${LOCATION} \\\n    --source_format=PARQUET \\\n    --replace=true \\\n    --decimal_target_types=NUMERIC \\\n    --decimal_target_types=BIGNUMERIC \\\n    --decimal_target_types=STRING \\\n    ${DATASET_ID}.${TABLE_NAME} \\\n    \"gs:\u002F\u002F${BUCKET}\u002F${PREFIX}\u002F${TABLE_NAME}\u002F*.parquet\"\n```\n\nThe `--replace=true` flag overwrites the destination table, including its\nschema, with the schema inferred from the Parquet files. If you pre-created\ntables from translated BQMS DDL statements to preserve target types such as\n`JSON`, `INTERVAL`, or `RANGE`, either run `TRUNCATE TABLE` and then load with\n`--replace=false` (so that reruns stay idempotent and don't duplicate rows), or\nkeep `--replace=true` and pass an explicit `--schema`. If you use the loader\ntemplate with native `JSON` columns, also set\n`_WRAP_JSON_QUERY_WITH_PARSE_JSON = False` in the copied script: by default it\nwraps `JSON_QUERY()` calls in `SAFE.PARSE_JSON()` for `JSON` source columns that\nParquet loads as `STRING`, which fails on native `JSON` columns.\n\nParquet `TIMESTAMP` columns always load as BigQuery `TIMESTAMP`, including\nnaive timestamps (`isAdjustedToUTC=false`, such as source `TIMESTAMP WITHOUT\nTIME ZONE` columns) that the translated DDL maps to `DATETIME`; the wall-clock\nvalues are kept and read as UTC. To restore `DATETIME` after loading, rewrite\nthose columns with `DATETIME(column)`, which converts at UTC by default:\n\n```sql\nCREATE OR REPLACE TABLE `PROJECT_ID.DATASET_ID.TABLE_NAME` AS\nSELECT * REPLACE (DATETIME(created_at) AS created_at)\nFROM `PROJECT_ID.DATASET_ID.TABLE_NAME`;\n```\n\n### Step 3: Run a row-count audit\n\nCount the rows in the loaded table so that you can compare the result with the\nsource table:\n\n```bash\nbq query \\\n    --project_id=${PROJECT_ID} \\\n    --location=${LOCATION} \\\n    --use_legacy_sql=false \\\n    \"SELECT '${TABLE_NAME}' AS table_name, count(*) AS row_count FROM \\`${PROJECT_ID}\\`.\\`${DATASET_ID}\\`.\\`${TABLE_NAME}\\`;\"\n```\n\n--------------------------------------------------------------------------------\n\n## 4. Automated loader asset template (`assets\u002Fbq_loader_template.py`)\n\nThis skill provides an [automated BigQuery loader template][loader_template]\n(`assets\u002Fbq_loader_template.py`) for dataset creation, concurrent Parquet\nloading, direct view deployment, and table row-count auditing.\n\n### Agent workflow: Copy, conditionally customize, and execute\n\n1.  **Copy the asset template**: Always instruct the user to copy the\n    [automated BigQuery loader template][loader_template]\n    (`assets\u002Fbq_loader_template.py`) from this skill's directory (`SKILL_DIR`)\n    into their working directory (`.\u002Fbq_loader.py`) by using the `cp`\n    command—never write, synthesize, or inline a custom Python loader script\n    from scratch, and never paste or re-type the template contents into the\n    response. The template already handles quote-aware SQL splitting,\n    destination name collision checks, chunked row-count audits, and\n    multi-pass view retries, which a rewritten script would likely miss.\n    `SKILL_DIR` is the directory containing this `SKILL.md`:\n\n    ```bash\n    cp SKILL_DIR\u002Fassets\u002Fbq_loader_template.py .\u002Fbq_loader.py\n    ```\n\n2.  **Conditionally customize extension points**: Run the copy as-is. Modify it\n    only if one of the following applies (prefer editing the marked `#\n    CUSTOMIZE:` sections; `# DEFAULT SCAFFOLDING` sections can be kept unchanged\n    unless deeper orchestration adjustments are needed):\n\n    *   **Schema overrides and partitioning (`# CUSTOMIZE: Schema Overrides &\n        Partitioning`)**: Add custom `bq load` flags (such as\n        `--time_partitioning_field`, `--clustering_fields`, or explicit schema\n        JSON files) inside `load_parquet_table()`.\n    *   **Custom view rewriting (`# CUSTOMIZE: Custom View Rewriting &\n        Deployment`)**: Adjust view SQL regular expressions, cross-project\n        dataset mapping rules, or retry bounds in `_rewrite_view_sql()` and\n        `deploy_views()`. Set `_WRAP_JSON_QUERY_WITH_PARSE_JSON = False` if you\n        pre-created tables with native `JSON` columns.\n    *   **Connection and CLI wrapper (`# CUSTOMIZE: Connection & CLI\n        Wrapper`)**:\n        Pass custom `bq` CLI flags (for example, `--default_kms_key` in\n        `ensure_dataset()`, or `--destination_kms_key` and `--reservation_id` in\n        `load_parquet_table()` and `execute_sql()`).\n    *   **Post-load auditing (`# CUSTOMIZE: Post-Load Auditing`)**: Extend\n        `audit_row_counts()` with custom data integrity or column-level checksum\n        queries.\n\n3.  **Execute the script in your working directory**: Run the copied script\n    against a Cloud Storage URI or a local translation output folder:\n\n    ```bash\n    # Direct from a Cloud Storage translation_output URI with concurrency:\n    python3 .\u002Fbq_loader.py \\\n        --project \"PROJECT_ID\" \\\n        --dataset \"DATASET_ID\" \\\n        --location \"LOCATION\" \\\n        --translation-metadata-dir \"gs:\u002F\u002FBUCKET\u002Ftranslation_output\u002Fmetadata\u002F\" \\\n        --parquet-base-uri \"gs:\u002F\u002FBUCKET\u002Fdata_unload\u002F\" \\\n        --concurrency 8\n\n    # Using local translation output folder:\n    python3 .\u002Fbq_loader.py \\\n        --project \"PROJECT_ID\" \\\n        --dataset \"DATASET_ID\" \\\n        --location \"LOCATION\" \\\n        --translation-metadata-dir \"TRANSLATION_OUTPUT\u002Fmetadata\" \\\n        --parquet-base-uri \"gs:\u002F\u002FBUCKET\u002Fdata_unload\u002F\" \\\n        --concurrency 4\n    ```\n\n    When a view depends on another view, the first batch and first pass print\n    `bq` errors such as `Not found: Table ...` for the dependent view. These\n    errors are expected if the run ends with\n    `All N views successfully deployed across M passes.`\n\n### Arguments\n\n*   `--project` *(Required)*: Google Cloud project ID.\n*   `--dataset` *(Required)*: Target BigQuery dataset name.\n*   `--parquet-base-uri` *(Required)*: Base Cloud Storage URI containing table\n    Parquet subfolders (`gs:\u002F\u002FBUCKET\u002Fpath\u002F`).\n*   `--translation-metadata-dir` *(Required)*: Local folder or Cloud Storage URI\n    to translation output metadata directory. Auto-discovers tables and views.\n*   `--location` *(Optional, Default: `us-central1`)*: Target BigQuery location.\n*   `--concurrency` *(Optional, Default: `4`)*: Number of parallel workers for\n    concurrent `bq load` operations.\n\n[loader_template]: assets\u002Fbq_loader_template.py\n","# BigQuery Migration Data Loader\n\nThis skill coordinates the automated provisioning of BigQuery datasets, direct\ningestion of staged Parquet files into native BigQuery tables by using the\n`bq load` command, and automated view deployment directly from BigQuery\nMigration Service (BQMS) translation output directories (local or Cloud\nStorage).\n\n## Usage attribution\n\n**MUST READ**: Before executing any `gcloud`, REST API, or MCP command, you\nMUST read and follow the instructions in\n[Usage Attribution](references\u002Fattribution.md).\n\n## Before you begin\n\n1.  **Google Cloud CLI, project, and location setup**: Install the\n    [Google Cloud CLI](https:\u002F\u002Fcloud.google.com\u002Fsdk\u002Fdocs\u002Finstall) (including\n    the `gcloud` and `bq` command-line tools), confirm that your Google Cloud\n    project has an active Cloud Billing account attached, and configure the\n    target project and default Compute Engine region:\n\n    ```bash\n    gcloud config set project PROJECT_ID\n    gcloud config set compute\u002Fregion REGION\n    ```\n\n    `gcloud config set compute\u002Fregion` sets the default Compute Engine region;\n    the `bq` CLI does not read `compute\u002Fregion` and defaults to `US` unless\n    `--location` is passed on `bq` commands or set in `~\u002F.bigqueryrc` (or\n    configured through a project or organization `default_location`). BigQuery\n    is retiring the *multi-region* designation—including `US` and `EU` in the\n    single-regions list colocated with `us-central1` and `europe-west4`, with no\n    change to existing data residency (see\n    [BigQuery locations](https:\u002F\u002Fcloud.google.com\u002Fbigquery\u002Fdocs\u002Flocations))—so\n    always pass an explicit `--location` on `bq` commands that matches your\n    staged Cloud Storage bucket, as described in step 5 (check regional\n    service availability at\n    [Google Cloud locations](https:\u002F\u002Fcloud.google.com\u002Fabout\u002Flocations)).\n\n2.  **Enable the APIs**: Ask the user before enabling APIs, then enable the\n    BigQuery and Cloud Storage APIs (`bigquery.googleapis.com` and\n    `storage.googleapis.com`):\n\n    ```bash\n    gcloud services enable bigquery.googleapis.com storage.googleapis.com\n    ```\n\n3.  **Authentication and required IAM roles**: Authenticate with `gcloud auth\n    login` and `gcloud auth application-default login` (or set\n    `GOOGLE_APPLICATION_CREDENTIALS` for service account authentication). Verify\n    that your identity or service account has the required IAM roles on each\n    resource:\n\n    *   Grant **BigQuery Job User** (`roles\u002Fbigquery.jobUser`) on the target\n        Google Cloud project.\n    *   Grant **BigQuery Data Editor** (`roles\u002Fbigquery.dataEditor`) on the\n        target Google Cloud project (to create new datasets with `bq mk`) or on\n        an existing target dataset (to create or overwrite tables and views).\n    *   Grant **Storage Object Viewer** (`roles\u002Fstorage.objectViewer`) on the\n        Cloud Storage bucket holding staged Parquet files and translation\n        metadata.\n\n4.  **Python environment**: Ask the user for confirmation before installing\n    Python packages, then install PyYAML in a virtual environment:\n\n    ```bash\n    pip install pyyaml==6.0.2\n    ```\n\n5.  **Location, cost, and cleanup**: Use the location of your staged Cloud\n    Storage bucket for the dataset and every `bq` command: the bucket's region\n    for a regional bucket, or `US` or `EU` for a `US` or `EU` multi-region\n    bucket. Default to `us-central1` only when you also choose the bucket\n    location. Loading from a bucket in a different location incurs data\n    transfer charges (see\n    [BigQuery locations](https:\u002F\u002Fcloud.google.com\u002Fbigquery\u002Fdocs\u002Flocations)).\n    Review\n    [Google Cloud pricing](https:\u002F\u002Fcloud.google.com\u002Fpricing) before loading\n    large datasets or running audit queries. Ask the user for confirmation\n    before deleting temporary staged Parquet files\n    (`gcloud storage rm -r gs:\u002F\u002FBUCKET\u002FEXPORT_PREFIX`) or test datasets\n    (`bq rm -r -f PROJECT_ID:DATASET_ID`) when no longer needed.\n\n--------------------------------------------------------------------------------\n\n## 1. Loader workflow overview\n\nThe following diagram illustrates the four-stage ingestion and view deployment\npipeline:\n\n```mermaid\nflowchart TD\n    subgraph 1. Inputs\n        A1[\"Translation Output Directory \u002F Cloud Storage URI\u003Cbr>gs:\u002F\u002Fbucket\u002Ftranslation_output\u002Fmetadata\u002F\"]\n        A2[\"Staged Parquet Files\u003Cbr>gs:\u002F\u002Fbucket\u002Fdata_unload\u002FTABLE\u002F*.parquet\"]\n    end\n\n    subgraph 2. Ingestion Pipeline\n        B1[\"1. Ensure Dataset Exists\u003Cbr>bq mk --dataset --location=LOCATION DATASET\"]\n        B2[\"2. Concurrent Parquet Ingestion\u003Cbr>bq load --source_format=PARQUET --replace=true\u003Cbr>Auto-creates native tables\"]\n        B3[\"3. Row Count Audit\u003Cbr>Print BigQuery Row Counts for Comparison\"]\n        B4[\"4. Deploy Consumption Views\u003Cbr>Deploys views directly from consolidated views.sql or relations\u002F\"]\n    end\n\n    A1 & A2 --> B1 --> B2 --> B3 --> B4\n```\n\n--------------------------------------------------------------------------------\n\n## 2. Direct translation output ingestion\n\n> [!TIP] **Migration workflow context**: Before running the loader, translate\n> source schemas and views into GoogleSQL by using the\n> `bigquery-migration-sql-translator` skill and stage exported source table\n> Parquet files in Cloud Storage. After loading tables and deploying views,\n> compare row counts and data aggregates against the source database.\n\nThe data loader directly consumes BQMS translation output directories (the\n`--translation-metadata-dir` flag):\n\n*   **Zero-DDL native ingestion**: Table schemas are inferred and created\n    automatically from staged Parquet files during `bq load`. Inferred types\n    follow the Parquet types, not the translated DDL: naive source timestamps\n    (no time zone) load as `TIMESTAMP` instead of `DATETIME`, and\n    `STRING(n)` and `NUMERIC(p, s)` parameters are dropped (see Step 2 in\n    Section 3).\n*   **Automated object discovery**: Base tables and views are auto-discovered\n    directly from the translation output metadata. Pass the BQMS `metadata\u002F`\n    directory (or its parent), which contains `config\u002FDATABASE\u002FSCHEMA\u002F*.yaml`\n    files whose `sourceName` names each object (table configs also set\n    `externalTableName` or `externalTableDdlPath`; the others are views) and\n    view DDL in `relations\u002Fdb_DATABASE\u002Fschema_SCHEMA\u002FVIEW.sql` (or a single\n    `views.sql`).\n*   **Automated view deployment**: Translated views are deployed directly into\n    the target dataset with source references rewritten to the target BigQuery\n    project and dataset. Plain `CREATE VIEW` statements are deployed as\n    `CREATE OR REPLACE VIEW` so that reruns don't fail on existing views.\n*   **Flexible Parquet path resolution**: Under the `--parquet-base-uri`\n    (`BASE_URI`) flag, the loader automatically checks schema-scoped\n    subfolders (`BASE_URI\u002FSCHEMA\u002FTABLE\u002F*.parquet`) first if present and falls\n    back to flat table paths (`BASE_URI\u002FTABLE\u002F*.parquet`). For example,\n    `gcloud storage cp -r LOCAL_DIR\u002FSCHEMA gs:\u002F\u002FBUCKET\u002Fdata_unload\u002F` stages a\n    local schema folder of table subfolders under `data_unload\u002FSCHEMA\u002F`.\n*   **Single target dataset**: All discovered schemas load into one\n    `--dataset` by table or view name. If tables or views from different\n    source databases or schemas share a name, the loader stops before creating\n    the dataset and lists the conflicting objects; load each schema into its\n    own dataset instead.\n\n--------------------------------------------------------------------------------\n\n## 3. CLI execution interface (`bq load`)\n\n### Step 1: Provision the target dataset\n\nSet the shell variables for your environment, and then create the target\ndataset if it doesn't already exist:\n\n```bash\nPROJECT_ID=\"PROJECT_ID\"\nDATASET_ID=\"DATASET_ID\"\nLOCATION=\"LOCATION\"\nTABLE_NAME=\"TABLE_NAME\"\nBUCKET=\"BUCKET\"\nPREFIX=\"data_unload\"\n\nbq show --dataset --project_id=${PROJECT_ID} ${DATASET_ID} >\u002Fdev\u002Fnull 2>&1 || \\\nbq mk --dataset --project_id=${PROJECT_ID} --location=${LOCATION} ${DATASET_ID}\n```\n\nReplace the following:\n\n*   `PROJECT_ID`: the target Google Cloud project ID.\n*   `DATASET_ID`: the target BigQuery dataset ID.\n*   `LOCATION`: the BigQuery location for the dataset and load jobs (for\n    example, `us-central1`).\n*   `TABLE_NAME`: the name of the table to load.\n*   `BUCKET`: the name of the Cloud Storage bucket that holds the staged\n    Parquet files.\n\n### Step 2: Ingest Parquet tables (auto-creates native table schema)\n\nPass `--decimal_target_types=NUMERIC --decimal_target_types=BIGNUMERIC\n--decimal_target_types=STRING` so BigQuery selects the smallest compatible type\n(`NUMERIC` → `BIGNUMERIC` → `STRING`) based on each Parquet `DECIMAL(p, s)`\ncolumn's precision and scale: columns with `p - s \u003C= 29, s \u003C= 9` map to\n`NUMERIC`, columns with `p - s \u003C= 38, s \u003C= 38` (such as `DECIMAL(38, 10)`) widen\nto `BIGNUMERIC`, and larger `DECIMAL256` precisions or scales fall back to\n`STRING`:\n\n```bash\nbq load \\\n    --project_id=${PROJECT_ID} \\\n    --location=${LOCATION} \\\n    --source_format=PARQUET \\\n    --replace=true \\\n    --decimal_target_types=NUMERIC \\\n    --decimal_target_types=BIGNUMERIC \\\n    --decimal_target_types=STRING \\\n    ${DATASET_ID}.${TABLE_NAME} \\\n    \"gs:\u002F\u002F${BUCKET}\u002F${PREFIX}\u002F${TABLE_NAME}\u002F*.parquet\"\n```\n\nThe `--replace=true` flag overwrites the destination table, including its\nschema, with the schema inferred from the Parquet files. If you pre-created\ntables from translated BQMS DDL statements to preserve target types such as\n`JSON`, `INTERVAL`, or `RANGE`, either run `TRUNCATE TABLE` and then load with\n`--replace=false` (so that reruns stay idempotent and don't duplicate rows), or\nkeep `--replace=true` and pass an explicit `--schema`. If you use the loader\ntemplate with native `JSON` columns, also set\n`_WRAP_JSON_QUERY_WITH_PARSE_JSON = False` in the copied script: by default it\nwraps `JSON_QUERY()` calls in `SAFE.PARSE_JSON()` for `JSON` source columns that\nParquet loads as `STRING`, which fails on native `JSON` columns.\n\nParquet `TIMESTAMP` columns always load as BigQuery `TIMESTAMP`, including\nnaive timestamps (`isAdjustedToUTC=false`, such as source `TIMESTAMP WITHOUT\nTIME ZONE` columns) that the translated DDL maps to `DATETIME`; the wall-clock\nvalues are kept and read as UTC. To restore `DATETIME` after loading, rewrite\nthose columns with `DATETIME(column)`, which converts at UTC by default:\n\n```sql\nCREATE OR REPLACE TABLE `PROJECT_ID.DATASET_ID.TABLE_NAME` AS\nSELECT * REPLACE (DATETIME(created_at) AS created_at)\nFROM `PROJECT_ID.DATASET_ID.TABLE_NAME`;\n```\n\n### Step 3: Run a row-count audit\n\nCount the rows in the loaded table so that you can compare the result with the\nsource table:\n\n```bash\nbq query \\\n    --project_id=${PROJECT_ID} \\\n    --location=${LOCATION} \\\n    --use_legacy_sql=false \\\n    \"SELECT '${TABLE_NAME}' AS table_name, count(*) AS row_count FROM \\`${PROJECT_ID}\\`.\\`${DATASET_ID}\\`.\\`${TABLE_NAME}\\`;\"\n```\n\n--------------------------------------------------------------------------------\n\n## 4. Automated loader asset template (`assets\u002Fbq_loader_template.py`)\n\nThis skill provides an [automated BigQuery loader template][loader_template]\n(`assets\u002Fbq_loader_template.py`) for dataset creation, concurrent Parquet\nloading, direct view deployment, and table row-count auditing.\n\n### Agent workflow: Copy, conditionally customize, and execute\n\n1.  **Copy the asset template**: Always instruct the user to copy the\n    [automated BigQuery loader template][loader_template]\n    (`assets\u002Fbq_loader_template.py`) from this skill's directory (`SKILL_DIR`)\n    into their working directory (`.\u002Fbq_loader.py`) by using the `cp`\n    command—never write, synthesize, or inline a custom Python loader script\n    from scratch, and never paste or re-type the template contents into the\n    response. The template already handles quote-aware SQL splitting,\n    destination name collision checks, chunked row-count audits, and\n    multi-pass view retries, which a rewritten script would likely miss.\n    `SKILL_DIR` is the directory containing this `SKILL.md`:\n\n    ```bash\n    cp SKILL_DIR\u002Fassets\u002Fbq_loader_template.py .\u002Fbq_loader.py\n    ```\n\n2.  **Conditionally customize extension points**: Run the copy as-is. Modify it\n    only if one of the following applies (prefer editing the marked `#\n    CUSTOMIZE:` sections; `# DEFAULT SCAFFOLDING` sections can be kept unchanged\n    unless deeper orchestration adjustments are needed):\n\n    *   **Schema overrides and partitioning (`# CUSTOMIZE: Schema Overrides &\n        Partitioning`)**: Add custom `bq load` flags (such as\n        `--time_partitioning_field`, `--clustering_fields`, or explicit schema\n        JSON files) inside `load_parquet_table()`.\n    *   **Custom view rewriting (`# CUSTOMIZE: Custom View Rewriting &\n        Deployment`)**: Adjust view SQL regular expressions, cross-project\n        dataset mapping rules, or retry bounds in `_rewrite_view_sql()` and\n        `deploy_views()`. Set `_WRAP_JSON_QUERY_WITH_PARSE_JSON = False` if you\n        pre-created tables with native `JSON` columns.\n    *   **Connection and CLI wrapper (`# CUSTOMIZE: Connection & CLI\n        Wrapper`)**:\n        Pass custom `bq` CLI flags (for example, `--default_kms_key` in\n        `ensure_dataset()`, or `--destination_kms_key` and `--reservation_id` in\n        `load_parquet_table()` and `execute_sql()`).\n    *   **Post-load auditing (`# CUSTOMIZE: Post-Load Auditing`)**: Extend\n        `audit_row_counts()` with custom data integrity or column-level checksum\n        queries.\n\n3.  **Execute the script in your working directory**: Run the copied script\n    against a Cloud Storage URI or a local translation output folder:\n\n    ```bash\n    # Direct from a Cloud Storage translation_output URI with concurrency:\n    python3 .\u002Fbq_loader.py \\\n        --project \"PROJECT_ID\" \\\n        --dataset \"DATASET_ID\" \\\n        --location \"LOCATION\" \\\n        --translation-metadata-dir \"gs:\u002F\u002FBUCKET\u002Ftranslation_output\u002Fmetadata\u002F\" \\\n        --parquet-base-uri \"gs:\u002F\u002FBUCKET\u002Fdata_unload\u002F\" \\\n        --concurrency 8\n\n    # Using local translation output folder:\n    python3 .\u002Fbq_loader.py \\\n        --project \"PROJECT_ID\" \\\n        --dataset \"DATASET_ID\" \\\n        --location \"LOCATION\" \\\n        --translation-metadata-dir \"TRANSLATION_OUTPUT\u002Fmetadata\" \\\n        --parquet-base-uri \"gs:\u002F\u002FBUCKET\u002Fdata_unload\u002F\" \\\n        --concurrency 4\n    ```\n\n    When a view depends on another view, the first batch and first pass print\n    `bq` errors such as `Not found: Table ...` for the dependent view. These\n    errors are expected if the run ends with\n    `All N views successfully deployed across M passes.`\n\n### Arguments\n\n*   `--project` *(Required)*: Google Cloud project ID.\n*   `--dataset` *(Required)*: Target BigQuery dataset name.\n*   `--parquet-base-uri` *(Required)*: Base Cloud Storage URI containing table\n    Parquet subfolders (`gs:\u002F\u002FBUCKET\u002Fpath\u002F`).\n*   `--translation-metadata-dir` *(Required)*: Local folder or Cloud Storage URI\n    to translation output metadata directory. Auto-discovers tables and views.\n*   `--location` *(Optional, Default: `us-central1`)*: Target BigQuery location.\n*   `--concurrency` *(Optional, Default: `4`)*: Number of parallel workers for\n    concurrent `bq load` operations.\n\n[loader_template]: assets\u002Fbq_loader_template.py\n",{"name":5,"metadata":24,"description":7},{"version":25,"category":26,"publisher":9},"1.0.0","BigDataAndAnalytics","main","4c6800d20130b5a3233e414609f1241013cec8cc","skills\u002Fcloud\u002Fbigquery-migration-data-loader",2014,"https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fskills","https:\u002F\u002Fgithub.com\u002Fgoogle","https:\u002F\u002Fopensource.google\u002F","Google ❤️ Open Source","2026-11-14 23:31:00",{"source":8,"skillName":5,"commands":37,"prompt":47,"zipAvailable":48},[38,41,44],{"tool":39,"command":40},"npx","npx skills add google\u002Fskills --skill bigquery-migration-data-loader",{"tool":42,"command":43},"bunx","bunx skills add google\u002Fskills --skill bigquery-migration-data-loader",{"tool":45,"command":46},"pnpm","pnpm dlx skills add google\u002Fskills --skill bigquery-migration-data-loader","安装技能，技能地址：https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fcloud\u002Fbigquery-migration-data-loader\u002FSKILL.md",true,[50,56],{"path":51,"resourceType":52,"resourceTypeDesc":53,"sizeBytes":54,"sourceHtmlUrl":55},"assets\u002Fbq_loader_template.py","SCRIPT","脚本",45435,"https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fcloud\u002Fbigquery-migration-data-loader\u002Fassets\u002Fbq_loader_template.py",{"path":57,"resourceType":58,"resourceTypeDesc":59,"sizeBytes":60,"sourceHtmlUrl":61},"references\u002Fattribution.md","REFERENCE","参考文档",1942,"https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fcloud\u002Fbigquery-migration-data-loader\u002Freferences\u002Fattribution.md",[63,70,77,84,91,98],{"skillNo":64,"name":65,"nameZh":6,"description":66,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":67,"categories":68,"keywords":69,"publishedAt":19},"01M7DQ9K7JF4T7NJZ2K1MQZ44Q","cloud-operator-share-context","Shares Google Cloud operating context the user or their team already have — environments, projects, services and regions, product preferences, best practices, architecture guidance, runbooks — found in agent instruction files, local memory, skills and workflows, and the repository's GCP docs, with the operator agent's memory after the user reviews the list. Use when the user runs this skill, accepts the cloud-operator or cloud-operator-setup skill's offer to share their existing Google Cloud context, or asks to share, import or save that context or a GCP fact for the operator agent. Don't use for ordinary GCP requests, which go to the cloud-operator skill.","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fcloud\u002Fcloud-operator-share-context\u002FSKILL.md",[],[],{"skillNo":71,"name":72,"nameZh":6,"description":73,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":74,"categories":75,"keywords":76,"publishedAt":19},"01M7DQ9ERFGGQCFAWQW0KRKYBY","cloud-operator-setup","Sets up the operator agent in a Google Cloud project via the autocloud MCP server: picks the operator project, creates or checks the user's operator agent, saves the project, and offers to share the user's existing Google Cloud operating context with the operator agent's memory. Use when the user runs this skill, asks to set up the operator or create their operator agent, or chooses setup when the cloud-operator skill asks. Don't use for ordinary GCP requests or installing gcloud.","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fcloud\u002Fcloud-operator-setup\u002FSKILL.md",[],[],{"skillNo":78,"name":79,"nameZh":6,"description":80,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":81,"categories":82,"keywords":83,"publishedAt":19},"01M7B4RHQCM0DK2XQ7S7ZXVN8D","developer-device-platform-device-run","Runs automated, non-interactive jobs on remote Android devices with Developer Device Platform (DDP) Device Run using `gcloud beta device-run sessions`: native Android executables or shell scripts (for example CLI tools, custom runners, test harnesses or benchmarks) and Android instrumentation tests, on one or many devices, then waits for completion and collects per-device outputs and logs. Use when running a binary or test suite on remote devices without an interactive connection. Don't use it for interactive device reservations, adb tunnels or screen streaming (use developer-device-platform-basics), or for local devices.","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fcloud\u002Fdeveloper-device-platform-device-run\u002FSKILL.md",[],[],{"skillNo":85,"name":86,"nameZh":6,"description":87,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":88,"categories":89,"keywords":90,"publishedAt":19},"01M7B4R9YXMRW7RZP9Q9FMZJ2P","compute-vm-creation","Guides the planning, configuration, and provisioning of standalone Google Compute Engine virtual machines (VMs) and bare metal (-metal) instances using gcloud CLI commands or direct MCP tool execution. Use ONLY when the user wants to create, configure, or provision a new standalone Compute Engine VM or bare metal instance from conversational intents (hardware sizing, region selection, OS image, networking, security defaults). DO NOT read or use for Google Kubernetes Engine (GKE) Autopilot or Standard clusters, Kubernetes node pools or Pods, container orchestration, managing existing VMs, Managed Instance Groups (MIGs), or Instance Templates.","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fcloud\u002Fcompute-vm-creation\u002FSKILL.md",[],[],{"skillNo":92,"name":93,"nameZh":6,"description":94,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":95,"categories":96,"keywords":97,"publishedAt":19},"01M7B4QD02N0YBVT0838Z5K5VC","agent-platform-autorater-customization","Customizes an autorater (evaluation metric) for an AI agent so its grades match the user's own judgment, starting from the agent's real trajectories. Use when a user wants a metric tailored to their agent, wants to turn failing trajectories into rubrics, says an existing autorater grades their agent wrong, or wants an autorater to agree with human labels (autorater hillclimbing, judge calibration). Don't use for quick evals with built-in metrics or for improving the agent itself (use agent-platform-eval-flywheel).","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fcloud\u002Fagent-platform-autorater-customization\u002FSKILL.md",[],[],{"skillNo":99,"name":100,"nameZh":6,"description":101,"descriptionZh":6,"repositoryFullName":8,"ownerLogin":9,"ownerAvatarUrl":10,"ownerAccountNo":11,"ownerDisplayName":12,"repositoryNo":13,"starsCount":14,"licenseSpdxId":15,"licenseFileUrl":6,"sourceHtmlUrl":102,"categories":103,"keywords":104,"publishedAt":19},"01M78JP22K73KK96JH0JNDT5C4","iap-agent-platform-troubleshooting","Diagnoses Identity-Aware Proxy (IAP) denials of outbound requests from Gemini Enterprise Agent Platform agents that run on Agent Runtime and send traffic through Agent Gateway. Use when an agent request fails with \"Egress request is not authorized\", when Cloud Audit Logs show an IAP egressViaIAP decision with granted false, when IAP audit entries are missing while debugging agent egress, or when Access policies, IAP allow policies, policy bindings, or Agent Registry entries might block agent egress. Don't use for Gemini model IAM permission errors (such as aiplatform.endpoints.predict), Agent Platform API errors, or Agent Runtime deployment or 500 errors (use agent-platform-troubleshooting instead). Don't use for setting up, creating, or connecting an Agent Gateway, or for IAP web apps, IAP TCP forwarding, or SSH.","https:\u002F\u002Fgithub.com\u002Fgoogle\u002Fskills\u002Fblob\u002Fmain\u002Fskills\u002Fcloud\u002Fiap-agent-platform-troubleshooting\u002FSKILL.md",[],[]]