PugSQL

Languages and libraries

database query library

SHOW HN2019

155points
53comments
#262of 2,195 in 2019
Top 12%of 2019 by points

How HN took it

DebatedReal support and real criticism

10 positive, 3 neutral or asking, 0 mixed, 7 critical, out of 20 comments about the project. Thread score +0.18.

Idea: 8 for, 4 againstDesign: 0 for, 2 against

The thread, comment by comment

Each row is a top-level comment and its replies, in HN's order. Select a cell to open that comment on HN.

positive neutral or mixed critical about another commenter or something else the maker

What HN said

What people liked

  • Keeping SQL in separate files aids linting, syntax highlighting and consistent query management.

    From 2 comments
    • I haven't used PugSQL yet, but I like the principle because it allows to keep SQL and Python code in separate files, which makes it easier to use linters or even just proper…
      phaer on HN
    • One clear advantage of the yesql/hugsql style is that you get to manage your SQL files in a consistent way. You're going to have migration files and stored procedure/view/etc…
      fulafel on HN
  • Clean, simple approach that bridges raw SQL and query builders.

    From 3 comments
    • I really like the idea of this! Potentially quite helpful for the GraphQL space, I think, since these query files could map 1:1 with resolvers (if I understand GraphQL…
      avolcano on HN
    • i really really want to work on porting HugSQL to Elixir. debating starting on that for my next side project. i remember when learning clojure, HugSQL was one my of favorite…
      holtalanm on HN
    • I started the same project with the same name a few months ago, I’m happy to see someone went farther than I did. Congrats on this project, I’m testing later. HugSQL achieves the…
      loop0 on HN

Objections

  • Built on SQLAlchemy, so it seems an unnecessary wrapper over SQLAlchemy Core.

    From 3 comments
    • Interesting. But what a potential use case for this? I mean what makes it stand out when put side by side with SQLAlchemy? Does it do anything differently? From what I've been…
      born2discover on HN
    • A simple Python interface ... built atop the most powerful and widely used Python ORM. This is the library equivalent of virtualization! This is crazy, right? Let's take…
      coleifer on HN
    • SQLAlchemy-core is not an ORM either, the ORM is based on it. You can already write raw sql with it in a separate file if needed, and make a function out of it. I can't see a…
      sametmax on HN
  • No easy way to compose or reuse query fragments for optional filters.

    From 2 comments
    • Imagine a query - `select * from users`. Now, in my webapp, the user can pass a username, in which case I want to do `select * from users where username=<some string>`. In naive…
      pbecotte on HN
    • It's either two queries or something like this: select * from users where username = :username or :username is null That can be considered slightly better than two queries or…
      balfirevic on HN
  • Name clashes with the Pug template engine on npm.

    From 1 comment
    • Watch your naming - pug is also a template engine for npm.
      robodale on HN

Requests

  • Ports of HugSQL to other languages such as Elixir.

    From 1 comment
    • i really really want to work on porting HugSQL to Elixir. debating starting on that for my next side project. i remember when learning clojure, HugSQL was one my of favorite…
      holtalanm on HN
  • Async database support.

    From 1 comment
    • Perhaps slightly unrelated: I'm considering moving to asyncpg and using quart, which is a port of flask to async python. What I wonder if it's time to start using async python,…
      benatkin on HN

Questions

  • What does it offer beyond SQLAlchemy?

    From 1 comment
    • Interesting. But what a potential use case for this? I mean what makes it stand out when put side by side with SQLAlchemy? Does it do anything differently? From what I've been…
      born2discover on HN
  • Can query types be generated or validated statically?

    From 2 comments
    • I really like the idea of this! Potentially quite helpful for the GraphQL space, I think, since these query files could map 1:1 with resolvers (if I understand GraphQL…
      avolcano on HN
    • > I've been writing runtime validations for each individual query result. This has been a bit annoying to maintain at scale since I don't have very good patterns for it. I think…
      Rotareti on HN

Alternatives named

  • SQLAlchemy Core

    From 2 comments
    • Looks like sqlalchemy is just used for the "being able to handle multiple databases" part, not for its higher level abstractions.
      Scarbutt on HN
    • You may of course already be aware of this but it's worth pointing out. To many, SQLAlchemy is an ORM, but the SA developers very purposefully made the ORM layer completely…
      michelpp on HN
  • Pydantic

    From 1 comment
    • > I've been writing runtime validations for each individual query result. This has been a bit annoying to maintain at scale since I don't have very good patterns for it. I think…
      Rotareti on HN
  • Dataset

    From 1 comment
    • Dataset is my favorite dumb wrapper on top of SQLAlchemy. https://dataset.readthedocs.io/en/latest/
      nrjames on HN
  • JDBI

    From 1 comment
    • The Java/Kotlin alternative would be `the amazing library` JDBI: http://jdbi.org/
      buremba on HN
  • Ecto

    From 1 comment
    • Ecto is one of the very best things about elixir from my perspective. It seems bizarre that anyone would have this great tool uniquely available to their language and want to…
      arthurbrown on HN

Category, keywords, summaries and labels on this page were made by AI (Thread Reader v2) and not checked by hand. Each point links to the comments it came from.

Add a badge to your READMEShown on HackerShow
[![Shown on HackerShow](https://hackershow.org/badge.svg)](https://hackershow.org/show/20041076)