PugSQL
Languages and libraries
database query library
SHOW HN2019
How HN took it
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 HNOne 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 HNi 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 HNI 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 HNA 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 HNSQLAlchemy-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 HNIt'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 HNYou 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