hyper-db 试用
hyper-db 是tableau查询引擎的核心,tableau 官方也提供了比较完整的文档,可以方便学习使用,同时官方也提供了python,c++,java 的api
以下是一个简单试用,体验下hyper 的功能
参考代码
为了方便基于了python 运行,里边已经直接包含了hyper,使用起来比较方便
- 安装
pip install tableauhyperapi
- 参考代码
from tableauhyperapi import HyperProcess, Telemetry, Connection,CreateMode
with HyperProcess(telemetry=Telemetry.DO_NOT_SEND_USAGE_DATA_TO_TABLEAU) as hyper:
with Connection(endpoint=hyper.endpoint,database='app.hyper',create_mode=CreateMode.CREATE_AND_REPLACE) as connection:
connection.execute_command("""
CREATE TEMPORARY TABLE animals(name, legs) AS VALUES
('dog', 4),
('cat', 4),
('bird', 2),
('kangaroo', 2),
('centipede', 100)
""")
with connection.execute_query("SELECT name FROM animals") as results:
for row in results:
print(row)
bipeds = connection.execute_list_query(
"SELECT name FROM animals WHERE legs = 2")
print(bipeds)
max_legs = connection.execute_scalar_query(
"SELECT MAX(legs) FROM animals")
print("max legs: ", max_legs)
# 读取一个parquet 文件,对于parquet 文件,包含了schema 不需要指定,csv 的需要指定
sensors = connection.execute_list_query("SELECT * FROM external('demo.parquet')")
print(sensors)
说明
hyper 支持的功能还是不少的,是tableau 的核心引擎,类似的duckdb 也是一个很不错的olap 嵌入式引擎,社区也有一些比较,包括来自duckdb 的
参考资料
https://tableau.github.io/hyper-db/docs
https://tableau.github.io/hyper-db/docs/sql/external/syntax
https://github.com/tableau/hyper-api-samples
https://tableau.github.io/hyper-db/docs/sql/command/create_external_table
https://duckdb.org/2021/08/27/external-sorting.html
https://www.architecture-performance.fr/ap_blog/tpc-h-benchmark-of-hyper-duckdb-and-datafusion-on-parquet-files/
https://tableau.github.io/hyper-db/lang_docs/py/tableauhyperapi.html
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 全程不用写代码,我用AI程序员写了一个飞机大战
· DeepSeek 开源周回顾「GitHub 热点速览」
· 记一次.NET内存居高不下排查解决与启示
· MongoDB 8.0这个新功能碉堡了,比商业数据库还牛
· .NET10 - 预览版1新功能体验(一)
2023-03-17 PebbleTemplates 模版解析处理简单说明
2023-03-17 PebbleTemplates 默认一些安全处理
2023-03-17 PebbleTemplates 一种集成玩法
2020-03-17 mocha ReferenceError: describe is not defined 问题解决
2020-03-17 zombie 快速&&无头基于nodejs 的浏览器测试框架
2020-03-17 Backstage构建开发人员门户的开放平台
2015-03-17 用NativeScript创建JavaScript原生移动应用