<    April 2017    >
Su Mo Tu We Th Fr Sa  
 2  3  4  5  6  7  8  
 9 10 11 12 13 14 15  
16 17 18 19 20 21 22  
23 24 25 26 27 28 29  
00:34 tercenya joined
06:31 ta__ joined
08:36 <foxxx0> hey, does sequel have a method to encapsulate DB/relation results in custom classes? i want to have domain-specific classes/models that have no associations with any ORM/database gem/class/module and will be used in the upper layers of the application
08:36 <foxxx0> so i'm looking for some kind of DB[query].as(MyApp::Models::MyModel)
12:14 pdrakeweb joined
12:32 <Freaky> foxxx0: I think Hanami uses Sequel as a repository layer, might be worth looking at what it's doing
12:33 <Freaky> ROM is probably worth looking at if you fancy that sort of pattern too
12:35 <foxxx0> i've taken a look at ROM but it's a bit clumsy and i need to be able to talk to the orm/db a bit more directly than what ROM offers
13:08 pdrakeweb joined
13:19 tercenya joined
13:54 tercenya joined
14:06 <jeremyevans> foxxx0: DB[query].with_row_proc(proc{|h| MyApp::Models::MyModel.new(h)})
14:10 <foxxx0> jeremyevans: thats sounds nice, i'll get back to you as soon as was able to try it out
14:11 <foxxx0> planning in advance here, totally busy with other stuff but acquiring infos/ideas on other projects simoultaneously \o/
14:11 <foxxx0> thanks :)
14:14 pdrakeweb joined
14:26 pdrakeweb joined
15:10 pdrakeweb joined
15:51 pdrakeweb joined
16:24 tils joined
16:25 tils left
16:29 pdrakeweb joined
16:31 ernlyne joined
16:31 <ernlyne> hy there
16:31 <jeremyevans> ernlyne: hi
16:32 <ernlyne> im switching from activerecord to sequel. It's a lot of practices to rebuild, buts I think it's a long time worth thing
16:34 <ernlyne> I'm facing an issue. I'm sure it's because I'm missunderstanding smt, but how chaining 'join' mtehod ?
16:35 <jeremyevans> ernlyne: OK. join is a dataset method that can be chained like other dataset methods. Are you having a problem with it?
16:35 <ernlyne> With ActiveRecord I can do : `Model.joins(:t_a, :t_b) ` or `Model.joins(:t_a).joins(:t_b)`
16:35 tercenya joined
16:35 <ernlyne> but with sequel i can't
16:36 <jeremyevans> ernlyne: Model.join(:t_a, ...).join(:t_b, ...) should work
16:36 <ernlyne> well
16:36 <ernlyne> it is
16:36 <jeremyevans> ernlyne: If you are expecting those to use associations, they don't in Sequel, there is association_join for that
16:36 <ernlyne> but the problem is that the query is bad
16:37 <ernlyne> Feedback.join(:surveys, id: :survey_id).join(:ratings, id: :rating_id) -> the query puts 'surveys.id = rating_id' instead of 'feedbacks.id = rating_id'
16:37 <ernlyne> in the second part
16:38 <ernlyne> ok I will take a look at association_join
16:38 <jeremyevans> ernlyne: you can specify the qualifier: Feedback.join(:surveys, id: :survey_id).join(:ratings, Sequel[:feedbacks][:id] => :rating_id)
16:38 <jeremyevans> ernlyne: There are other options you could pass that would also handle it: :implicit_qualifier
16:38 <jeremyevans> ernlyne: by default, the implicit qualifier is the last joined table
16:39 <ernlyne> good to know
16:39 <ernlyne> Thank you for the precious info
16:40 <ernlyne> it's pretty hard to find tutos/infos about sequel moreover Google mix 'sequel' and 'sql' ...
16:40 <jeremyevans> ernlyne: include ruby sequel and the results should be relevant
16:40 <jeremyevans> ernlyne: Or just go to http://sequel.jeremyevans.net, the documentation there is pretty comprehensive
16:41 <ernlyne> yes, I'm using '-sql' too but .. still hard to find deep using of sequel
16:42 <ernlyne> well I agree it's a pretty good/complete doc but after 30 min I wasn't able to find something u gave me in seconds.
16:42 <ernlyne> Old habits about activeRecord doesn't help me
16:42 <ernlyne> but i'm on the way
16:42 <ernlyne> x)
16:43 <ernlyne> Thank you for your advice. Cheerz
16:46 tercenya joined
16:53 pdrakeweb joined
16:56 pdrakeweb joined
16:57 pdrakeweb joined
18:01 pdrakeweb joined
18:08 tercenya joined
18:11 pdrakeweb joined
18:12 pdrakeweb joined
18:20 pdrakeweb joined
18:36 pdrakeweb joined
18:48 Eiam joined
19:19 pdrakeweb joined
23:32 GitHub174 joined
23:32 <GitHub174> [13sequel_pg] 15jeremyevans pushed 1 new commit to 06master: 02https://git.io/v939b
23:32 <GitHub174> 13sequel_pg/06master 149e668ff 15Jeremy Evans: Support logging of connection information in single row mode...
23:32 GitHub174 left
23:35 <lopex> hey, is it the right way to go wrt procs func = Sequel.function(:kum, 2, 3); db[:foo].select{func}.first ?
23:37 <lopex> jeremyevans: wrt jt400 support what's the general guidelines if I wanted to take over the support ?
23:47 <jeremyevans> lopex: db[:foo].get{kum(2,3)} # easiest
23:48 <jeremyevans> lopex: what you have will work, though you generally wouldn't use a virtual row block if you already have an expression. You could do db[:foo].get(func)
23:49 <jeremyevans> lopex: get instead of first here, because I'm assuming a hash with a single key is probably not exactly what you want
23:50 <jeremyevans> lopex: for the jdbc/as400 stuff, I think perlun at GitHub was planning to take over, you may want to talk to him. See https://github.com/jeremyevans/sequel/issues/1335
23:50 <lopex> ah
23:50 <lopex> cool
23:51 <lopex> jeremyevans: wrt proc, is there a diff wrt returns ?
23:51 <lopex> like
23:51 <lopex> some_proc in db side int, int -> int
23:52 <lopex> I want to fetch that result as an unnamed value
23:52 <lopex> does my question make sesne ?
23:52 <jeremyevans> lopex: if you use .first, you'll get a hash {:k=>v}; if you use .get, you just get v
23:52 <jeremyevans> lopex: .get is probably what you want in that case
23:52 <lopex> ah
23:52 <lopex> yeah
23:52 <lopex> thanks
23:52 <jeremyevans> lopex: So I would use db[:foo].get{kum(2,3)}
23:53 <lopex> I guess I havent found get in the docs
23:54 <lopex> jeremyevans: so all virtual row apis rely on method missing ?
23:56 <jeremyevans> lopex: yes
23:56 <lopex> ok
23:58 <lopex> btw that deprecation logs are very informative
23:58 <lopex> must have been quite of work
23:58 <jeremyevans> lopex: It has been. Thankfully I'm most of the way done with deprecating
23:59 <lopex> I'm happy if all that cleans sequel codebase
23:59 <jeremyevans> lopex: I have a few more issues I'm going to be asking for feedback on, and I need to review the plugins/extensions/adapters to see if I want to deprecate anything else, but I just finished the review of the core