⌘+k ctrl+k
1.3 (稳定版)
搜索快捷键 cmd + k | ctrl + k
从 Apache Arrow 导入

CREATE TABLE ASINSERT INTO 可用于从任何查询创建表。然后,我们可以通过在查询中引用 Apache Arrow 对象来创建表或向现有表插入数据。此示例从 Arrow Table 导入,但 DuckDB 可以查询不同的 Apache Arrow 格式,如 SQL on Arrow 指南中所述。

import duckdb
import pyarrow as pa

# connect to an in-memory database
my_arrow = pa.Table.from_pydict({'a': [42]})

# create the table "my_table" from the DataFrame "my_arrow"
duckdb.sql("CREATE TABLE my_table AS SELECT * FROM my_arrow")

# insert into the table "my_table" from the DataFrame "my_arrow"
duckdb.sql("INSERT INTO my_table SELECT * FROM my_arrow")