4 ms·
I am over ORMs. I am looking at the documentation for Prisma Client at the moment, and I just think to myself "yet another ORM I have to learn". I have learnt s
by htkien 5y ago
I am over ORMs. I am looking at the documentation for Prisma Client at the moment, and I just think to myself "yet another ORM I have to learn". I have learnt so many ORMs, it is just stupid. SQL is SQL. I wish I had spent all that time further developing my SQL skills rather than learning the latest ORMs API.
For my latest large project, I just used SQL and I am happy. All I did was add some code to make sure the snake case was converted to camel case. Things like returning arrays of child relations can all be done in SQL these days with things like json_agg and json_build_object and so on.
Half of my SQL on the other hand doesn't even map to an ORM. Where is the insert ... select ... where not exists ... These things aren't even possible in the ORM concept model.
- zackify 5y agoIt took me all of 1 hour to learn how to use prisma. It’s not as hard as you make it seem. They have a vs code extension for editing the prisma schema. It’s not hard to see that you make fields “String” @unique, etc. Just make one model and that’s 80% of anything you ever need. Want to make a relation? Make a new model model Posts { users User[] } Hit save, it adds the required code to relate it to the User model. Run the generate command. Make a client instance. Create something: db.NameOfModel.create() And as you’re typing, typescript is auto completing it. There’s barely anything else to learn. And it’s a quick doc search away. Don’t hate on it because you love sql, it’s a great tool.
- htkien 5y ago>It took me all of 1 hour to learn how to use prisma. That is not how this works at all. You don't know what you don't know until you need "how do I do this query in prisma". You then spend an hour trying to figure it out, and maybe it isn't possible, then on to the next thing. It takes more than an hour to learn SQL, so if it takes you an hour to learn Prisma, you are missing something.
- joshmanders 5y agoHave you even looked at Prisma's docs? I would rather forget everything about Prisma the second I wake up in the morning and have to read their docs on how to do everything all over again, every single day, than try to understand what the heck is going on in SQL's docs.
- zackify 5y agoYeah exactly. Most queries you can figure out just from typescript auto complete too... Majority of queries in an app are basic relationships and crud actions... doesn’t take endless hours figuring this out with prisma. If it did, we wouldn’t use it.
- zackify 5y agoI’ve had to write complicated queries with prisma. In fact. One that prisma didn’t support. Ordering by the count of a relationship, and returning the few highest counts. So I added a GitHub issue that is being tracked. And what did I do for now? I wrote the SQL using prisma’ raw query function. You can learn SQL and use an ORM. Things don’t always have to be one vs the other
- qudat 5y ago> It took me all of 1 hour to learn how to use prisma. It’s not as hard as you make it seem. That's because the ORM cannot do a lot. Unless you're doing extremely simple SQL queries it will not handle what you want it to do. Now what? Drop into RAW sql and lose all type safety and you are on your own. No thanks, I started using Prisma for https://listifi.app https://listifi.app and switched it over to knex.js because the second I hit a query that Prisma couldn't handle I was on my own. Knex on the other hand could handle everything because it's a simple query builder.