<    March 2017    >
Su Mo Tu We Th Fr Sa  
          1  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 30 31
00:41 pdrakeweb joined
01:14 filterfish joined
01:46 irclogger_com joined
01:46 Topic for
02:04 banditro_ joined
04:40 aidalgol joined
07:24 ta_ joined
08:07 filterfish joined
08:08 filterfish_ joined
08:53 banditron joined
08:58 Bish joined
09:05 filterfish_ joined
09:07 Bish joined
09:17 Bish joined
10:01 Bish joined
10:57 plundberg joined
10:58 <plundberg> hi there. trying to mock some Sequel queries to be able to get full test coverage on my code, but it seems like `each_page` isn't available on the mocked DataSet I receive when connecting to a mock: connection string. Any ideas on how to easily work around it?
11:28 filterfish joined
12:39 Bish joined
13:23 Bish joined
13:38 <plundberg> Ah, I think I was missing db.extension(:pagination)
13:46 <mkaito> wait, there's a pagination extension? idling in this channel already paid off!
14:09 tercenya joined
14:10 banditron joined
14:20 plundberg joined
14:20 banditron joined
15:21 GitHub101 joined
15:21 <GitHub101> [13sequel] 15jeremyevans pushed 5 new commits to 06master: 02https://git.io/vSYue
15:21 <GitHub101> 13sequel/06master 14a4db0db 15Jeremy Evans: Run specs on 2.4 if warning library is not available
15:21 <GitHub101> 13sequel/06master 149d420c2 15Jeremy Evans: Fix Sequel::Unbind* warning when loading Sequel::Model...
15:21 <GitHub101> 13sequel/06master 14fddae2a 15Jeremy Evans: Deprecate Sequel::BeforeHookFailed...
15:21 GitHub101 left
15:51 <Bish> jeremyevans: https://paste.pound-python.org/show/SB083Z2MLOlbQ57wGzhk/ would this be considered as a bug?
15:51 <Bish> ( i couldn't reproduce it, since this code snipped dies in line 17
15:51 <Bish> where in my production app, it does set the server to default
15:52 <jeremyevans> Bish: Can you reproduce on something other than webrick?
15:54 <Bish> Building native extensions. This could take a while...
15:55 <jeremyevans> Bish: One issue with your code, you are calling add_servers without specifying a :servers hash when creating the database
15:56 <jeremyevans> Bish: I think Sequel currently ignores such a call, as you aren't running with a shared connection pool
15:56 <jeremyevans> sharded connection pool
15:57 <Bish> jeremyevans: yeah thin does it, to
15:57 <Bish> jeremyevans: that error is only in that file, im sorry
15:58 <jeremyevans> Bish: I should probably deprecate the silent ignoring in add/remove servers, and make it raise an error in Sequel 5
15:59 <Bish> https://paste.pound-python.org/show/fsu8SzirUFoNhSjKrtTi/
15:59 <Bish> this code does reproduce the "bug" if it is one
15:59 <Bish> output is xxx,default,xxx,default
16:00 <Bish> stream { ... server_block ... seems to reset the default server }
16:02 <jeremyevans> Bish: works fine in unicorn, output is 5 hellos in browser, prints :xxx and :default on command line
16:03 <jeremyevans> Bish: that's not a bug, as the stream block is executed after the with_server block returns
16:03 <jeremyevans> Bish: you need to call with_server inside the stream block if you want it to take effect there
16:06 <Bish> okay, great
16:06 <Bish> thanks
18:18 tercenya joined
18:24 ta_ joined
18:29 GitHub100 joined
18:29 <GitHub100> [13sequel] 15jeremyevans pushed 4 new commits to 06master: 02https://git.io/vSYx7
18:29 <GitHub100> 13sequel/06master 14d63eb82 15Jeremy Evans: Deprecate returning false from model before hooks to cancel the action, use Model#cancel_action...
18:29 <GitHub100> 13sequel/06master 14da20b7a 15Jeremy Evans: Make Model#_valid? private method accept only an options hash...
18:29 <GitHub100> 13sequel/06master 140d0f565 15Jeremy Evans: Silence deprecation warnings when running the core_extension specs
18:29 GitHub100 left
18:38 ta_ joined
18:41 Renich joined
18:56 ged joined
18:58 mahlon joined
19:28 plundberg joined
19:34 banditron joined
20:04 tercenya joined
20:09 tercenya joined
20:28 pabloh joined
20:31 <pabloh> Hey, guys, is there a reason why eager loading or tactical_eager_loader, only works when you iterate a resulting dataset using 'all' but it does not work if you use 'each'?. Is quite surprising.
20:35 <jeremyevans> pabloh: can't eager load unless you know all values up front
20:35 <jeremyevans> pabloh: there is the eager_each plugin if you want it to work anyway, but that just makes each call all
20:36 <pabloh> jeremyevans, thank you for the answer, but I guess my question then is why each, doesn't call all with block by default?
20:37 <jeremyevans> pabloh: because each is supposed to iterate over records by default, not wait until they all arrive (that's what all is for)
20:38 <jeremyevans> pabloh: basically, if you are eager loading and calling each, you are telling sequel to load them incrementally, but load associated records eagerly, which doesn't make sense
20:39 <pabloh> maybe I don't understand what you mean by loading records incrementally, does each loads all the models, one by one while you iterate?
20:40 <jeremyevans> pabloh: yes, that is what each is for
20:41 <jeremyevans> pabloh: all is for gathering all records first, then iterating over them
20:41 <pabloh> jeremyevans, oh, I see, so if you iterate using each you should see a separate query for every single object, while you iterate?
20:42 <pabloh> if you check the log
20:42 <jeremyevans> pabloh: not necessarily. The query is sent once, and will return multiple records. but all will keep all records in memory, whereas each will process them as they are yielded by the adapter
20:43 <pabloh> so the reason you don't see them again is because they are already at some cahce?
20:43 <pabloh> cache*
20:44 <jeremyevans> pabloh: consider [1,2,3].each{|v| sleep 1; p v} compared to [1,2,3].map{|v| sleep 1; v}.each{|v| p v}
20:44 <pabloh> aha
20:45 <jeremyevans> pabloh: datasets themselves do not cache results, but associations do. I'm not sure which you are referring to
20:45 <pabloh> the first is akind to each and the 2do one is akin to all?
20:45 <jeremyevans> pabloh: correct
20:45 <pabloh> so by process you mean for instance wrapping the result into the actual model?
20:46 <jeremyevans> pabloh: well, it depends on how the adapter/driver works. Some adapters stream results, some will buffer all rows or some rows. In general if you want to process a large dataset (one that would not fit in memory), you have to use each
20:48 <pabloh> ahh, each can work as a cursor
20:49 <pabloh> or "can" depending on the adapter
20:49 <jeremyevans> pabloh: correct. Not a seekable cursor, though
20:49 <pabloh> yeah, that's another issue
20:52 <pabloh> I was trying yo exploit the tactical eager loading to optimize queries for graphql, without success, probably is was due that, I guess there's too many people experimenting the graphql and sequel these days
20:53 <pabloh> probably you can easily solve this with some wrapper somewhere to call all instead of each
20:54 <jeremyevans> pabloh: or you could use the eager_each plugin, which handles it internally
20:55 <pabloh> jeremyevans I was afraid changing the behaviour of each could be dangerous, but maybe not for my use case
20:55 <pabloh> I guess I could give that a try as well
20:55 <pabloh> Is the easiest path after all...
20:55 <jeremyevans> pabloh: it only changes each to call all if you are eager loading. if you are not eager loading, there is no effect
20:56 <pabloh> is not the sort of thing that would interact with other plugins I guess..
20:56 <pabloh> ok, since I'm not really using I will give a try first, you convinced me :D
20:58 <pabloh> jeremyevans, BTW thank you for creating sequel! ;)
22:24 banditro_ joined
23:45 GitHub71 joined
23:45 <GitHub71> [13sequel] 15jeremyevans pushed 11 new commits to 06master: 02https://git.io/vSO1j
23:45 <GitHub71> 13sequel/06master 146a309bb 15Jeremy Evans: Deprecate Database#each_server...
23:45 <GitHub71> 13sequel/06master 144bba77a 15Jeremy Evans: Deprecate Database#{add,remove}_servers when not using a sharded connection pool...
23:45 <GitHub71> 13sequel/06master 1466f97f7 15Jeremy Evans: Add a few specs for better coverage
23:45 GitHub71 left