TE
科技回声
首页24小时热榜最新最佳问答展示工作
GitHubTwitter
首页

科技回声

基于 Next.js 构建的科技新闻平台,提供全球科技新闻和讨论内容。

GitHubTwitter

首页

首页最新最佳问答展示工作

资源链接

HackerNews API原版 HackerNewsNext.js

© 2025 科技回声. 版权所有。

Trustfall: How to Query (Almost) Everything

288 点作者 sbt567超过 2 年前

20 条评论

nathanwallace超过 2 年前
Readers who like SQL may also enjoy Steampipe [1], an open source tool to live query 99+ services with SQL (e.g. AWS, GitHub, CSV, Kubernetes, etc). It uses Postgres Foreign Data Wrappers under the hood and supports joins etc across the services. (Disclaimer - I&#x27;m a lead on the project.)<p>1 - <a href="https:&#x2F;&#x2F;github.com&#x2F;turbot&#x2F;steampipe">https:&#x2F;&#x2F;github.com&#x2F;turbot&#x2F;steampipe</a>
评论 #34721192 未加载
评论 #34721452 未加载
评论 #34724445 未加载
metadat超过 2 年前
This is crazy cool. Instead of searching Google which returns info from literally any random source (occasional good sites among the ocean of SEO spam, malicious sites, ad-ridden clone sites, annoying trolls, paywalled, etc), you could have your own set of diverse query sources you&#x27;ve deemed to be actually useful and trustworthy.<p>I suspect this is only a basic, naive idea compared to the true potential capabilities Trustfall could unlock.
评论 #34719310 未加载
评论 #34717993 未加载
crosen99超过 2 年前
This is a nifty tool. It’s existence alongside the emerging LLMs reminds me of the two diametrically opposed approaches to harnessing it all:<p>1. Store the knowledge in a highly structured way and interrogate it with a precise and rigorous query language to extract the exact answer you want based on a well defined set of rules<p>2. Store the knowledge in whatever ad hoc way it’s produced, and then rely on a higher form of intelligence to take an equally ad hoc query, feed it through the entire universe of knowledge with some attention mechanism, and magically return a (statistically significant) response<p>Both approaches are so satisfying when they work. Of course you also have everything in between and then you have tools like LangChain that start to bring it all together.
评论 #34722448 未加载
vsroy超过 2 年前
I imagine with these types of things the vast majority of the work is writing integrations. Could you explain how this makes writing integrations easier?
评论 #34719849 未加载
obi1kenobi超过 2 年前
Trustfall author here, pleasantly surprised to find this posted!<p>The goal of Trustfall is to be the LLVM of data sources. GraphQL, OpenAPI, JSON (with JSON schema or not), SQL, RDF&#x2F;SPARQL -- and none of them can natively talk to each other. Sure, you can stick JSON into Postgres, or compile GraphQL to SQL -- I&#x27;ve done both in production and it&#x27;s always ultimately a poor fit because you&#x27;re <i>cramming one system into another</i> when it was never originally designed to support that.<p>Here&#x27;s an example: tell me the GitHub or Twitter accounts of HN users that have commented on HN stories about OpenAI. The data is available from the HN APIs on Firebase (for item lookup) and Algolia (for search). I know all of us could write a script to do it -- but would we? Or is it too annoying and difficult, and not worth it? That &quot;activation energy&quot; barrier is something I want to eliminate. Here&#x27;s that same query in the Trustfall Playground, where it took just a minute or two to put together: <a href="https:&#x2F;&#x2F;play.predr.ag&#x2F;hackernews#?f=1&amp;q=IyBDcm9zcyBBUEkgcXVlcnkgKEFsZ29saWEgKyBGaXJlYmFzZSk6CiMgRmluZCBjb21tZW50cyBvbiBzdG9yaWVzIGFib3V0ICJvcGVuYWkuY29tIiB3aGVyZQojIHRoZSBjb21tZW50ZXIncyBiaW8gaGFzIGF0IGxlYXN0IG9uZSBHaXRIdWIgb3IgVHdpdHRlciBsaW5rCnF1ZXJ5IHsKICAjIFRoaXMgaGl0cyB0aGUgQWxnb2xpYSBzZWFyY2ggQVBJIGZvciBIYWNrZXJOZXdzLgogICMgVGhlIHN0b3JpZXMvY29tbWVudHMvdXNlcnMgZGF0YSBpcyBmcm9tIHRoZSBGaXJlYmFzZSBITiBBUEkuCiAgIyBUaGUgdHJhbnNpdGlvbiBpcyBzZWFtbGVzcyAtLSBpdCBpc24ndCB2aXNpYmxlIGZyb20gdGhlIHF1ZXJ5LgogIFNlYXJjaEJ5RGF0ZShxdWVyeTogIm9wZW5haS5jb20iKSB7CiAgICAuLi4gb24gU3RvcnkgewogICAgICAjIEFsbCBkYXRhIGZyb20gaGVyZSBvbndhcmQgaXMgZnJvbSB0aGUgRmlyZWJhc2UgQVBJLgogICAgICBzdG9yeVRpdGxlOiB0aXRsZSBAb3V0cHV0CiAgICAgIHN0b3J5TGluazogdXJsIEBvdXRwdXQKICAgICAgc3Rvcnk6IHN1Ym1pdHRlZFVybCBAb3V0cHV0CiAgICAgICAgICAgICAgICAgICAgICAgICAgQGZpbHRlcihvcDogInJlZ2V4IiwgdmFsdWU6IFsiJHNpdGVQYXR0ZXJuIl0pCgogICAgICBjb21tZW50IHsKICAgICAgICByZXBseSBAcmVjdXJzZShkZXB0aDogNSkgewogICAgICAgICAgY29tbWVudDogdGV4dFBsYWluIEBvdXRwdXQKCiAgICAgICAgICBieVVzZXIgewogICAgICAgICAgICBjb21tZW50ZXI6IGlkIEBvdXRwdXQKICAgICAgICAgICAgY29tbWVudGVyQmlvOiBhYm91dFBsYWluIEBvdXRwdXQKCiAgICAgICAgICAgICMgVGhlIHByb2ZpbGUgbXVzdCBoYXZlIGF0IGxlYXN0IG9uZQogICAgICAgICAgICAjIGxpbmsgdGhhdCBwb2ludHMgdG8gZWl0aGVyIEdpdEh1YiBvciBUd2l0dGVyLgogICAgICAgICAgICBsaW5rCiAgICAgICAgICAgICAgQGZvbGQKICAgICAgICAgICAgICBAdHJhbnNmb3JtKG9wOiAiY291bnQiKQogICAgICAgICAgICAgIEBmaWx0ZXIob3A6ICI%2BPSIsIHZhbHVlOiBbIiRtaW5Qcm9maWxlcyJdKQogICAgICAgICAgICB7CiAgICAgICAgICAgICAgY29tbWVudGVySURzOiB1cmwgQGZpbHRlcihvcDogInJlZ2V4IiwgdmFsdWU6IFsiJHNvY2lhbFBhdHRlcm4iXSkKICAgICAgICAgICAgICAgICAgICAgICAgICAgICAgICBAb3V0cHV0CiAgICAgICAgICAgIH0KICAgICAgICAgIH0KICAgICAgICB9CiAgICAgIH0KICAgIH0KICB9Cn0%3D&amp;v=ewogICJzaXRlUGF0dGVybiI6ICJodHRwW3NdOi8vKFteLl0qXFwuKSpvcGVuYWkuY29tLy4qIiwKICAibWluUHJvZmlsZXMiOiAxLAogICJzb2NpYWxQYXR0ZXJuIjogIihnaXRodWJ8dHdpdHRlcilcXC5jb20vIgp9" rel="nofollow">https:&#x2F;&#x2F;play.predr.ag&#x2F;hackernews#?f=1&amp;q=IyBDcm9zcyBBUEkgcXVl...</a><p>Trustfall is designed for interoperation from day 1. It separates the queries from the data providers, allowing the infrastructure to evolve and change how it serves queries <i>without</i> any of the queries noticing anything except faster execution. In practice, that means you don&#x27;t have to rewrite your product to make it run faster -- which makes both the product side and the infra side happier :)<p>Here&#x27;s a real-world example of that. The `cargo-semver-checks` Rust semantic versioning linter implements its lints as Trustfall queries over JSON files describing the package API, and I recently was able to speed up its execution by over 2000x without changing a single query -- just by changing how those queries execute under the hood. More details in my blog post here: <a href="https:&#x2F;&#x2F;predr.ag&#x2F;blog&#x2F;speeding-up-rust-semver-checking-by-over-2000x&#x2F;" rel="nofollow">https:&#x2F;&#x2F;predr.ag&#x2F;blog&#x2F;speeding-up-rust-semver-checking-by-ov...</a><p>AMA, I guess :)
评论 #34719378 未加载
评论 #34736477 未加载
评论 #34719519 未加载
评论 #34719806 未加载
评论 #34724760 未加载
评论 #34719742 未加载
sbt567超过 2 年前
Online playground for querying Hacker News: <a href="https:&#x2F;&#x2F;play.predr.ag&#x2F;hackernews" rel="nofollow">https:&#x2F;&#x2F;play.predr.ag&#x2F;hackernews</a>
parhamn超过 2 年前
When I saw a demo of this I was blow away by how easy it is to add another data source. Great work, looking forward to using this soon.
评论 #34720630 未加载
wodenokoto超过 2 年前
Clicking through to the python repo and looking at the examples there, I guess the query language is GraphQL.<p>Reading further, it seems that it is actually a variation of GraphQL.<p>I&#x27;ve never used GraphQL before, maybe one can get used to it, but it doesn&#x27;t look very nice for defining data queries.
评论 #34720160 未加载
alexisread超过 2 年前
Nice! I wrote something similar for my workplace a couple of years ago based around Rx (as Rx has many implementations in different languages - we had a multi-node browser&#x2F;server requirement, and optimization in a streaming DSL is easier than SQL, as you&#x27;ve done, as you can hint+order lazy materializations) and libs like <a href="https:&#x2F;&#x2F;pypi.org&#x2F;project&#x2F;lquery&#x2F;" rel="nofollow">https:&#x2F;&#x2F;pypi.org&#x2F;project&#x2F;lquery&#x2F;</a> to do pushdown queries.<p>Are you planning on doing reactive&#x2F;live&#x2F;materialized queries? You could use a config file to specify the live queries (in the Trustfall DSL) which can be fed to the engine on startup.
评论 #34729851 未加载
flanked-evergl超过 2 年前
You may be interested in RDF and SPARQL which supports federated queries. Much simpler than reinventing the wheel.<p>For more context, see <a href="https:&#x2F;&#x2F;ontop-vkg.org&#x2F;guide&#x2F;" rel="nofollow">https:&#x2F;&#x2F;ontop-vkg.org&#x2F;guide&#x2F;</a>
评论 #34721911 未加载
unshavedyak超过 2 年前
Could this be used to manage ingesting data from messier sources? Ala files (pdf&#x2F;etc), web pages, etc?<p><i>edit</i>: Admittedly the website&#x2F;video tends to talk about data sources a bit hand-wavy. I&#x27;d have loved some real world examples on how one goes about adding a data source. Also how we handle problems of scale.. ie passing filters to the data source, rather than drinking from a firehose and filtering after the fact.<p>With that said, the idea is becoming interesting to me. At the very least i am liking the idea of a standardized query interface to &quot;things&quot;. Just feels like edge cases might drown me.
评论 #34720012 未加载
评论 #34719947 未加载
sdfhbdf超过 2 年前
Very interesting, sounds kinda like GraphQL counterpart to <a href="https:&#x2F;&#x2F;github.com&#x2F;cube2222&#x2F;octosql">https:&#x2F;&#x2F;github.com&#x2F;cube2222&#x2F;octosql</a>
评论 #34719202 未加载
debarshri超过 2 年前
At first glance, the goal of the project feels very similar to SPARQL.<p>Somehow it didn&#x27;t make it to the mainstream.
评论 #34718182 未加载
whoopdeepoo超过 2 年前
Already way too many tabs in the example. I could see this getting completely unreadable very quick.
评论 #34718459 未加载
loveparade超过 2 年前
Isn&#x27;t this the same as converting websites into a GraphQL API? Aren&#x27;t there already dozens of projects and services that do the &quot;convert websites into an API&quot;, at scale? What exactly is the innovation?
评论 #34718854 未加载
评论 #34722746 未加载
yevpats超过 2 年前
Also relevant - High Performance Open Source ELT Framework - <a href="https:&#x2F;&#x2F;github.com&#x2F;cloudquery&#x2F;cloudquery">https:&#x2F;&#x2F;github.com&#x2F;cloudquery&#x2F;cloudquery</a>
haolez超过 2 年前
This looks a lot like what Apache Drill already does.
darkteflon超过 2 年前
This looks super cool. Going to put this together with Dagster tonight.<p>@obi1kenobi, could you comment a bit on the motivation and background to this project?
评论 #34720911 未加载
srcreigh超过 2 年前
What join algorithms does this support? How many data sources are integrated so far (what’s the MOM growth?) What’s the largest dataset this integrates with? And how many different people do you estimate have written queries in the language?
评论 #34720754 未加载
dilawar超过 2 年前
obligatory, &quot;written in Rust&quot;.
评论 #34719210 未加载