carto-import-export-data

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

carto-import-export-data

carto-import-export-data

Move data into the warehouse from local files / URLs (
carto import
), pull data out (
carto activity export
for usage data; warehouse-native unloads for everything else), and prepare tilesets for performant map rendering of large geospatial datasets.
将数据从本地文件/URL导入仓库(使用
carto import
),导出数据(使用
carto activity export
导出使用数据;其他数据使用仓库原生导出功能),并为大型地理空间数据集的高性能地图渲染准备瓦片集。

When to use this skill

何时使用此技能

  • The user has a CSV / GeoJSON / Shapefile / GeoParquet file and wants it queryable in the warehouse.
  • The user wants to refresh an existing table from a remote URL.
  • The user wants to render a 10M+-row spatial dataset on a map (needs tileset preparation).
  • The user is bulk-exporting CARTO activity data to disk for offline analysis.
If the user just wants to query a file already in the warehouse, jump to
carto-query-datawarehouse
. If they want to discover what's already there,
carto-explore-datawarehouse
.
  • 用户拥有CSV/GeoJSON/Shapefile/GeoParquet文件,并希望在仓库中可查询该文件。
  • 用户希望从远程URL刷新现有表。
  • 用户希望在地图上渲染1000万行以上的空间数据集(需要准备瓦片集)。
  • 用户正在批量导出CARTO活动数据到磁盘以进行离线分析。
如果用户只是想查询仓库中已有的文件,请跳转至
carto-query-datawarehouse
。如果他们想了解仓库中已有的内容,请查看
carto-explore-datawarehouse

Quick reference

快速参考

bash
undefined
bash
undefined

Import a local file

导入本地文件

carto import --file ./data.csv
--connection carto_dw
--destination project.dataset.table
carto import --file ./data.csv
--connection carto_dw
--destination project.dataset.table

Import from a URL

从URL导入

carto import --url https://example.com/data.geojson
--connection carto_dw
--destination my_project.demo.regions
carto import --url https://example.com/data.geojson
--connection carto_dw
--destination my_project.demo.regions

Async (return immediately, poll separately)

异步模式(立即返回,单独轮询)

carto import --file ./big.parquet
--connection carto_dw
--destination my_project.demo.huge
--async
carto import --file ./big.parquet
--connection carto_dw
--destination my_project.demo.huge
--async

Overwrite existing table

覆盖现有表

carto import --file ./data.csv
--connection carto_dw
--destination my_project.demo.t
--overwrite
undefined
carto import --file ./data.csv
--connection carto_dw
--destination my_project.demo.t
--overwrite
undefined

What's in this skill

此技能包含的内容

TopicReference
carto import
— flags, formats, size limits, async
references/imports.md
Tileset preparation for large mapsreferences/tilesets.md
Exporting data: warehouse-native unloads vs
activity export
references/exports.md
主题参考文档
carto import
— 参数、格式、大小限制、异步模式
references/imports.md
大型地图的瓦片集准备references/tilesets.md
数据导出:仓库原生导出 vs
activity export
references/exports.md

Always-on guidance

通用指南

  • --connection
    is the connection name
    (from
    connections list
    ), not the warehouse project ID. If you only know the project, run
    carto connections list --json
    first to find the matching connection.
  • --destination
    is the fully-qualified target name
    in the warehouse's syntax:
    project.dataset.table
    (BigQuery),
    DATABASE.SCHEMA.TABLE
    (Snowflake),
    schema.table
    (Postgres/Redshift),
    catalog.schema.table
    (Databricks),
    SCHEMA.TABLE
    (Oracle).
  • 1GB hard limit per file. For larger files, split or pre-stage to cloud storage and use
    --url
    to a presigned URL.
  • --no-autoguessing
    skips column type detection
    — use it when you've prepared a precise schema and don't want CARTO to second-guess types (especially for columns that look numeric but should stay string, like ZIP codes).
  • Imports are async at the API level. The CLI defaults to polling-to-completion; pass
    --async
    to return immediately. The CLI prints a job ID in async mode that you can use to check progress.
  • For tilesets, the workflow is import → SQL job to materialize a tileset table → reference the tileset in a map. The tileset itself is created in the warehouse, not by the CLI.
  • --connection
    是连接名称
    (来自
    connections list
    ),而非仓库项目ID。如果仅知道项目名称,请先运行
    carto connections list --json
    查找匹配的连接。
  • --destination
    是仓库语法中的完整目标名称
    project.dataset.table
    (BigQuery)、
    DATABASE.SCHEMA.TABLE
    (Snowflake)、
    schema.table
    (Postgres/Redshift)、
    catalog.schema.table
    (Databricks)、
    SCHEMA.TABLE
    (Oracle)。
  • 单个文件大小上限为1GB。对于更大的文件,请拆分或预先存储到云存储,并使用指向预签名URL的
    --url
    参数。
  • --no-autoguessing
    会跳过列类型检测
    — 当你已准备好精确的 schema,且不希望CARTO自动推断类型时使用(尤其是对于看似数值但应保持字符串类型的列,如邮政编码)。
  • API层面的导入是异步的。CLI默认会轮询直到完成;传递
    --async
    参数可立即返回。异步模式下CLI会打印作业ID,你可以用它检查进度。
  • 对于瓦片集,工作流程是导入 → 通过SQL作业物化瓦片集表 → 在地图中引用瓦片集。瓦片集本身是在仓库中创建的,而非通过CLI创建。