MiniLake 是一个支持 SQL、Delta Lake 和 Spark 的本地 Databricks API 模拟器
MiniLake Is a Local Databricks API Emulator with SQL, Delta Lake and Spark

原始链接: https://dmux.github.io/minilake/

MiniLake 是一个本地 Databricks 模拟器(localhost:8000),暴露真实的 Databricks API 用于开发和测试。它支持 Unity Catalog 操作(目录、架构、表)、SQL 仓库创建,以及返回真实行的语句执行。Delta 表由真实的 Spark 通过 Unity Catalog 连接器写入带有 `_delta_log` 元数据的实际 Parquet 文件,因此可通过 Spark 和 MiniLake 的 SQL API 查询。Terraform Databricks provider 可在它上运行,创建真实的目录和基于 DuckDB 的资源,而未实现的 API 会以 HTTP 501 明确失败。Databricks Asset Bundles 也支持部署/运行工作流。健康和重置端点允许检查服务状态,并在不重启的情况下为测试提供干净的工作区。

Hacker News 抱歉,我们无法如此快速地处理您的请求。 重新加载
相关文章

原文
from databricks.sdk import WorkspaceClient
from databricks.sdk.service.catalog import ColumnInfo, TableType

# The only line that differs from production
w = WorkspaceClient(host="http://localhost:8000", token="dev")

w.catalogs.create(name="sales")
w.schemas.create(name="store", catalog_name="sales")
w.tables.create(
    name="orders", catalog_name="sales", schema_name="store",
    table_type=TableType.MANAGED,
    data_source_format="DELTA", storage_location="/data/sales/store/orders",
    columns=[
        ColumnInfo(name="id", type_text="BIGINT"),
        ColumnInfo(name="customer", type_text="STRING"),
        ColumnInfo(name="amount", type_text="DECIMAL(10,2)"),
    ],
)

wh = w.warehouses.create(name="dev", cluster_size="Small")
w.statement_execution.execute_statement(
    warehouse_id=wh.id,
    statement="INSERT INTO sales.store.orders VALUES (1, 'Ana', 459.90)",
)

result = w.statement_execution.execute_statement(
    warehouse_id=wh.id,
    statement="SELECT customer, amount FROM sales.store.orders",
)
print(result.result.data_array)   # [['Ana', '459.90']] — really stored
联系我们 contact @ memedata.com