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

科技回声

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

GitHubTwitter

首页

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

资源链接

HackerNews API原版 HackerNewsNext.js

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

Show HN: PRQL in PostgreSQL

267 点作者 kaspermarstal大约 1 年前
This extension let&#x27;s you write PRQL functions in PostgreSQL.<p>When I first saw PRQL on Hacker News a few months ago, I was immediately captivated by the idea, yet equally disappointed that there was no integration for PostgreSQL. Having previous experience with writing PostgreSQL extensions in C, I thought this was a great opportunity to try out the pgrx framework and decided to integrate PRQL with PostgreSQL myself.<p>The maintainers of both PRQL and pgrx were very nice to work with. Thanks guys.

17 条评论

fforflo大约 1 年前
Nice work. A few months back, I experimented with having a DSL like PRQL in Postgres, but back then, I found the language a bit cumbersome; however, it was great as an idea. IMHO, the best &quot;data transformation&quot; language is jq and awk is second.<p>PRQL and EdgeQL (EdgeDB) are the most interesting ones to watch how they evolve, though.<p>I&#x27;ve also written a PG extension to make jq available in Postgres [0]<p>I believe Postgres, in general, will flourish as a host for DSL languages [1].<p>0: <a href="https:&#x2F;&#x2F;github.com&#x2F;Florents-Tselai&#x2F;pgJQ">https:&#x2F;&#x2F;github.com&#x2F;Florents-Tselai&#x2F;pgJQ</a> 1: <a href="https:&#x2F;&#x2F;tselai.com&#x2F;pgjq-dsl-database.html" rel="nofollow">https:&#x2F;&#x2F;tselai.com&#x2F;pgjq-dsl-database.html</a>
评论 #39431201 未加载
dvdkon大约 1 年前
Damn, now my bachelor&#x27;s thesis will be less unique :)<p>I&#x27;m working on a new language that compiles directly to Postgres&#x27; post-analysis structs. It&#x27;s working out pretty well so far, but my chosen &quot;universal set&quot; (aggregation&#x2F;array&#x2F;subquery&#x2F;... as one thing) semantics are sometimes a pain to encode.
评论 #39430554 未加载
评论 #39431354 未加载
评论 #39449023 未加载
andy_ppp大约 1 年前
Very interesting, it looks a lot like the Elixir package Ecto that has a DSL for writing SQL queries. Obviously there are some differences here and I wonder if the compiler can do further optimisations than Ecto can but interesting to see they align quite a bit.
dang大约 1 年前
Related:<p><i>PRQL as a DuckDB Extension</i> - <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=39130736">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=39130736</a> - Jan 2024 (47 comments)<p><i>PRQL: Pipelined Relational Query Language</i> - <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=36866861">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=36866861</a> - July 2023 (209 comments)<p><i>Calculate the Digits of Pi with DuckDB and PRQL</i> - <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=35153824">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=35153824</a> - March 2023 (1 comment)<p><i>One Year of PRQL - a modern language for relational data</i> - <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=34690560">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=34690560</a> - Feb 2023 (1 comment)<p><i>PRQL: a simple, powerful, pipelined SQL replacement</i> - <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=34181319">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=34181319</a> - Dec 2022 (215 comments)<p><i>Show HN: PRQL 0.2 – a better SQL</i> - <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=31897430">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=31897430</a> - June 2022 (159 comments)<p><i>PRQL – A proposal for a better SQL</i> - <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=30060784">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=30060784</a> - Jan 2022 (292 comments)
landingunless大约 1 年前
Nice to see extensions like this one developed in Rust&#x2F;pgrx. Reminds me of <a href="https:&#x2F;&#x2F;github.com&#x2F;tcdi&#x2F;plrust">https:&#x2F;&#x2F;github.com&#x2F;tcdi&#x2F;plrust</a>
评论 #39434195 未加载
qazxcvbnm大约 1 年前
Off-topic: does anyone know of SQL-to-SQL optimisers or simplifiers? I understand that databases themselves have query-optimisers, and that&#x27;s not what I&#x27;m talking about - I work with generated query systems and SQL macro systems that make fairly complex queries quite easy to generate, but often times come up with unnecessary joins&#x2F;subqueries etc.<p>PostgreSQL&#x27;s query-optimiser does handle these cases quite well for me once I explain and add the appropriate indexes, yet complex source queries carry undiscountable costs (longer planning times, missed optimisations e.g. predicate pushdowns).<p>I find myself needing to mechanically transform and simplify SQL every now and then, and it hardly seems something out of reach of automation, yet somehow I&#x27;ve never been able to find software that simplifies and transforms SQL source-to-source. When I look, I only find optimisers for SQL execution plans. It&#x27;s a bit hard to believe that such a thing doesn&#x27;t exist, given how significant the SQL ecosystem is.
grepknfss大约 1 年前
You should make the first instance of “PQRL” in your readme a link to that project.
评论 #39431252 未加载
brikym大约 1 年前
It looks a lot like Microsoft’s Kusto query language which is a pleasure to use. Piping is better than nesting and from-first is the way to go as it’s necessary for autocomplete.
billfruit大约 1 年前
Just out of curiosity, did PRQL evolve from some theoretical innovation or did arise bottom up from practical utilities?<p>Is it a new tool with great new powers or is it just syntactic sugar?
评论 #39430196 未加载
评论 #39434973 未加载
philipodonnell大约 1 年前
I often wonder if NL-SQL tasks would benefit from an intermediate query language that is more compatible with the next-logical token approach that is used to generate the code. Obviously there is less of this in the training set, but if it transpires in a testable way, you could generate training data yourself from known good sql queries? Are there any languages that have been designed specifically for this?
mikpanko大约 1 年前
There are very interesting improvements to SQL, which are much more ergonomic, extend functionality, and provide higher-level abstractions. Also backward compatible. PRQL and Malloy immediately come to mind but there are more. Anybody has good explanations why they struggle to get wide adoption?
评论 #39432938 未加载
fkyoureadthedoc大约 1 年前
PRQL looks interesting enough to at least give it an honest try.<p>&gt; PRQL allows for powerful autocomplete, type-checking, and helpful error messages (in progress)<p>Without some kind of autocomplete though I&#x27;m a lot less motivated to do so.
dataspun大约 1 年前
Why is this PRQL extension for Postgres limited to Mac and Linux? What dependencies on Windows are the obstacles, and is there an expected solution in the near-term?
评论 #39434690 未加载
mt_大约 1 年前
Is PRQL faster than the standard query model?
评论 #39435455 未加载
smabie大约 1 年前
Can this be used inside Grafana?
zoky大约 1 年前
Can someone explain to me why “Show HN” and “Ask HN” posts are always, <i>always</i> in hard-to-read light gray? Is there some cabal that automatically downvotes such posts? Is there something intrinsic to <i>The Algorithm</i> that penalizes such posts? Or do I just have really bad luck and always manage to click through on posts that have gained traction despite having gotten enough downvotes to put them at risk of sudden termination?<p>This is one of the great HN mysteries to me, and if anyone can shed some light on it, it would be much appreciated.
评论 #39429629 未加载
评论 #39429692 未加载
评论 #39429633 未加载
lkuty大约 1 年前
I don&#x27;t understand the need for libraries that abstract away SQL when you could just write SQL directly and have full access to the power of the language which is quite rich (recursive CTE, windowing, ... aka Modern SQL). You could also use stored procedures&#x2F;functions for more complex stuff and e.g. JSON (or native types) to transfer data between the database and the application. Why limit ourselves with a sub-optimal language be it PRQL, Ecto, other ORMs, ... ?
评论 #39429175 未加载
评论 #39429361 未加载
评论 #39429119 未加载
评论 #39429497 未加载
评论 #39429115 未加载
评论 #39430895 未加载
评论 #39429118 未加载
评论 #39429306 未加载
评论 #39430066 未加载