Re:PostgresJs: The Fastest full featured PostgreSQL client f...
by 9dev on Saturday October 14, 2023 @06:49AM
(#37879505)
Seconded. The lateral join features in combination with the shortcut functions make it exceptionally easy to build backends with actual SQL, without compromising on ease of use.
Re:PostgresJs: The Fastest full featured PostgreSQL client f...
by oulipo on Saturday October 14, 2023 @07:54AM
(#37879801)
Does that work also with Postgres-compatible backends like Bigquery et al ?
Re:PostgresJs: The Fastest full featured PostgreSQL client f...
by gmac on Saturday October 14, 2023 @11:18AM
(#37881157)
It relies on pg (node-postgres) to talk to Postgres, so it should work with anything pg can talk to.
Re:PostgresJs: The Fastest full featured PostgreSQL client f...
by xctr94 on Saturday October 14, 2023 @08:00AM
(#37879825)
We had to abandon Zapatos because a) it doesn’t support multiple schemas; b) the types wouldn’t always be very readable.
PgTyped was the alternative, and 2 years later I’m very glad we made the switch.
Re:PostgresJs: The Fastest full featured PostgreSQL client f...
by Exuma on Saturday October 14, 2023 @08:28AM
(#37879952)
What do you mean multiple schemas ? What is an example of a non readable type?
Re:PostgresJs: The Fastest full featured PostgreSQL client f...
by pimeys on Saturday October 14, 2023 @08:54AM
(#37880108)
Like this, it's pretty common way to use Postgres (with multiple schemas):
CREATE SCHEMA a;
CREATE SCHEMA b;
CREATE TABLE a.foo (id SERIAL PRIMARY KEY);
CREATE TABLE b.foo (id SERIAL PRIMARY KEY);
Re:PostgresJs: The Fastest full featured PostgreSQL client f...
by xctr94 on Saturday October 14, 2023 @02:17PM
(#37882847)
I didn’t know support for schemas had landed, but the docs still seem obtuse for joins and upserts. Compared to plain SQL files in PgTyped — which admittedly needs some annotations to work, and lacks transactions —, I find the lateral joins in Zapatos really verbose and ugly. Lots of extra parameters too.
Which isn’t to say it’s not a great tool! You pick what you like :)
Re:PostgresJs: The Fastest full featured PostgreSQL client f...
by alde on Saturday October 14, 2023 @08:06PM
(#37885491)
Glad you are liking pgTyped.
Transactions are supported as pgTyped is just a thin wrapper around node-postgres:
https://github.com/adelsz/pgtyped/discussions/448
Re:PostgresJs: The Fastest full featured PostgreSQL client f...
by xctr94 on Thursday October 19, 2023 @02:48AM
(#37939380)
Ah, I meant having a single transaction in a SQL file, as that’s how we’re using it. So having multiple queries with a BEGIN and COMMIT wrapping them.
Re:PostgresJs: The Fastest full featured PostgreSQL client f...
by hhfdsbvc on Saturday October 14, 2023 @09:05AM
(#37880173)
Ever try drizzle?
Re:PostgresJs: The Fastest full featured PostgreSQL client f...
by xctr94 on Saturday October 14, 2023 @02:10PM
(#37882766)
I haven’t, but it’s an ORM so an automatic no. We tested 6 ORMs before deciding that plain SQL with introspection was the way to go. No regrets.
Re:PostgresJs: The Fastest full featured PostgreSQL client f...
by 9dev on Saturday October 14, 2023 @09:30AM
(#37880340)
I don’t know if this has changed recently, but I’m using multiple schemas with Zapatos just fine. The type you can import looks like `auth.user.Selectable`, where auth is the schema and user the table.
Re:PostgresJs: The Fastest full featured PostgreSQL client f...
by gmac on Saturday October 14, 2023 @11:17AM
(#37881143)
It does now support multiple schemas: https://jawj.github.io/zapatos/#60
Re:PostgresJs: The Fastest full featured PostgreSQL client f...
by willtemperley on Saturday October 14, 2023 @08:35AM
(#37879992)
At first glance Zapatos doesn't appear to be Cloudflare workers compatible though I'd love to be corrected.
Re:PostgresJs: The Fastest full featured PostgreSQL client f...
by gmac on Saturday October 14, 2023 @11:14AM
(#37881126)
It should be, now that pg runs fine there. If it’s not, please file an issue!
It also works with @neondatabase/serverless on platforms without TCP connections (though it’s on my TODO list to make this less fiddly): https://github.com/neondatabase/neon-vercel-zapatos
Re:PostgresJs: The Fastest full featured PostgreSQL client f...
by jokesterfr on Monday October 16, 2023 @12:31PM
(#37902297)
Do you know why zapatos relies on pg and not PostgresJs?
Personally I feel it’s one of the best designed (and documented) TS libraries out there and I’m sad it’s not very well known.