4 ms·
> what ORM to use (or not to use an ORM) do you have something to recommend ? used Rose::DB in the past, then I discovered SQLAlchemy and it's difficult to lo
by maxhou 10y ago
> what ORM to use (or not to use an ORM)
do you have something to recommend ?
used Rose::DB in the past, then I discovered SQLAlchemy and it's difficult to look back...
- ashimema 10y ago1 point by ashimema 0 minutes ago | edit | delete Love DBIx::Class.. but it's not a good/perfect fit for Mojolicious by a long way.. it's blocking by nature and thus doesn't play too nicely if your aiming to write a non-blocking mojo app. reply
- mst 10y agoFor the few queries where you need async (most should be fast enough in the first place), there's no reason you can't use $rs->as_query to get hold of the SQL and bind values and then feed those into Mojo::Pg.
- SwellJoe 10y agoIs there such a thing as a non-blocking SQL query? Doesn't it always have to be wrapped up in something to make it non-blocking? I think my question is: Is there an SQL ORM in any language that is non-blocking during queries, without the programmer having to wrap it in some sort of promise/callback/whatever? I really have no idea about ORMs, so I don't know anything about the state of the art. I'm trying to imagine what such a creature would look like...it seems like if your queries are going to potentially make you wait for any amount of time, you'd need to account for that at the caller side, even if things happen on the ORM side.
- SwellJoe 10y agoDBIx::Class is the only one I've really looked at. I also recall seeing a talk on Fey and Fey::ORM, given by the author, at YAPC or somewhere, and remember thinking it seemed really nice. But, I have never used any ORM heavily, so I'm still figuring it out.
- break_in 10y agoWith simple CRUD operations dbix works good. But for more complex queries pure dbi sql looks more good.
- peteretep 10y agoI'd need someone suggesting anything other than DBIx::Class to present some ironcast arguments for that choice
- deleted 10y ago[deleted]
- kbenson 10y agoI agree. I think the main Perl workhorse modules that provide the best benefit for me are, in order: DBIx::Class Kavorka / Function::Parameters / Method::Signatures (take your pick) Moose / Moo (or use Moops and get Kavorka above built in!) Mojolicious Notable mention: Path::Tiny (and Try::Tiny, but everyone should know that one). It's taken me awhile to find the happy medium where I'm not sticking too much in DBIC ResultSet methods, but being able to define complex search methods that chain is awesome: my $rs = Schema->resultset("Foo")->unprocessed->rows(100)->order_by([-desc=>'time']); $rs = $rs->for_user($user) if $user; $rs = $rs->recent_entries; # Limit to the last week Makes my life much better, and makes it so much easier to change me schema as needed.