bigquery-migration-data-exporter
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseBigQuery Migration Data Exporter
BigQuery 迁移数据导出器
This skill coordinates the generation of type-aware data export SQL scripts
( files) for source data warehouses (such as Snowflake, Databricks,
Teradata, Oracle, and PostgreSQL) into target file formats (such as
BigQuery-aligned Parquet files), guided by dialect and format specifications
in the directory.
.sqlreferences/All templates in this skill are pure SQL generators with zero JDBC or database
connector dependencies.
[!TIP] Point directly to the BigQuery Migration Service (BQMS)directory (local path or Cloud Storage URI). It automatically discovers all physical tables and target BigQuery logical types fromtranslation_output/metadata.metadata/config/*.yaml
此 skill 协调生成类型感知的数据导出 SQL 脚本( 文件),用于将源数据仓库(如 Snowflake、Databricks、Teradata、Oracle 和 PostgreSQL)导出为目标文件格式(如与 BigQuery 对齐的 Parquet 文件),并以 目录中的 dialect 和格式规范为指导。
.sqlreferences/此 skill 中的所有模板均为纯 SQL 生成器,完全不依赖 JDBC 或数据库连接器。
[!TIP] 直接指向 BigQuery Migration Service (BQMS) 的目录(本地路径或 Cloud Storage URI)。 它会根据translation_output/metadata自动发现所有物理表和目标 BigQuery 逻辑类型。metadata/config/*.yaml
Usage Attribution
使用归因说明
MUST READ: Before executing any , REST API, or MCP command, you
MUST read and follow the instructions in
Usage Attribution.
gcloud必须阅读:在执行任何 、REST API 或 MCP 命令前,
必须阅读并遵循
使用归因说明中的说明。
gcloudBefore you begin
开始前
-
Google Cloud CLI & Project Setup: When reading translation outputs or metadata archives fromCloud Storage URIs, ensure the Google Cloud CLI is installed, verify that your Google Cloud project has an active Cloud Billing account attached, and configure the target project:
gs://bashgcloud config set project {project_id} -
Enable the API: When reading metadata from Cloud Storage (), ask the user before enabling APIs, then enable the Cloud Storage API (
gs://):storage.googleapis.combashgcloud services enable storage.googleapis.com -
Authentication & Required Identity and Access Management (IAM) Roles: Authenticate withand
gcloud auth login(or setgcloud auth application-default loginfor service account authentication). Verify that your identity or service account hasGOOGLE_APPLICATION_CREDENTIALS(Storage Object Viewer) on any Cloud Storage bucket holding input metadata. Creating a staging bucket requiresroles/storage.objectViewer(Storage Admin) on the Google Cloud project, and deleting staged files requiresroles/storage.admin(Storage Object Admin) on the staging bucket.roles/storage.objectAdmin -
Python Environment: The generator templates require Python 3.9 or later. Ask the user for confirmation before installing Python packages, then install PyYAML in a virtual environment (generator templates have zero JDBC or database connector dependencies):bash
pip install pyyaml==6.0.2 -
Region, Cost & Cleanup: Ask the user for confirmation before creating a new Cloud Storage bucket for staging exported Parquet files (), and default to
gcloud storage buckets create gs://{bucket} --location={region}unless your target BigQuery dataset uses another region (co-locate buckets with your dataset; see Google Cloud locations). Review Google Cloud Pricing before staging large exports. After BigQuery ingestion, temporary staged Parquet prefixes can be removed withus-central1. This deletion is permanent: run it only after the user explicitly confirms the exact URI, and never with an emptygcloud storage rm -r gs://{bucket}/{export_prefix}(which would delete every object in the bucket).{export_prefix} -
Snowflake Storage Integration: To unload Snowflake tables directly to a private Cloud Storage bucket (), Snowflake requires a [storage integration][snowflake_gcs_integration] that grants its service account access to the bucket. Ask the user for the integration name and pass it with the
--stage-path 'gcs://...'flag, which adds a--storage-integrationclause to each generatedSTORAGE_INTEGRATIONstatement. Unloads to a Snowflake stage (for example,COPY INTOor a named external stage) don't need this flag.@~/bqms_export/
-
Google Cloud CLI 与项目设置:从Cloud Storage URI 读取转换输出或元数据归档时,请确保已安装 Google Cloud CLI,验证 Google Cloud 项目已绑定有效的 Cloud Billing 账户,并配置目标项目:
gs://bashgcloud config set project {project_id} -
启用 API:从 Cloud Storage()读取元数据时,先征得用户同意,再启用 Cloud Storage API(
gs://):storage.googleapis.combashgcloud services enable storage.googleapis.com -
身份验证与必需的身份和访问管理 (IAM) 角色: 使用和
gcloud auth login进行身份验证(或设置gcloud auth application-default login以使用服务账户身份验证)。验证你的身份或服务账户对保存输入元数据的 Cloud Storage 桶拥有GOOGLE_APPLICATION_CREDENTIALS(Storage Object Viewer)角色。在 Google Cloud 项目中创建暂存桶需要roles/storage.objectViewer(Storage Admin)角色,删除暂存桶中的暂存文件需要roles/storage.admin(Storage Object Admin)角色。roles/storage.objectAdmin -
Python 环境:生成器模板要求 Python 3.9 或更高版本。安装 Python 包前须征得用户确认,然后在虚拟环境中安装 PyYAML(生成器模板不依赖任何 JDBC 或数据库连接器):bash
pip install pyyaml==6.0.2 -
区域、成本与清理:创建新的 Cloud Storage 桶来暂存导出的 Parquet 文件()前,须征得用户确认。除非目标 BigQuery 数据集使用其他区域,否则默认使用
gcloud storage buckets create gs://{bucket} --location={region}(将桶与数据集部署在同一区域;参见 Google Cloud locations)。暂存大规模导出前,请查看 Google Cloud Pricing。完成 BigQuery 数据导入后,可使用us-central1删除临时暂存的 Parquet 前缀。 此删除操作不可恢复:仅在用户明确确认确切 URI 后执行,且切勿使用空的gcloud storage rm -r gs://{bucket}/{export_prefix}(否则将删除桶中的所有对象)。{export_prefix} -
Snowflake Storage Integration:要将 Snowflake 表直接卸载到私有 Cloud Storage 桶(),Snowflake 必须使用 [storage integration][snowflake_gcs_integration] 授予其服务账户访问桶的权限。询问用户该 integration 的名称,并通过
--stage-path 'gcs://...'标志传入;此标志会为每个生成的--storage-integration语句添加COPY INTO子句。卸载到 Snowflake stage(例如STORAGE_INTEGRATION或指定的外部 stage)时不需要此标志。@~/bqms_export/
1. Direct Consumption of Translation Output Metadata
1. 直接使用转换输出元数据
bigquery-migration-data-exportertranslation_output/metadata/config/<database>/<schema>/<table_name>.yamlEach configuration file specifies:
- : Fully qualified source table name.
sourceName - : Source data types, precision, scale, and BigQuery target types.
columns - Table versus view: A config with neither nor
externalTableNamedescribes a view, which is recreated as a SQL view and isn't exported. The Databricks generator also honors an explicitexternalTableDdlPathfield when present.TableType
bigquery-migration-data-exportertranslation_output/metadata/config/<database>/<schema>/<table_name>.yaml每个配置文件指定:
- :源表的完全限定名称。
sourceName - :源数据类型、精度、小数位和 BigQuery 目标类型。
columns - 表与视图的区别:既没有 也没有
externalTableName的配置表示视图;该视图会重新创建为 SQL 视图,且不会导出。存在显式externalTableDdlPath字段时,Databricks 生成器也会遵循该字段。TableType
2. Format-Guided Type-Safe Export Fundamentals
2. 格式驱动的类型安全导出基础
A plain unguided or often fails during
BigQuery ingestion () due to serializer discrepancies (for example,
JSON encoding, fixed-width space padding, unbounded
Teradata/Oracle/PostgreSQL / scale truncation, PostgreSQL
locale currency formatting, Oracle time-of-day components, or
timestamp nanosecond ticks).
COPY INTO @stage FROM tableSELECT *bq loadVARIANTCHAR(n)NUMBERNUMERICMONEYDATETo ensure zero type drift and clean BigQuery ingestion, apply type-aware
projections guided by the target format and dialect specifications in the
directory. While Parquet is the standard and recommended
format for BigQuery batch ingestion due to columnar compression and strict
typing, the export structure adapts based on target format requirements.
references/For Parquet data exports, the core rules are summarized below; the mapping
references listed after them hold the full per-dialect type matrices:
-
Session Parameters (Snowflake):sql
ALTER SESSION SET TIME_OUTPUT_FORMAT = 'HH24:MI:SS.FF6'; ALTER SESSION SET TIMESTAMP_NTZ_OUTPUT_FORMAT = 'YYYY-MM-DD HH24:MI:SS.FF6'; ALTER SESSION SET TIMESTAMP_TZ_OUTPUT_FORMAT = 'YYYY-MM-DD HH24:MI:SS.FF6 TZHTZM'; -
Semi-Structured / JSON (,
VARIANT,OBJECT,STRUCT,MAP,ARRAY,JSON,JSONB,XMLTYPE,XML,UUID):INET- Snowflake: .
TO_VARCHAR(col) AS col - Databricks / Spark SQL: for
TO_JSON(col) AS col(and forMAP/STRUCTwhen targetingARRAYorJSON; native passthroughSTRINGwhen targetingcol/RECORD);ARRAYforCAST(col AS STRING) AS col/VARIANT/JSON.INTERVAL - Teradata: .
CAST(col AS CLOB) AS col - Oracle: for 21c+ native
JSON_SERIALIZE(col RETURNING CLOB) AS col, andJSONforXMLSERIALIZE(CONTENT col AS CLOB) AS col.XMLTYPE - PostgreSQL: for
CAST(col AS TEXT) AS col,JSON,JSONB,XML,UUID,INET,CIDR,MACADDR,INTERVAL, andBIT.ARRAY
- Snowflake:
-
Decimals, Numbers, Integers & Floats:
- /
NUMBER(p, s)/DECIMAL(p, s)withNUMERIC(p, s)→s > 0(orCAST(col AS DECIMAL(p, s)) AS colin Oracle, orCAST(col AS NUMBER(p, s)) AS colin PostgreSQL).CAST(col AS NUMERIC(p, s)) AS col - Unbounded or unconstrained /
NUMBER/NUMBER(*)/NUMERIC→DECIMALin Snowflake and Teradata,CAST(col AS DECIMAL(38, 9)) AS colin Oracle, orCAST(col AS NUMBER(38, 9)) AS colin PostgreSQL (supportsCAST(col AS NUMERIC(38, 9)) AS colinteger digits and<= 29fractional digits by default; override scale in Teradata, Oracle, and PostgreSQL by using9); PostgreSQL--unbounded-number-scale→MONEY.CAST(col AS NUMERIC(38, 2)) AS col - /
TINYINT/BYTEINT/SMALLINT/INT/INTEGER/BIGINT→SERIAL. In Oracle,CAST(col AS BIGINT) AS col→SMALLINTand the ANSICAST(col AS NUMBER(19, 0)) AS colaliasesNUMBER(38)/INT→INTEGER. Scale-0 decimals with aCAST(col AS NUMBER(38, 0)) AS colofTargetTypeproject as 64-bit integers; the mapping references list whichINT64/NUMBER(p, 0)precisions become 64-bit integers by default.DECIMAL(p, 0) - Databricks / Snowflake /
FLOAT→REAL; PostgreSQLCAST(col AS DOUBLE) AS col/REAL→DOUBLE PRECISION; OracleCAST(col AS DOUBLE PRECISION) AS col/BINARY_FLOAT/BINARY_DOUBLE→FLOAT(p)(widens to 64-bit IEEE-754CAST(col AS BINARY_DOUBLE) AS col).FLOAT64
-
Temporal (,
DATE,TIME,TIMESTAMP,TIMESTAMP_NTZ):TIMESTAMP WITH TIME ZONE- Snowflake: and
CAST(col AS TIMESTAMP_NTZ(6)) AS col.CAST(CONVERT_TIMEZONE('UTC', col) AS TIMESTAMP_NTZ(6)) AS col - Databricks / Spark SQL: when targeting
CAST(col AS TIMESTAMP) AS col, or leaveTIMESTAMPuncast when targeting BigQueryTIMESTAMP_NTZ.DATETIMEtoTIMESTAMP_NTZcasts (and back) use the session time zone, so run the scripts in a UTC session (see the [Databricks reference][databricks_map]).TIMESTAMP - Teradata: ,
CAST(col AS TIMESTAMP(6)) AS col, andCAST((col AT TIME ZONE 'GMT') AS TIMESTAMP(6)) AS col.CAST((col AT TIME ZONE 'GMT') AS TIME(6)) AS col - Oracle: for
CAST(col AS TIMESTAMP(6)) AS colandDATE(orTIMESTAMP(p)whenTRUNC(col) AS colexplicitly targets BigQueryDATE),DATEforCAST(SYS_EXTRACT_UTC(col) AS TIMESTAMP(6)) AS col, andTIMESTAMP WITH TIME ZONEforCAST(SYS_EXTRACT_UTC(CAST(col AS TIMESTAMP WITH TIME ZONE)) AS TIMESTAMP(6)) AS col(UTC, whatever the session time zone).TIMESTAMP WITH LOCAL TIME ZONE - PostgreSQL: for
CAST(col AS TIME(6)) AS colandTIME,TIMETZforCAST(col AS TIMESTAMP(6) WITHOUT TIME ZONE) AS col, andTIMESTAMP [WITHOUT TIME ZONE]forCAST(col AS TIMESTAMP(6) WITH TIME ZONE) AS col/TIMESTAMPTZ.TIMESTAMP WITH TIME ZONE
- Snowflake:
-
Fixed-Width Character Padding (/
CHAR(n)/NCHAR(n)/BPCHAR):GRAPHIC(n)(Teradata) orTRIM(TRAILING FROM col) AS col(Oracle and PostgreSQL) to strip fixed-width trailing pad spaces.RTRIM(col) AS col -
Explicit Target Types: A BigQueryfrom the BQMS config (for example a schema override to
TargetType,INT64,NUMERIC, orDATE) wins over the source-type defaults above so the Parquet column matches the BigQuery DDL. Cross-type overrides that a template doesn't convert keep the default projection:TIMESTAMP,STRING, andJSONin Oracle and Teradata (text columns stay text, binary columns stay bytes, and numeric or datetime columns keep their type);BYTESin Teradata and Oracle;BOOLin Oracle and Databricks;TIMEon Oracle columns other thanDATE/DATE; and targets other than numeric orTIMESTAMPon DatabricksSTRINGcolumns. IfDECIMALreports a type mismatch, edit the template'sbq loadhook.# CUSTOMIZE: Custom Type Projections
[!IMPORTANT] Always consult thedirectory ([Snowflake Parquet mapping reference][snowflake_map], [Databricks and Spark SQL Parquet mapping reference][databricks_map], [Teradata Parquet mapping reference][teradata_map], [Oracle Parquet mapping reference][oracle_map], and [PostgreSQL Parquet mapping reference][postgres_map]) to verify type conversions, formatting options, and dialect-specific export syntax.references/
在 BigQuery 数据导入()期间,直接执行未经规范指导的 或 经常会因序列化器差异而失败,例如 JSON 编码、 定宽空格填充、无界 Teradata/Oracle/PostgreSQL / 小数位截断、PostgreSQL 的区域设置货币格式、Oracle 的时间部分,或时间戳纳秒计数。
bq loadCOPY INTO @stage FROM tableSELECT *VARIANTCHAR(n)NUMBERNUMERICMONEYDATE为确保不存在类型漂移并顺利导入 BigQuery,请依据 目录中的目标格式和 dialect 规范应用类型感知的投影。虽然 Parquet 是 BigQuery 批量数据导入的标准推荐格式,因为它采用列式压缩和严格类型,但导出结构会根据目标格式要求进行调整。
references/对于 Parquet 数据导出,核心规则总结如下;后续列出的映射参考文档包含各 dialect 的完整类型矩阵:
-
会话参数(Snowflake):sql
ALTER SESSION SET TIME_OUTPUT_FORMAT = 'HH24:MI:SS.FF6'; ALTER SESSION SET TIMESTAMP_NTZ_OUTPUT_FORMAT = 'YYYY-MM-DD HH24:MI:SS.FF6'; ALTER SESSION SET TIMESTAMP_TZ_OUTPUT_FORMAT = 'YYYY-MM-DD HH24:MI:SS.FF6 TZHTZM'; -
半结构化数据 / JSON(、
VARIANT、OBJECT、STRUCT、MAP、ARRAY、JSON、JSONB、XMLTYPE、XML、UUID):INET- Snowflake:。
TO_VARCHAR(col) AS col - Databricks / Spark SQL:针对 使用
MAP;当TO_JSON(col) AS col/STRUCT的目标为ARRAY或JSON时也使用此方式;目标为STRING/RECORD时直接透传ARRAY;针对col/VARIANT/JSON使用INTERVAL。CAST(col AS STRING) AS col - Teradata:。
CAST(col AS CLOB) AS col - Oracle:针对 21c+ 原生 使用
JSON,针对JSON_SERIALIZE(col RETURNING CLOB) AS col使用XMLTYPE。XMLSERIALIZE(CONTENT col AS CLOB) AS col - PostgreSQL:针对 、
JSON、JSONB、XML、UUID、INET、CIDR、MACADDR、INTERVAL和BIT使用ARRAY。CAST(col AS TEXT) AS col
- Snowflake:
-
Decimal、Numbers、Integers 与 Floats:
- 精度为 的
s > 0/NUMBER(p, s)/DECIMAL(p, s)→NUMERIC(p, s)(Oracle 中为CAST(col AS DECIMAL(p, s)) AS col,PostgreSQL 中为CAST(col AS NUMBER(p, s)) AS col)。CAST(col AS NUMERIC(p, s)) AS col - 无界或未限制精度的 /
NUMBER/NUMBER(*)/NUMERIC→ Snowflake 和 Teradata 中为DECIMAL,Oracle 中为CAST(col AS DECIMAL(38, 9)) AS col,PostgreSQL 中为CAST(col AS NUMBER(38, 9)) AS col(默认支持CAST(col AS NUMERIC(38, 9)) AS col位整数和<= 29位小数;在 Teradata、Oracle 和 PostgreSQL 中可使用9覆盖小数位);PostgreSQL--unbounded-number-scale→MONEY。CAST(col AS NUMERIC(38, 2)) AS col - /
TINYINT/BYTEINT/SMALLINT/INT/INTEGER/BIGINT→SERIAL。在 Oracle 中,CAST(col AS BIGINT) AS col→SMALLINT,ANSICAST(col AS NUMBER(19, 0)) AS col别名NUMBER(38)/INT→INTEGER。目标类型为CAST(col AS NUMBER(38, 0)) AS col且小数位为 0 的 decimal 会投影为 64 位整数;映射参考文档列出了默认转换为 64 位整数的INT64/NUMBER(p, 0)精度。DECIMAL(p, 0) - Databricks / Snowflake /
FLOAT→REAL;PostgreSQLCAST(col AS DOUBLE) AS col/REAL→DOUBLE PRECISION;OracleCAST(col AS DOUBLE PRECISION) AS col/BINARY_FLOAT/BINARY_DOUBLE→FLOAT(p)(扩展为 64 位 IEEE-754CAST(col AS BINARY_DOUBLE) AS col)。FLOAT64
- 精度为
-
时间类型(、
DATE、TIME、TIMESTAMP、TIMESTAMP_NTZ):TIMESTAMP WITH TIME ZONE- Snowflake:和
CAST(col AS TIMESTAMP_NTZ(6)) AS col。CAST(CONVERT_TIMEZONE('UTC', col) AS TIMESTAMP_NTZ(6)) AS col - Databricks / Spark SQL:目标为 时使用
TIMESTAMP;目标为 BigQueryCAST(col AS TIMESTAMP) AS col时,不对DATETIME执行 cast。TIMESTAMP_NTZ与TIMESTAMP_NTZ之间的转换会使用会话时区,因此在 UTC 会话中运行脚本(参见 [Databricks reference][databricks_map])。TIMESTAMP - Teradata:、
CAST(col AS TIMESTAMP(6)) AS col和CAST((col AT TIME ZONE 'GMT') AS TIMESTAMP(6)) AS col。CAST((col AT TIME ZONE 'GMT') AS TIME(6)) AS col - Oracle:针对 和
DATE使用TIMESTAMP(p)(当CAST(col AS TIMESTAMP(6)) AS col明确映射到 BigQueryDATE时使用DATE);针对TRUNC(col) AS col使用TIMESTAMP WITH TIME ZONE;针对CAST(SYS_EXTRACT_UTC(col) AS TIMESTAMP(6)) AS col使用TIMESTAMP WITH LOCAL TIME ZONE,以确保使用 UTC 而不受会话时区影响。CAST(SYS_EXTRACT_UTC(CAST(col AS TIMESTAMP WITH TIME ZONE)) AS TIMESTAMP(6)) AS col - PostgreSQL:针对 和
TIME使用TIMETZ;针对CAST(col AS TIME(6)) AS col使用TIMESTAMP [WITHOUT TIME ZONE];针对CAST(col AS TIMESTAMP(6) WITHOUT TIME ZONE) AS col/TIMESTAMPTZ使用TIMESTAMP WITH TIME ZONE。CAST(col AS TIMESTAMP(6) WITH TIME ZONE) AS col
- Snowflake:
-
定长字符填充(/
CHAR(n)/NCHAR(n)/BPCHAR):使用GRAPHIC(n)(Teradata)或TRIM(TRAILING FROM col) AS col(Oracle 和 PostgreSQL),去除定长字段末尾的填充空格。RTRIM(col) AS col -
显式目标类型:BQMS 配置中的 BigQuery(例如 schema 覆盖为
TargetType、INT64、NUMERIC或DATE)优先于上述源类型默认值,以确保 Parquet 列与 BigQuery DDL 匹配。模板无法转换的跨类型覆盖会保留默认投影:Oracle 和 Teradata 中的TIMESTAMP、STRING和JSON(文本列保持文本、二进制列保持 bytes、数值或 datetime 列保持原类型);Teradata 和 Oracle 中的BYTES;Oracle 和 Databricks 中的BOOL;Oracle 中除TIME/DATE之外的列映射到TIMESTAMP;以及 DatabricksDATE列映射到数值或DECIMAL以外的目标类型。如果STRING报告类型不匹配,请编辑模板中的bq loadhook。# CUSTOMIZE: Custom Type Projections
[!IMPORTANT] 始终查阅目录 ([Snowflake Parquet mapping reference][snowflake_map]、 [Databricks and Spark SQL Parquet mapping reference][databricks_map]、 [Teradata Parquet mapping reference][teradata_map]、 [Oracle Parquet mapping reference][oracle_map] 和 [PostgreSQL Parquet mapping reference][postgres_map]), 以验证类型转换、格式化选项和特定 dialect 的导出语法。references/
3. Asset Templates & Agent Workflow
3. 资产模板与 Agent 工作流
This skill provides pure-Python SQL generator asset templates in (with
no JDBC or warehouse driver dependencies):
assets/- [Snowflake export SQL generator template][snowflake_exporter_template]
()
assets/export_snowflake_tables_template.py - [Databricks export SQL generator template][databricks_exporter_template]
()
assets/export_databricks_tables_template.py - [Teradata export SQL generator template][teradata_exporter_template]
()
assets/export_teradata_tables_template.py - [Oracle export SQL generator template][oracle_exporter_template]
()
assets/export_oracle_tables_template.py - [PostgreSQL export SQL generator template][postgres_exporter_template]
()
assets/export_postgres_tables_template.py
此 skill 在 中提供纯 Python SQL 生成器资产模板(不依赖任何 JDBC 或数据仓库驱动):
assets/- [Snowflake 导出 SQL 生成器模板][snowflake_exporter_template]
()
assets/export_snowflake_tables_template.py - [Databricks 导出 SQL 生成器模板][databricks_exporter_template]
()
assets/export_databricks_tables_template.py - [Teradata 导出 SQL 生成器模板][teradata_exporter_template]
()
assets/export_teradata_tables_template.py - [Oracle 导出 SQL 生成器模板][oracle_exporter_template]
()
assets/export_oracle_tables_template.py - [PostgreSQL 导出 SQL 生成器模板][postgres_exporter_template]
()
assets/export_postgres_tables_template.py
Agent Workflow: Copy, Conditionally Customize, and Generate SQL
Agent 工作流:复制、按需定制并生成 SQL
-
Copy the Asset Template: Copyfrom this skill's directory (
assets/<template_name>_template.py) into your working directory (copy the file; do not paste or re-type the template contents into the response).<SKILL_DIR>is the directory containing this<SKILL_DIR>:SKILL.mdbash# For Snowflake: cp <SKILL_DIR>/assets/export_snowflake_tables_template.py ./export_snowflake_tables.py # For Databricks: cp <SKILL_DIR>/assets/export_databricks_tables_template.py ./export_databricks_tables.py # For Teradata: cp <SKILL_DIR>/assets/export_teradata_tables_template.py ./export_teradata_tables.py # For Oracle: cp <SKILL_DIR>/assets/export_oracle_tables_template.py ./export_oracle_tables.py # For PostgreSQL: cp <SKILL_DIR>/assets/export_postgres_tables_template.py ./export_postgres_tables.py -
Conditionally Customize Extension Points: Run the copy as-is. Modify it only if one of the following applies (prefer editing the markedsections;
# CUSTOMIZE:sections can be kept unchanged unless deeper orchestration adjustments are needed):# DEFAULT SCAFFOLDING- Custom Type Projections (): Adjust
# CUSTOMIZE: Custom Type Projectionsinformat_column_cast(),export_snowflake_tables.py,export_databricks_tables.py,export_teradata_tables.py, orexport_oracle_tables.pyfor non-standard data types, custom precision bounds, or special JSON/geography serialization formats.export_postgres_tables.py - Stage & Storage Configuration (): Customize
# CUSTOMIZE: Stage & Storage Configurationfile format options (COPY INTO, compression codecs, or encryption flags) inMAX_FILE_SIZEor Spark SQL_build_copy_into_query()options inINSERT OVERWRITE DIRECTORY. Pass Snowflake storage integration names with the_build_insert_overwrite_query()flag instead of editing the template.--storage-integration - Table & Row Filtering (/
# CUSTOMIZE: Table & Row Filtering): Add custom# CUSTOMIZE: Row Filtersclauses, partition predicates, or custom schema/table inclusion/exclusion filters inWHERE,_filter_tables_to_export(), or_build_select_query().load_tables_from_metadata_path()
- Custom Type Projections (
-
Generate the Export SQL Files: Run the copied script with(
python3,python3 ./export_snowflake_tables.py,python3 ./export_databricks_tables.py,python3 ./export_teradata_tables.py, orpython3 ./export_oracle_tables.py) to output a unifiedpython3 ./export_postgres_tables.pyscript (.sql) and/or per-table--output-sqlscripts (*_export.sql).--output-dir -
Check the Output: Confirm the script exited with status, report any
0lines from stderr (such as skipped duplicate tables), and check that the number ofWARNING:markers (or-- Unload Table:files) matches the tables you expect to export.*_export.sql
-
复制资产模板:将此 skill 目录()中的
<SKILL_DIR>复制到工作目录(复制文件;不要在回复中粘贴或重新输入模板内容)。assets/<template_name>_template.py是包含<SKILL_DIR>的目录:SKILL.mdbash# For Snowflake: cp <SKILL_DIR>/assets/export_snowflake_tables_template.py ./export_snowflake_tables.py # For Databricks: cp <SKILL_DIR>/assets/export_databricks_tables_template.py ./export_databricks_tables.py # For Teradata: cp <SKILL_DIR>/assets/export_teradata_tables_template.py ./export_teradata_tables.py # For Oracle: cp <SKILL_DIR>/assets/export_oracle_tables_template.py ./export_oracle_tables.py # For PostgreSQL: cp <SKILL_DIR>/assets/export_postgres_tables_template.py ./export_postgres_tables.py -
按需定制扩展点:原样运行复制后的脚本。仅在出现以下情况之一时修改;优先编辑标记为的部分;除非需要更深入的编排调整,否则
# CUSTOMIZE:部分可以保持不变:# DEFAULT SCAFFOLDING- 自定义类型投影(): 针对非标准数据类型、自定义精度边界或特殊的 JSON/geography 序列化格式,调整
# CUSTOMIZE: Custom Type Projections、export_snowflake_tables.py、export_databricks_tables.py、export_teradata_tables.py或export_oracle_tables.py中的export_postgres_tables.py。format_column_cast() - Stage 与 Storage 配置():在
# CUSTOMIZE: Stage & Storage Configuration中自定义_build_copy_into_query()文件格式选项(COPY INTO、压缩编解码器或加密标志),或在MAX_FILE_SIZE中自定义 Spark SQL_build_insert_overwrite_query()选项。通过INSERT OVERWRITE DIRECTORY标志传入 Snowflake storage integration 名称,不要直接编辑模板。--storage-integration - 表与行过滤(/
# CUSTOMIZE: Table & Row Filtering):在# CUSTOMIZE: Row Filters、_filter_tables_to_export()或_build_select_query()中添加自定义load_tables_from_metadata_path()子句、分区谓词或自定义 schema/table 包含与排除过滤器。WHERE
- 自定义类型投影(
-
生成导出 SQL 文件:使用运行复制后的脚本(
python3、python3 ./export_snowflake_tables.py、python3 ./export_databricks_tables.py、python3 ./export_teradata_tables.py或python3 ./export_oracle_tables.py),以输出统一的python3 ./export_postgres_tables.py脚本(.sql)和/或每张表对应的--output-sql脚本(*_export.sql)。--output-dir -
检查输出:确认脚本退出状态为,报告 stderr 中出现的任何
0行(例如跳过了重复表),并检查WARNING:标记(或-- Unload Table:文件)的数量是否与预期导出的表数量一致。*_export.sql
A. Snowflake Export SQL Generator (./export_snowflake_tables.py
)
./export_snowflake_tables.pyA. Snowflake 导出 SQL 生成器(./export_snowflake_tables.py
)
./export_snowflake_tables.py1. Generate Unified Export SQL Script (--output-sql
)
--output-sql1. 生成统一导出 SQL 脚本(--output-sql
)
--output-sqlUnloading directly to Cloud Storage () requires a Snowflake storage
integration (see Before you begin):
gcs://bash
python3 ./export_snowflake_tables.py \
--translation-metadata-dir gs://my-bucket/translation_output/metadata/ \
--stage-path 'gcs://my-bucket/data_unload/' \
--storage-integration my_gcs_integration \
--output-sql export_snowflake_to_parquet.sql直接卸载到 Cloud Storage()需要 Snowflake storage integration(参见开始前):
gcs://bash
python3 ./export_snowflake_tables.py \
--translation-metadata-dir gs://my-bucket/translation_output/metadata/ \
--stage-path 'gcs://my-bucket/data_unload/' \
--storage-integration my_gcs_integration \
--output-sql export_snowflake_to_parquet.sql2. Generate Per-Table Export SQL Files (--output-dir
)
--output-dir2. 生成每张表的导出 SQL 文件(--output-dir
)
--output-dirbash
python3 ./export_snowflake_tables.py \
--translation-metadata-dir ./translated_output/metadata \
--stage-path '@~/bqms_export/' \
--output-dir ./export_sqlWhen the tables span more than one Snowflake database (tables whose metadata
omits the database count as ), the generator
prefixes each unload subpath, label, and per-table file name
with the database (for example, ) so that
identically named pairs don't overwrite each other.
--default-database-- Unload Table:@~/bqms_export/<DB>/<SCHEMA>/<TABLE>/<SCHEMA>.<TABLE>Snowflake resolves unquoted identifiers to uppercase, so names that aren't
uppercase are double-quoted to keep their exact case. Pass
and exactly as the catalog stores them (usually uppercase,
such as ).
--default-database--default-schemaANALYTICSbash
python3 ./export_snowflake_tables.py \
--translation-metadata-dir ./translated_output/metadata \
--stage-path '@~/bqms_export/' \
--output-dir ./export_sql当表分布在多个 Snowflake 数据库中时(元数据未指定数据库的表使用 ),生成器会在每个卸载子路径、 标签和单表文件名前加上数据库名称(例如 ),从而避免同名 组合相互覆盖。
--default-database-- Unload Table:@~/bqms_export/<DB>/<SCHEMA>/<TABLE>/<SCHEMA>.<TABLE>Snowflake 会将未加引号的标识符解析为大写,因此非大写名称会使用双引号,以保留其精确大小写。请按目录中实际存储的形式传入 和 (通常为大写,例如 )。
--default-database--default-schemaANALYTICSB. Databricks Export SQL Generator (./export_databricks_tables.py
)
./export_databricks_tables.pyB. Databricks 导出 SQL 生成器(./export_databricks_tables.py
)
./export_databricks_tables.pyGenerates catalog-agnostic 2-part Spark SQL (or standalone by using ) scripts () with explicit type-safe projections for all discovered
Delta / Spark tables. Leave unset so the generated files work
across both Unity Catalog and (activated by using
on the target Spark or Databricks session at execution time), or pass for explicit 3-part table qualification. also exports
only the tables of that catalog when the metadata names catalogs (3-part YAML
values or the extractor ); the generator exits with
an error that lists the available catalogs when it matches none of them:
<schema>.<table>INSERT OVERWRITE DIRECTORY ... USING PARQUETSELECT--export-mode select.sql--catalog.sqlhive_metastoreUSE CATALOG--catalog <CATALOG>--catalogsourceNamemetadata.zipbash
python3 ./export_databricks_tables.py \
--translation-metadata-dir ./translated_output/metadata \
--stage-path '/tmp/databricks_export' \
--output-sql export_databricks_to_parquet.sql \
--output-dir ./export_sql为所有发现的 Delta / Spark 表生成与 catalog 无关、使用两部分 限定的 Spark SQL (或通过 生成独立的 )脚本(),并包含显式的类型安全投影。不要设置 ,这样生成的 文件便可在 Unity Catalog 和 中使用(在目标 Spark 或 Databricks 会话执行时通过 激活);也可以传入 以显式使用三部分表名限定。当元数据名称包含 catalog(三部分 YAML 值或提取器 )时, 还会仅导出该 catalog 下的表;如果未匹配到任何 catalog,生成器将退出并报错列出可用 catalog:
<schema>.<table>INSERT OVERWRITE DIRECTORY ... USING PARQUET--export-mode selectSELECT.sql--catalog.sqlhive_metastoreUSE CATALOG--catalog <CATALOG>sourceNamemetadata.zip--catalogbash
python3 ./export_databricks_tables.py \
--translation-metadata-dir ./translated_output/metadata \
--stage-path '/tmp/databricks_export' \
--output-sql export_databricks_to_parquet.sql \
--output-dir ./export_sqlC. Teradata Export SQL Generator (./export_teradata_tables.py
)
./export_teradata_tables.pyC. Teradata 导出 SQL 生成器(./export_teradata_tables.py
)
./export_teradata_tables.pyGenerates explicit-cast Teradata scripts () with and markers consumed by
downstream Python Parquet streaming scripts (for example, by using
and ). Use as a fallback qualifier when
metadata omits (defaults to ), (repeatable) as an allow-list filter to export only specific databases
(the generator exits with an error when it leaves no tables),
to adjust the fractional scale for unbounded
/ columns (default ), and if
fixed-width trailing spaces must be preserved instead of trimmed:
SELECT.sql-- Unload Table: <DB>.<TABLE> -> Parquet-- Required Columns:teradatasqlpyarrow--default-database <DB>TableSchema$TERADATA_DATABASE--database <DB>--unbounded-number-scale <S>NUMBERNUMBER(*)9--keep-char-paddingCHAR(n)bash
undefined生成带显式 cast 的 Teradata 脚本(),其中包含 和 标记,供下游 Python Parquet 流式脚本读取(例如使用 和 )。当元数据缺少 时,使用 作为回退限定符(默认为 );使用可重复传入的 作为允许列表过滤器,仅导出指定数据库(如果过滤后没有表,生成器将退出并报错);使用 调整无界 / 列的小数位(默认值为 );如果必须保留定宽 末尾的空格而不进行裁剪,则使用 :
SELECT.sql-- Unload Table: <DB>.<TABLE> -> Parquet-- Required Columns:teradatasqlpyarrowTableSchema--default-database <DB>$TERADATA_DATABASE--database <DB>--unbounded-number-scale <S>NUMBERNUMBER(*)9CHAR(n)--keep-char-paddingbash
undefined1. Generate per-table Teradata export SQL files from BQMS translation output:
1. Generate per-table Teradata export SQL files from BQMS translation output:
python3 ./export_teradata_tables.py
--translation-metadata-dir ./translated_output/metadata
--default-database my_db
--output-dir ./export_sql
--translation-metadata-dir ./translated_output/metadata
--default-database my_db
--output-dir ./export_sql
python3 ./export_teradata_tables.py
--translation-metadata-dir ./translated_output/metadata
--default-database my_db
--output-dir ./export_sql
--translation-metadata-dir ./translated_output/metadata
--default-database my_db
--output-dir ./export_sql
2. Generate a unified export SQL script from a Teradata extractor metadata.zip:
2. Generate a unified export SQL script from a Teradata extractor metadata.zip:
python3 ./export_teradata_tables.py
--metadata-zip gs://my-bucket/teradata_metadata/dwh-migration-teradata-metadata.zip
--database my_db
--output-sql teradata_export.sql
--metadata-zip gs://my-bucket/teradata_metadata/dwh-migration-teradata-metadata.zip
--database my_db
--output-sql teradata_export.sql
undefinedpython3 ./export_teradata_tables.py
--metadata-zip gs://my-bucket/teradata_metadata/dwh-migration-teradata-metadata.zip
--database my_db
--output-sql teradata_export.sql
--metadata-zip gs://my-bucket/teradata_metadata/dwh-migration-teradata-metadata.zip
--database my_db
--output-sql teradata_export.sql
undefinedD. Oracle Export SQL Generator (./export_oracle_tables.py
)
./export_oracle_tables.pyD. Oracle 导出 SQL 生成器(./export_oracle_tables.py
)
./export_oracle_tables.pyGenerates explicit-cast Oracle scripts () with and markers consumed by
downstream Python Parquet streaming scripts (for example, by using
and ). Use as a fallback
qualifier when metadata omits (defaults to ),
(repeatable) as an allow-list filter to export only specific
schemas, to adjust the fractional scale for
unconstrained columns (default ), and if
fixed-width / trailing spaces must be preserved instead of
trimmed. Identifiers that aren't uppercase are double-quoted to keep their exact
case, so pass exactly as the catalog stores it (usually
uppercase, such as ):
SELECT.sql-- Unload Table: <SCHEMA>.<TABLE> -> Parquet-- Required Columns:python-oracledbpyarrow--default-schema <SCHEMA>TableSchema$ORACLE_SCHEMA--schema <SCHEMA>--unbounded-number-scale <S>NUMBER9--keep-char-paddingCHAR(n)NCHAR(n)--default-schemaHRbash
undefined生成带显式 cast 的 Oracle 脚本(),其中包含 和 标记,供下游 Python Parquet 流式脚本读取(例如使用 和 )。当元数据缺少 时,使用 作为回退限定符(默认为 );使用可重复传入的 作为允许列表过滤器,仅导出指定 schema;使用 调整未限制精度的 列的小数位(默认值为 );如果必须保留定宽 / 末尾的空格而不进行裁剪,则使用 。非大写标识符会使用双引号,以保留其精确大小写,因此请按目录中实际存储的形式传入 (通常为大写,例如 ):
SELECT.sql-- Unload Table: <SCHEMA>.<TABLE> -> Parquet-- Required Columns:python-oracledbpyarrowTableSchema--default-schema <SCHEMA>$ORACLE_SCHEMA--schema <SCHEMA>--unbounded-number-scale <S>NUMBER9CHAR(n)NCHAR(n)--keep-char-padding--default-schemaHRbash
undefined1. Generate per-table Oracle export SQL files from BQMS translation output:
1. Generate per-table Oracle export SQL files from BQMS translation output:
python3 ./export_oracle_tables.py
--translation-metadata-dir ./translated_output/metadata
--default-schema MY_SCHEMA
--output-dir ./export_sql
--translation-metadata-dir ./translated_output/metadata
--default-schema MY_SCHEMA
--output-dir ./export_sql
python3 ./export_oracle_tables.py
--translation-metadata-dir ./translated_output/metadata
--default-schema MY_SCHEMA
--output-dir ./export_sql
--translation-metadata-dir ./translated_output/metadata
--default-schema MY_SCHEMA
--output-dir ./export_sql
2. Generate a unified export SQL script from an Oracle extractor metadata.zip:
2. Generate a unified export SQL script from an Oracle extractor metadata.zip:
python3 ./export_oracle_tables.py
--metadata-zip gs://my-bucket/oracle_metadata/dwh-migration-oracle-metadata.zip
--schema MY_SCHEMA
--output-sql oracle_export.sql
--metadata-zip gs://my-bucket/oracle_metadata/dwh-migration-oracle-metadata.zip
--schema MY_SCHEMA
--output-sql oracle_export.sql
undefinedpython3 ./export_oracle_tables.py
--metadata-zip gs://my-bucket/oracle_metadata/dwh-migration-oracle-metadata.zip
--schema MY_SCHEMA
--output-sql oracle_export.sql
--metadata-zip gs://my-bucket/oracle_metadata/dwh-migration-oracle-metadata.zip
--schema MY_SCHEMA
--output-sql oracle_export.sql
undefinedE. PostgreSQL Export SQL Generator (./export_postgres_tables.py
)
./export_postgres_tables.pyE. PostgreSQL 导出 SQL 生成器(./export_postgres_tables.py
)
./export_postgres_tables.pyGenerates explicit-cast PostgreSQL scripts () with and markers consumed
by downstream Python Parquet streaming scripts (for example, by using
and ). Use as a fallback qualifier when
metadata omits (defaults to ),
(repeatable) as an allow-list filter to export only specific schemas,
(repeatable) to keep only one database's tables when the
metadata spans several PostgreSQL databases (the generator exits with an error
when / leave no tables),
to adjust the fractional scale for unconstrained
columns (default ), and if fixed-width
/ trailing spaces must be preserved instead of trimmed.
Identifiers that aren't lowercase are double-quoted to keep their exact case,
so pass exactly as the catalog stores it (usually lowercase,
such as ). BQMS YAML configs record PostgreSQL columns as a
placeholder, so pass the extractor together
with (example 3) to restore exact
and details:
SELECT.sql-- Unload Table: <SCHEMA>.<TABLE> -> Parquet-- Required Columns:psycopg2pyarrow--default-schema <SCHEMA>TableSchema$PG_SCHEMA--schema <SCHEMA>--database <DB>--schema--database--unbounded-number-scale <S>NUMERIC9--keep-char-paddingCHAR(n)BPCHAR--default-schemapublicNUMERICNUMERIC(18, 0)--metadata-zip--translation-metadata-dirNUMERIC(p, s)NOT NULLbash
undefined生成带显式 cast 的 PostgreSQL 脚本(),其中包含 和 标记,供下游 Python Parquet 流式脚本读取(例如使用 和 )。当元数据缺少 时,使用 作为回退限定符(默认为 );使用可重复传入的 作为允许列表过滤器,仅导出指定 schema;使用可重复传入的 ,在元数据涵盖多个 PostgreSQL 数据库时仅保留一个数据库的表(如果 / 过滤后没有表,生成器将退出并报错);使用 调整未限制精度的 列的小数位(默认值为 );如果必须保留定宽 / 末尾的空格而不进行裁剪,则使用 。非小写标识符会使用双引号,以保留其精确大小写,因此请按目录中实际存储的形式传入 (通常为小写,例如 )。BQMS YAML 配置将 PostgreSQL 列记录为 占位符,因此请将提取器的 与 一同传入(参见示例 3),以恢复准确的 和 详情:
SELECT.sql-- Unload Table: <SCHEMA>.<TABLE> -> Parquet-- Required Columns:psycopg2pyarrowTableSchema--default-schema <SCHEMA>$PG_SCHEMA--schema <SCHEMA>--database <DB>--schema--database--unbounded-number-scale <S>NUMERIC9CHAR(n)BPCHAR--keep-char-padding--default-schemapublicNUMERICNUMERIC(18, 0)--metadata-zip--translation-metadata-dirNUMERIC(p, s)NOT NULLbash
undefined1. Generate per-table PostgreSQL export SQL files from BQMS translation output:
1. Generate per-table PostgreSQL export SQL files from BQMS translation output:
python3 ./export_postgres_tables.py
--translation-metadata-dir ./translated_output/metadata
--default-schema public
--output-dir ./export_sql
--translation-metadata-dir ./translated_output/metadata
--default-schema public
--output-dir ./export_sql
python3 ./export_postgres_tables.py
--translation-metadata-dir ./translated_output/metadata
--default-schema public
--output-dir ./export_sql
--translation-metadata-dir ./translated_output/metadata
--default-schema public
--output-dir ./export_sql
2. Generate a unified export SQL script from a PostgreSQL extractor metadata.zip:
2. Generate a unified export SQL script from a PostgreSQL extractor metadata.zip:
python3 ./export_postgres_tables.py
--metadata-zip gs://my-bucket/postgres_metadata/postgresql-metadata.zip
--schema public
--output-sql postgres_export.sql
--metadata-zip gs://my-bucket/postgres_metadata/postgresql-metadata.zip
--schema public
--output-sql postgres_export.sql
python3 ./export_postgres_tables.py
--metadata-zip gs://my-bucket/postgres_metadata/postgresql-metadata.zip
--schema public
--output-sql postgres_export.sql
--metadata-zip gs://my-bucket/postgres_metadata/postgresql-metadata.zip
--schema public
--output-sql postgres_export.sql
3. Combine BQMS translation output with the extractor metadata.zip:
3. Combine BQMS translation output with the extractor metadata.zip:
python3 ./export_postgres_tables.py
--translation-metadata-dir ./translated_output/metadata
--metadata-zip gs://my-bucket/postgres_metadata/postgresql-metadata.zip
--default-schema public
--output-dir ./export_sql
--translation-metadata-dir ./translated_output/metadata
--metadata-zip gs://my-bucket/postgres_metadata/postgresql-metadata.zip
--default-schema public
--output-dir ./export_sql
--------------------------------------------------------------------------------python3 ./export_postgres_tables.py
--translation-metadata-dir ./translated_output/metadata
--metadata-zip gs://my-bucket/postgres_metadata/postgresql-metadata.zip
--default-schema public
--output-dir ./export_sql
--translation-metadata-dir ./translated_output/metadata
--metadata-zip gs://my-bucket/postgres_metadata/postgresql-metadata.zip
--default-schema public
--output-dir ./export_sql
--------------------------------------------------------------------------------4. Generated SQL Pattern
4. 生成的 SQL 模式
Snowflake COPY INTO Pattern
Snowflake COPY INTO 模式
sql
ALTER SESSION SET TIME_OUTPUT_FORMAT = 'HH24:MI:SS.FF6';
ALTER SESSION SET TIMESTAMP_NTZ_OUTPUT_FORMAT = 'YYYY-MM-DD HH24:MI:SS.FF6';
ALTER SESSION SET TIMESTAMP_TZ_OUTPUT_FORMAT = 'YYYY-MM-DD HH24:MI:SS.FF6 TZHTZM';
COPY INTO 'gcs://my-bucket/data_unload/RAW_POS/MENU/'
FROM (
SELECT
CAST(MENU_ID AS BIGINT) AS MENU_ID,
CAST(COST_OF_GOODS_USD AS DECIMAL(38, 4)) AS COST_OF_GOODS_USD,
TO_VARCHAR(MENU_ITEM_HEALTH_METRICS_OBJ) AS MENU_ITEM_HEALTH_METRICS_OBJ
FROM MY_DB.RAW_POS.MENU
)
STORAGE_INTEGRATION = my_gcs_integration
FILE_FORMAT = (
TYPE = PARQUET
COMPRESSION = SNAPPY
)
HEADER = TRUE
OVERWRITE = TRUE
MAX_FILE_SIZE = 104857600;sql
ALTER SESSION SET TIME_OUTPUT_FORMAT = 'HH24:MI:SS.FF6';
ALTER SESSION SET TIMESTAMP_NTZ_OUTPUT_FORMAT = 'YYYY-MM-DD HH24:MI:SS.FF6';
ALTER SESSION SET TIMESTAMP_TZ_OUTPUT_FORMAT = 'YYYY-MM-DD HH24:MI:SS.FF6 TZHTZM';
COPY INTO 'gcs://my-bucket/data_unload/RAW_POS/MENU/'
FROM (
SELECT
CAST(MENU_ID AS BIGINT) AS MENU_ID,
CAST(COST_OF_GOODS_USD AS DECIMAL(38, 4)) AS COST_OF_GOODS_USD,
TO_VARCHAR(MENU_ITEM_HEALTH_METRICS_OBJ) AS MENU_ITEM_HEALTH_METRICS_OBJ
FROM MY_DB.RAW_POS.MENU
)
STORAGE_INTEGRATION = my_gcs_integration
FILE_FORMAT = (
TYPE = PARQUET
COMPRESSION = SNAPPY
)
HEADER = TRUE
OVERWRITE = TRUE
MAX_FILE_SIZE = 104857600;Databricks, Teradata, Oracle, and PostgreSQL Patterns
Databricks、Teradata、Oracle 和 PostgreSQL 模式
Section 4 of the Databricks, Teradata,
Oracle, and PostgreSQL mapping references shows
the complete generated script: Spark SQL for Databricks, and explicit-cast statements
( in Teradata) with and
markers for the others.
INSERT OVERWRITE DIRECTORY ... USING PARQUET SELECT ...SELECT ...LOCKING ROW FOR ACCESS SELECT ...-- Unload Table:-- Required Columns:Databricks、Teradata、Oracle 和 PostgreSQL 映射参考文档的第 4 节展示了完整的生成脚本:Databricks 使用 Spark SQL ,其他数据库使用带显式 cast 的 语句(Teradata 中为 ),并带有 和 标记。
INSERT OVERWRITE DIRECTORY ... USING PARQUET SELECT ...SELECT ...LOCKING ROW FOR ACCESS SELECT ...-- Unload Table:-- Required Columns: