Live data from Hacker News

PostgresJs: PostgreSQL client for Node.js and Deno

github.com

101–110 of 148 posts

Re: PostgresJs: PostgreSQL client for Node.js and Deno

#103
post #8

For people who would like a more safe and structured approach (but almost as powerful and with the option to resort to SQL strings if needed) I highly recommend checking out Prisma https://www.prisma.io/

Prisma doesn't do JOINs [0], it just SELECTs everything and joins them in its own engine. It should not be taken seriously. [0]: https://github.com/prisma/prisma/discussions/12715

WTH? I'm completed gobsmacked. Just tested this and you're right. I just assumed that it would do that. I haven't seen any mention of this in the docs.

Maybe it's time to test the above package or maybe knexjs (I like up/down migrations and Prisma doesn't do 'down'). I'm certainly considering not using Prisma going forward.

Thanks for bringing this up.

Re: PostgresJs: PostgreSQL client for Node.js and Deno

#104
post #57
post #8

For people who would like a more safe and structured approach (but almost as powerful and with the option to resort to SQL strings if needed) I highly recommend checking out Prisma https://www.prisma.io/

Prisma is great for schema management, but it's migration stuff broke for us and their updateMany implementation is just plain dumb. We just use db push because prisma migrate fucked up in some unknown way that is impossible to recover from. The process in the docs for re-baselining doesn't work, and we're not about to reset our database. The problem with ORMs is always that if something goes wrong you need to unders…

> but it's migration stuff broke for us

What do you use for up/down migration if you don't mind sharing?

Re: PostgresJs: PostgreSQL client for Node.js and Deno

#105
post #97
post #2

The benchmarks linked to don't compare PostgresJs to Prisma. That would be useful. Also the link text (Fastest full-featured node & deno client) should include the word benchmark, for those looking for one.

It's not even close. Prisma is extremely slow. Take a look at the original IMDB benchmarks on which the Postgres.js benchmarks are done. https://github.com/edgedb/imdbench#javascript-orms-full-repo... https://porsager.github.io/imdbench/sql.html

Thanks Pier! Your comment saved me some frustration here :-D

https://github.com/porsager/postgres/discussions/627#discuss...

Re: PostgresJs: PostgreSQL client for Node.js and Deno

#107

Terrible name, makes it impossible to search on. The problems start immediately when you realize it’s interchangeably called “Postgres”. Any other name would have been better as long as it’s distinctive. Even so I use it, best Postgres javascript library.

Try searching:

npm install postgres

My search results are always excellent. Google and DuckDuckGo deliver the documentation as first result. Bing delivers a stackoverflow answer about pg as the first result but the documentation is the second result.

I don’t really see any other problems or rather the problems are common and most developers have developed habits (like the search pattern above) to solve them.

Re: PostgresJs: PostgreSQL client for Node.js and Deno

#108
post #98

Earlier quoted context omitted.

I'd love to see a library like ecto (eilxir) for javascript. its easily the best toolkit for working with sql I've ever found. simple, powerful and easy to reason about

Curious what you think makes it better than other examples out there? How is it different than Active Record or Prisma?

prisma appears to have a transaction problem. https://github.com/prisma/prisma/discussions/12715

Re: PostgresJs: PostgreSQL client for Node.js and Deno

#109
post #22

Earlier quoted context omitted.

I've been using it in production (Deno) for a while. It's pretty solid, but their documentation is sorely lacking, so you often have to feel your way to getting more complex things to work.

Could you comment on what you're using deno in prod for? I'm curious to see and learn more about deno for production cases. I'm a big ts and nodejs user, and deno always seemed interesting to me. However I am afraid of being an early mover, so I like to learn more about use cases people have validated.

We use it for processing real-time UDP streams, as well as storing the data in postgres (as well as a hosting small API for exporting said data). We also use it to re-publish the UDP streams in a WebSocket format, for consumption by web applications.

Re: PostgresJs: PostgreSQL client for Node.js and Deno

#110
post #49

Can anyone explain to me the purpose of tagged template strings? From what I understand it’s only a function that takes in a string, so this might have just been sql(‘…’).

Also, template strings like sql`foobar`, graphql`foobar` and others enable syntax awareness in IDEs.

I have a big Typescript / SQL mixed codebase (No ORM), and its very nice to have VSCode syntax color and code-format TypeScript, GraphQL and SQL in the same file

Post reply on HN