11 comments

  • slowcache28 minutes ago
    I think an important benefit of a good ORM is to reduce the translations that you have to do between your mental model of the data and what you are trying to do with the data.<p>Before I started working a lot with SQL, ORMs fit my mental model better since I was more used to imperative programming languages and I thought they were easier to work with.<p>Now that I am very comfortable with SQL, I have to translate an ORM into the SQL that it would produce. So now they just add another step in between me and the data
    • remywang21 minutes ago
      The point of Prela is exactly to remove that step of indirection, it gives you ORM ergonomics but compiles directly to operations on the physical columns, skipping SQL. At least for me I find it easier to think in Prela than to think in SQL, especially for complex queries, and I believe you’ll feel the same with some practice.
  • andai11 minutes ago
    Very interesting. I&#x27;m not very fluent in SQL, so it would have been helpful to see some more side by side examples. (Since Prela seems a lot more ergonomic!)<p>Though maybe a reader fluent in SQL can compare them mentally on the fly?
  • andai21 minutes ago
    At the bottom is the actual code for the &quot;language&quot;, which is only 79 lines.<p>I found it helpful to read it first and then go back to the article. (On my initial reading I was like, &quot;okay, but what is a Rel?&quot;)<p><a href="https:&#x2F;&#x2F;github.com&#x2F;remysucre&#x2F;prela&#x2F;blob&#x2F;main&#x2F;tutorial&#x2F;prela.py" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;remysucre&#x2F;prela&#x2F;blob&#x2F;main&#x2F;tutorial&#x2F;prela....</a>
  • bvrmn19 minutes ago
    Examples don&#x27;t show much more composability comparing to SQL. Even more Prela is heavily based on tuples and has same operation semantics as SQL.<p>Shameless plug: <a href="https:&#x2F;&#x2F;github.com&#x2F;baverman&#x2F;sqlbind-t" rel="nofollow">https:&#x2F;&#x2F;github.com&#x2F;baverman&#x2F;sqlbind-t</a>
    • remywang1 minute ago
      Compositionality is hard to show with a small example because it really only comes through at scale.<p>If anyone can point me to a huge SQL query, I’ll take it up as a challenge to rewrite in Prela!<p>Prela’s semantics is based on an algebra of binary relations (unfortunately called <i>relation</i> algebra [1]), not the standard <i>relational</i> algebra.<p>[1]: <a href="https:&#x2F;&#x2F;arxiv.org&#x2F;abs&#x2F;2607.26356" rel="nofollow">https:&#x2F;&#x2F;arxiv.org&#x2F;abs&#x2F;2607.26356</a>
  • mwcremer41 minutes ago
    Looks a lot like 6NF (<a href="https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Sixth_normal_form" rel="nofollow">https:&#x2F;&#x2F;en.wikipedia.org&#x2F;wiki&#x2F;Sixth_normal_form</a>)
    • frizlab22 minutes ago
      See first footnote
  • kscarlet1 hour ago
    Cool language! I thought dplyr and datalog are both local optima (forget about the three-letter abomination) but I now declare this language the global optimum of query language.<p>&gt; In contrast, Prela can be implemented extremely close to the metal. The Rust implementation inlines operators and compiles them into tight fused loops over raw arrays, running several times faster than DuckDB even without a query optimizer.<p>This will be true in Common Lisp as well. Now someone just have to implement it.<p>Or maybe I should steal the syntax and compile to SQL first, just so people can use existing DBMS.
    • kscarlet53 minutes ago
      On second thought, some skepticism on performance comparison:<p>1. do both systems access everything from memory?<p>2. do both systems have the same kind of indices?<p>3. do either system tradeoff scan performance for faster&#x2F;acceptably fast updates?
      • remywang17 minutes ago
        1. Yes<p>2. No. Prela’s speedup is large due to indexing. We tried to port the same indexing tricks back to duckdb but it wouldn’t let us. See the paper [1] for details<p>3. Prela focuses on analytical queries at least for now<p>[1]: <a href="https:&#x2F;&#x2F;arxiv.org&#x2F;abs&#x2F;2607.26356" rel="nofollow">https:&#x2F;&#x2F;arxiv.org&#x2F;abs&#x2F;2607.26356</a>
        • kscarlet5 minutes ago
          Thanks! Kudos for the great work!
  • prathje1 hour ago
    Interesting concept which reminds of the operations available in pandas.<p>I disagree though with the statement of SQL needing 20 lines. The given query feels verbose and has lots of redundant conditions. Not saying that it is short but a better analogy could look like this:<p>SELECT DISTINCT an.name, t.title<p>FROM keyword k<p>JOIN movie_keyword mk ON mk.keyword_id = k.id<p>JOIN title t ON t.id = mk.movie_id<p>JOIN movie_companies mc ON mc.movie_id = t.id<p>JOIN company_name cn ON cn.id = mc.company_id<p>JOIN cast_info ci ON ci.movie_id = t.id<p>JOIN aka_name an ON an.person_id = ci.person_id<p>WHERE k.keyword = &#x27;character-name-in-title&#x27; AND cn.country_code = &#x27;[us]&#x27;;
  • bradleyy45 minutes ago
    I&#x27;m afraid I&#x27;m in the &quot;uses column store&quot; and not &quot;understands the actual storage mechanisms&quot;, but this feels like something that&#x27;s essentially the same thing?<p>Yes, I could ask my local AI, I&#x27;m just curious if anyone here&#x27;s wondering the same thing.
  • trueno41 minutes ago
    am i the only one who&#x27;s not afraid of sql taking up lines? sql thats formatted well is beautiful to read my brain enjoys it. it&#x27;s way easier to read sql in terms of &quot;what resultset is this trying to build&quot; then it is to pick apart some fluent api lookin orm on top of sql
    • somat11 minutes ago
      I am in that club. As someone who quite enjoys writing sql but does not like the big sql strings intermingled in the rest of the code I even wrote a clever little python library that loads the queries from files as a function call, that is, you have a file with a pure sql query with parameterized variables and you call it like &quot;for row in sql.video_search(title_like=&#x27;bridge&#x27;, date_after=&#x27;1964-1-1&#x27;, date_before=&#x27;1975-1-1&#x27;)&quot; Nowhere near an orm, everything just produces a result set.<p>I am sure there are many projects like it, I suspect it is like static site generators and notekeeping apps, easy enough that everybody just makes their own. But this one is mine, and I have grown quite fond of it and use it in all my scripts. It is a little more magic than I am normally comfortable with. dynamic function generation is a bit of a black art, but having each query as it&#x27;s own callable unit is super handy.
    • mamcx23 minutes ago
      I also work on this are (<a href="https:&#x2F;&#x2F;tablam.org" rel="nofollow">https:&#x2F;&#x2F;tablam.org</a>) and have used languages where this weird, poorly developed language SQL was not the main interface (FoxPro).<p>Think on this: You imagine yourself writing a regular website with ONLy sql? no, because SQL is <i>not</i> a &quot;programming language&quot; for developers.<p>Is possible you could think in various ideas about why is &quot;nonsensical&quot; to make an app with a relational language (that SQL clearly is not) but is the same as with OOP or functional: there is not reason to be a problem, and there is a lot of things that will be far easier if a proper relational language is used, like for example, is unnecessary and ORM and&#x2F;or is not complicated and confusing to make one.
    • slowcache38 minutes ago
      I&#x27;m in this boat, especially if you&#x27;re language supports multi-line strings
  • kurtis_reed15 minutes ago
    People don&#x27;t use SQL because it&#x27;s a good language
  • tabith22 minutes ago
    this is utterly fascinating.<p>thinking of LLM usage... it&#x27;s so close to how LLMs think anyway, vector similarity also being a binary relation. LLM stops blindly guessing SQL and instead starts navigating data straight away.