Live data from Hacker News

Flyweight: A Node.js ORM Specifically for SQLite

github.com

1–10 of 45 posts

Re: Flyweight: A Node.js ORM Specifically for SQLite

#2
Really like the singular and plural name approach. API is a real joy to use.

reminds of kysely typed SQL builder which was perfect to use with postgres in one of my previous projects.

I currently am working on a sqlite based project but based on Tauri's sqlite connector which is plain SQL.

Is there anyway I can make use of Flyweight in Tauri based projects?

Re: Flyweight: A Node.js ORM Specifically for SQLite

#4
post #3

I've read a lot of good things about https://docs.sqlc.dev/en/latest/tutorials/getting-started-po... which does a similar thing on Go. Codegen over predefined sql queries seem like a good idea.

JVM/Kotlin ecosystem has a similar approach with SqlDelight - https://github.com/cashapp/sqldelight. I've been using it for a while and it's quite nice to use.

Re: Flyweight: A Node.js ORM Specifically for SQLite

#7
post #6

Another day, another ORM.

To echo this sentiment, it always reminds me of meme where on a bell curve we have :

Just use SQL on both ends

"SQL IS OLD AND ISN'T A REAL LANGUAGE WRITE ACTUAL CODE WITH PANDAS OR SPARK" in the middle

I'm getting old :(

https://www.reddit.com/r/datascience/comments/s0dn5b/2022_mo...

Re: Flyweight: A Node.js ORM Specifically for SQLite

#8
post #3

I've read a lot of good things about https://docs.sqlc.dev/en/latest/tutorials/getting-started-po... which does a similar thing on Go. Codegen over predefined sql queries seem like a good idea.

From experience…code generation is not the way. I’ve had my own custom solution both for databases and web services. The maintenance of the library itself and the code you are working as well(always go generate after each change)

Re: Flyweight: A Node.js ORM Specifically for SQLite

#9
> current_timestamp will not work properly when wanting to set the default date to the current time. This is because current_timestamp does not include timezone information and therefore when parsing the date string from the database, JavaScript will assume it is in local time when it is in fact in UTC time.

This might be the answer to an unusual date bug I noticed years ago but haven't prioritized fixing in a personal project. TIL!

Re: Flyweight: A Node.js ORM Specifically for SQLite

#10
As a database person, I think most ORMs lack the ability to run complex queries. Sure, for a simple OLTP system, you might just need a few simple joins. But if you store valuable data (otherwise why store it), you will eventually want to ask questions about it.

So this ORM positively surprised me, as you can still just use SQL and get a JS function generated from it.

To bridge object-to-relational mapping, Oracle has an interesting concept called "JSON duality views". Don't dismiss it because it is Oracle, I think the concept is brilliant. The translation from relational to JSON happens in the database, and it also allows you to send an updated JSON back and the DB will automatically run the necessary DML operations. A good example is here: https://oracle-base.com/articles/23c/json-relational-duality...

Post reply on HN