<     May 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
01:16 mahlon joined
01:26 mahlon joined
08:11 asio joined
08:25 brauliobo joined
09:46 fidothe joined
11:22 arne joined
11:22 <arne> why would i want prepared transactions?
14:05 <jeremyevans> arne: if you have to ask the question, you probably don't :)
14:56 onewheelskyward joined
14:58 avdi joined
15:01 <arne> jeremyevans: :)
15:07 manveru joined
15:32 tercenya joined
15:47 joevandyk joined
16:10 banditron joined
16:39 ben______ joined
17:20 tercenya joined
18:02 chrisFTW joined
18:44 tercenya joined
18:48 brauliobo joined
18:58 tercenya joined
19:38 <chrisFTW> Anyone got good sources for building Sequel Join queries on pg_jsonb data?
19:38 <jeremyevans> chrisFTW: For the join stuff, it's no different than a regular dataset join methods. For JSONB specific operators, look in the pg_json_ops extension
19:40 <chrisFTW> Thanks Jeremy. I used to be in here all the time 5-6 years ago. Glad to see you are still here :)
19:42 <adam12> He's never allowed to leave
19:42 <adam12> ;)
20:10 <chrisFTW> Okay Jeremy - I need to join to my own table sometimes. (making a library over Sequel for my devs) . The table I am joining might (and usually is) the same table... Not seeing many hints on this.
20:15 <jeremyevans> chrisFTW: DB[:table].join(Sequel[:table].as(:alias), condition)
20:17 <chrisFTW> great - almost perfect.
20:17 <chrisFTW> Thanks
20:18 <chrisFTW> I guess since the conditions for the side without the alias.. field exists in both sides. I have to just put the normal_table_name prefix on it.
20:19 <jeremyevans> chrisFTW: actually: DB[:table].join(Sequel[:table].as(:alias), :field1=>:field2) # will do alias.field1 = table.field2
20:20 <chrisFTW> Using pg_jsonb, it seemed to mess it up.
20:22 <chrisFTW> I think the Sequel.pg_jsonb(:field) is not adding on the alias part.
20:22 <chrisFTW> or the table part, as I had force the alias part. :)
20:24 banditron joined
20:24 <jeremyevans> chrisFTW: Sequel can do that in certain circumstances if given an option: DB[:table].join(Sequel[:table].as(:alias), {Sequel.pg_json(:field1)=>:field2}, :qualify=>:deep)
21:32 garrett joined
21:32 garrett left
21:35 heda joined
23:05 <adam12> jeremyevans: I'm whipped up 2 POCs for this "polymorphic" model issue that I'm trying to solve - and could use your eyes once more if possible. They both work - just trying to decide which might be the better solution going forward (when paired with Forme, etc).
23:05 <adam12> https://gist.github.com/adam12/69f70f0f8ad91efba74c4158874a21d9
23:06 <adam12> Basically, first one is as discussed - pg_jsonb with serialize. Seems to work OK. Second one is a plain jsonb column (with pg_jsonb doing the translation into that special Hash object) paired with plain Ruby modules extended into model instances
23:07 <adam12> Ultimately the goal is - each "type" has it's own fields and own validations, and they all need to live in the same table (preferably)
23:09 <adam12> I wouldn't be adversed to some sort of STI here too either, I guess.
23:09 <adam12> Or maybe even pg_row? Hmph.
23:16 <jeremyevans> adam12: I think pg_jsonb_with_serialization would probably make the most sense
23:16 <adam12> vs STI?
23:16 <jeremyevans> adam12: pg_row wouldn't work with polymorphic stuff. In general polymorphic and relational databases do not go together
23:16 <adam12> I completely forgot about STI here.
23:17 <adam12> I normally dont' like deploying STI due to the pain I had with it on Rails.
23:17 <jeremyevans> adam12: STI is certainly an option, and not a bad one if it give you what you want
23:17 sdanti joined
23:17 <adam12> but Roda doesn't care about classes.
23:17 <adam12> Thanks for the feedback.
23:17 <adam12> I'm thinking STI is simplest.
23:18 <adam12> I looked through plugins and didn't see anything - is there a plugin to delegate accessors to a jsonb field?
23:18 <adam12> I guess I could write up something quick enough to do it.
23:18 <jeremyevans> adam12: No, but ruby's forwardable module in stdlib should be able to handle that
23:19 <adam12> Thanks