PostgresJs: PostgreSQL client for Node.js and Deno
101–110 of 148 posts
Re: PostgresJs: PostgreSQL client for Node.js and Deno
#102Shout out to https://www.npmjs.com/package/sql-template-strings , which does a similar template string SQL escaping standalone.
Re: PostgresJs: PostgreSQL client for Node.js and Deno
#103For 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
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
#104For 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…
What do you use for up/down migration if you don't mind sharing?
Re: PostgresJs: PostgreSQL client for Node.js and Deno
#105The 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
https://github.com/porsager/postgres/discussions/627#discuss...
Re: PostgresJs: PostgreSQL client for Node.js and Deno
#106Re: PostgresJs: PostgreSQL client for Node.js and Deno
#107Terrible 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.
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
#108Earlier 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?
Re: PostgresJs: PostgreSQL client for Node.js and Deno
#109Earlier 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.
Re: PostgresJs: PostgreSQL client for Node.js and Deno
#110Can 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(‘…’).
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