Hacker News 熱門精选72

Show HN:Strata——一个能够对 LLM 说“不”的高表现力语义层

Show HN: Strata – an expressive semantic layer that can say no to your LLM

· 13天前
跳到正文

精选理由

帮助团队用可约束的语义层让LLM生成更可靠的分析,并支持多引擎路由与自助查询。

AI 摘要

大家好,我是 Ajo,Strata 由我打造。 我在 Netflix 工作了 4 年,为非技术业务用户解决自助服务问题。我认为,凭借自己独特的语义层设计方法,我已经找到了答案。对我们的非技术同事来说,关键挑战是在表现力与易用性之间取得平衡。事实证明,这种专注也让它与 LLM 配合得相当不错。 Strata 是一个全栈解决方案,包含语义层、仪表板、订阅和 google sheets 导出功能。所有这些都可以通过 agent 对话或 MCP 完成。 一些核心概念和功能: 名称是严格限定的。一个项目中只能存在一个名为 Revenue 的对象。如果 revenue 映射到多个表,查询粒度和速度将决定使用哪个表。 严格的命名规范有助于实现跨事实域的自动数据混合。 具备分区和聚合感知能力的语义路由。这使你能够将部分数据加载到 Druid 或 ClickHose 等速度更快的计算引擎中,同时将完整历史数据保存在 trino 或其他成本更低的系统中。如果查询可以在那里完成,查询引擎就会选择更快的层级。 复杂度量:开箱即用地支持 snapshot、LOD(include/exclude)、Compound 和 Auto leveling compound 度量。 在语义层之上,用户可以创建跨越多个事实域的自定义计算。 另一个有趣的功能是能够创建群组,并将其作为过滤器应用于整个查询,或应用于查询中的单个度量。 我们有意不构建一个供你的 BI 工具连接的语义层。我认为那是一条死路。对于你想在其上构建的任何定制功能,我们提供 APIs 和 MCP。 在 docker 上免费试用: https://strata.do/try/ 帮助你入门的文档: https://strata.do/docs/ 这是一个早期 beta 版本,并非开源。不过,免费层最多支持 25 位用户。你应该可以通过 docker 完全在自己的机器上运行它。 非常期待听到你的反馈,尤其是正在使用 Looker 和 Cube 的朋友。 感谢阅读! 评论链接: https://news.ycombinator.com/item?id=49909913 得分:4 评论数:0

正文

Free trial

Run Strata on your own machine

15 minutes from setup to insights. Free plan, no credit card, everything runs locally.

You need Docker, Ruby 3.4.4 or newer, Git, and read access to a warehouse. A coding agent such as Claude Code or Codex does the modeling for you.

Start the server

Strata Server runs in Docker with its own bundled database, so there is nothing to configure. Need Docker? Get Docker Desktop.

Installer (recommended) Plain docker run

Run this in a terminal and press Enter to accept the default port:

curl -fsSL https://strata.do/server/install.sh | bash
Copy

It checks Docker, pulls the image, starts the container, and waits until it is healthy. Then open http://localhost:8080 and create your admin account. Your free trial activates on its own, and a TPC-DS retail sample model is already loaded, so you can explore before connecting anything.

One container, one command:

docker run -d -p 8080:80 -v strata_data:/data --name strata ghcr.io/stratasite/server:latest
Copy

Give it 30 to 60 seconds on first boot, then open http://localhost:8080 and create your admin account. Your free trial activates on its own, and a TPC-DS retail sample model is already loaded.

Install the CLI

The CLI is where projects, warehouse connections, and deploys happen. One command installs it and verifies it works:

curl -fsSL https://strata.do/cli/install.sh | bash
Copy

Prefer not to pipe into bash? gem install strata-cli does the same thing on any OS.

Confirm it is on your path:

strata version
Copy

Create a project

A project is a folder of YAML under git. It ships with an AGENTS.md that tells your coding agent exactly how Strata models work.

strata init my-analytics
cd my-analytics
Copy

Add your warehouse

The only part that depends on your network and your credentials. A read only user is ideal. Have these ready:

Warehouse What the CLI will ask for
Snowflake Account identifier (like myorg-myaccount), database, warehouse, role, and a personal access token. PAT is the simplest auth mode. Key pair and OAuth are also supported.
Databricks Workspace host, the SQL warehouse HTTP path, catalog and schema, and a personal access token.
PostgreSQL, Redshift, MySQL, SQL Server Host, port, database, schema, username, password. Turn on SSL if your server requires it.
ClickHouse, Athena, Trino, Druid Endpoint or region plus credentials.
DuckDB, SQLite A path to the database file. Full field list per adapter.

Pick your adapter. The CLI asks for a key (use warehouse, the prompts below assume it), a display name, the connection details, and the credentials. Credentials go into .strata, which is gitignored and never leaves your machine except inside a deploy to your own server.

strata datasource add snowflake
# or: clickhouse, databricks, postgres, redshift, mysql, sqlserver, athena, trino, druid, duckdb, sqlite
Copy

Then test it. Do not skip this. It reports exactly what is wrong when something is.

strata datasource test warehouse
Copy

Once it passes, confirm you can see the tables you expect:

strata datasource tables warehouse
Copy

Build the model with your agent

Open Claude Code, Codex, or Cursor from the project root, the folder holding project.yml and AGENTS.md. The agent reads that file automatically. It is the whole contract: Strata's YAML schema, naming rules, join constraints, and the read only discovery commands to use instead of guessing at your schema. No custom prompt needed.

