跳转到主要内容
DataStore 提供了 20 多种工厂方法,可从多种数据源创建 DataStore 实例,包括本地文件、数据库、云存储和数据湖。

通用 URI 接口

推荐使用 uri() 方法作为统一入口,它会自动检测源类型:

URI 语法参考


File 数据源

from_file

通过自动检测格式,从本地或远程文件创建 DataStore。
参数: 支持的格式: CSV、TSV、Parquet、JSON、JSONLines、ORC、Avro、Arrow 示例:

兼容 Pandas 的读取函数


云存储

from_s3

从亚马逊 S3 创建 DataStore。
参数: 示例:

from_gcs

基于 Google Cloud Storage 创建 DataStore。
示例:

from_azure

从 Azure Blob 存储创建 DataStore。
示例:

from_hdfs

基于 HDFS 创建 DataStore。
示例:

from_url

从 HTTP/HTTPS URL 创建 DataStore。
示例:

数据库

from_mysql

从 MySQL 数据库创建一个 DataStore。
参数: 示例:

from_postgresql

从 PostgreSQL 数据库创建 DataStore。
示例:

from_clickhouse

从 ClickHouse server 中创建 DataStore。
示例:

from_mongodb

从 MongoDB 创建 DataStore。
示例:

from_sqlite

从 SQLite 数据库中创建 DataStore。
示例:

数据湖

from_iceberg

从 Apache Iceberg 表中创建 DataStore。
示例:

from_delta

从 Delta Lake 表中创建 DataStore。
示例:

from_hudi

从 Apache Hudi 表中创建 DataStore。
示例:

内存源

from_df / from_dataframe

通过 pandas DataFrame 创建 DataStore。
示例:

DataFrame 构造函数

使用类似 pandas 的构造方式创建 DataStore。

特殊数据源

from_numbers

使用连续数字创建 DataStore (适合测试) 。
示例:

from_random

用随机数据创建 DataStore。
示例:

run_sql

从原始 SQL 查询创建 DataStore。
示例:

汇总表

最后修改于 2026年6月10日