Live data from Hacker News

Flyweight: A Node.js ORM Specifically for SQLite

github.com

21–30 of 45 posts

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

#21
post #11

Alias stars is a really nice feature.

I have come to believe that select * should only be used in exploratory SQL and never in application code.

I know a lot of devs treat database schemas as sacrosanct and try not to modify the schema much once created. However, I do like being able to iterate on schema quite a bit during early stages of application and in case of dot-star queries I often end up with either run time errors or type errors that are quite far from the query itself. So now I have settled on ensuring that all columns are always specified in queries originating from application code.

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

#23
post #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?

I wanted to like kysely / prisma, but totally useless if you have any geospatial data in your system

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

#26

Very nice work. I've always tended towards libraries that automated more the mapping of database entities to their language-specific representation, such as Dapper on .NET. SQL is generally quite fine as a query language, warts and all. Better than digging through docs and issues to find out how to issue some lesser-used functionality that may or may not be supported by a query builder.

this is my goto. Dapper was also my intro to it, but its a pattern I've followed in every other language since. Writing queries is easy, mapping is the annoying/repetitive part. sqlx for Golang has some decent mapping helpers too.

I don't want to learn/remember a new way to query the same underlying database every time I switch projects/stacks/etc... sql is better, literally.

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

#27
post #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?

I wanted to like kysely / prisma, but totally useless if you have any geospatial data in your system

Out of interest, why is that? Do they not support it?

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

#28
post #24

How does this compare with my current favorite lite sqlite wrapper kysely? https://kysely.dev/

It seems like with kysely, you write your SQL in javascript/typescript? That's a big fat ugly anti-pattern, IMO.

What makes it an anti-pattern?

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

#29

Great work! But why would anyone use an ORM that is specifically to one database? For me, using an ORM is the ability to switch between databases, specifically SQLite for testing and PostgreSQL for production, without having to change any logic.

Curious how that works? Do you not use any features of Postgres that aren't present in SQLLite? If so, why not just SQLite everywhere? Alternatively, why not spin up an ephemeral PG container for testing? Seems odd to not practice how you play to that extent.

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

#30
post #24

How does this compare with my current favorite lite sqlite wrapper kysely? https://kysely.dev/

It seems like with kysely, you write your SQL in javascript/typescript? That's a big fat ugly anti-pattern, IMO.

you write your SQL in javascript/typescript? That's a big fat ugly anti-pattern, IMO.

Any other solution sucks more.

Post reply on HN