With a coding agent By hand with the CLI

Ask for the model:

Build the semantic model for the tables in my warehouse datasource.
Follow AGENTS.md. Show me your proposal before writing any files.
Copy

The agent inspects your tables, proposes fact and dimension tables, fields, and joins, and waits for your approval before writing anything. Read the proposal. The things worth a second look:

  • Which tables it treats as facts and which as dimensions.
  • Shared dimension names are intentional. In Strata, the same name on two tables means the same concept and makes them blendable. Measure names must stay distinct per fact.
  • One join per table pair. A second key to the same dimension needs a role playing table.
  • Names, because they are what your users will see and query.

Say yes and it writes models/**/*.yml, running strata audit after every change. For a few dozen tables this is a few minutes.

The CLI walks you through one table at a time: it lists tables in your datasource, pulls the column metadata, and prompts you to name each field and mark it a dimension or a measure.

strata create table sales/orders
strata create table common/customers
Copy

Then define how they join:

strata create relation sales/orders_customers
Copy

Both paths write the same YAML, so mix them freely: let the agent draft the whole schema, then refine a table or two here.

Already on dbt MetricFlow, Cube, or LookML? Point the same agent at those files. Both sides are YAML, so it transpiles your existing definitions into a Strata model in minutes.

Full guide: Building your model.

Deploy and explore

Validate the whole model, then push it to your server:

strata audit all
strata deploy
Copy

The first deploy asks for your server URL (http://localhost:8080) and offers to sign you in through the browser. It saves an API key for you, so there is no key to copy around.

Refresh http://localhost:8080 and your model is live. Some good first moves:

  • Type a question in plain language and let Strata resolve it to the right fields.
  • Drag a measure from one fact next to a dimension from another and watch it blend, or refuse with a reason.
  • Build a report from a few views and let the layout engine arrange it.
  • Add a segment to one measure and see a cohort beside the baseline in a single view.

Every change to the model is the same loop: edit YAML (or ask the agent), strata audit all, strata deploy.

If something goes wrong

localhost:8080 does not load

First boot sets up the bundled database and can take 30 to 60 seconds. Watch it with docker logs -f strata and refresh once you see "Databases ready".

The installer says Docker is not running, or permission denied

Docker is installed but the installer cannot talk to it. On macOS or Windows, start Docker Desktop and wait for it to say it is running. On Linux, start it with sudo systemctl start docker. If you see permission denied, run the installer with sudo: curl -fsSL https://strata.do/server/install.sh | sudo bash. Use sudo for the docker commands afterwards too.

The container exits immediately

Check the logs. The usual cause is port 8080 already in use. Remove the container with docker rm -f strata, then re-run the installer and enter a different port, or with plain docker change the left side of -p, for example -p 9090:80.

How do I stop, upgrade, or remove the server?

It is one container named strata. docker stop strata and docker start strata pause and resume it, re-running the installer upgrades it in place, and docker rm -f strata removes it. Your data lives in the strata_data volume and survives all of that until you run docker volume rm strata_data. To remove the CLI as well: gem uninstall strata-cli, then delete the project folder, which is where its .strata credentials file lives.

strata: command not found

Open a new terminal so your PATH picks up the gem. If it persists, run gem environment and make sure the gem bin directory is on your PATH.

datasource test fails

The CLI connects from your laptop, so your laptop needs a route to the warehouse first: VPN on, IP allowlisted, firewall open. Then check host, port, database, schema, and credentials, and re-enter credentials with strata datasource auth warehouse. Your server in Docker uses the same route when it runs queries.

My database is on the same laptop

Inside Docker, localhost is the container itself. Use host.docker.internal as the host so the server can reach a local PostgreSQL, or mount a DuckDB or SQLite file into the container.

Adapter gem missing

Run strata datasource check. It lists the adapter gems you have and the ones you need, for example gem install pg for PostgreSQL.

The CLI asked whether to enable AI features

You can say no. That prompt covers AI assisted table generation inside the CLI. Your coding agent does the modeling from AGENTS.md instead.

The agent invented YAML keys or asked for credentials

Start the agent from the project root so it reads AGENTS.md, and point it at the file explicitly. It never needs credentials. Those live in .strata, which is gitignored. Agents only write model YAML: deploys and datasources stay with you.

The CLI installer says Ruby or Git is missing

The CLI is a Ruby gem and needs Ruby 3.4.4 or newer plus Git. Install them, open a new terminal, and run the CLI installer again.

macOS Linux Windows
brew install ruby git
Copy

Homebrew installs a current Ruby next to the system one. rbenv or asdf work too.

# Debian / Ubuntu
sudo apt update && sudo apt install ruby-full git

# Fedora / RHEL
sudo dnf install ruby git
Copy

If your distribution ships an older Ruby, use rbenv or asdf to get 3.4.4 or newer.

Install Ruby 3.4.x with RubyInstaller (include the MSYS2 toolchain when prompted) and Git with Git for Windows. Then, in a new terminal, this replaces the shell installer:

gem install strata-cli
Copy

Still stuck? Email [email protected] with the output of the failing command, or book a setup call and we will do it with you.

What next

Rather do this together?

Book 30 minutes and we will connect your warehouse, model it, and answer your hardest cross domain question live.

The free plan includes one developer, 25 users, and two data sources per project.

查看原文(Hacker News 熱門)