Evergreen ILS Website

IRC log for #evergreen, 2018-04-18

| Channels | #evergreen index | Today | | Search | Google Search | Plain-Text | summary | Join Webchat

All times shown according to the server's local time.

Time Nick Message
00:37 beanjammin joined #evergreen
04:17 jaswinder joined #evergreen
06:31 pinesol_green News from qatests: Testing Success <http://testing.evergreen-ils.org/~live>
07:07 jaswinder joined #evergreen
07:20 rjackson_isl joined #evergreen
07:46 dbwells_ joined #evergreen
08:00 jaswinder joined #evergreen
08:42 mmorgan joined #evergreen
08:48 Dyrcona joined #evergreen
08:58 mmorgan1 joined #evergreen
09:00 ngf42 joined #evergreen
09:13 jaswinder Hey Guys,
09:13 jaswinder I want to know if I can join between two PCRUD calls somehow or I have to write custom SQL?
09:21 dbwells jaswinder: Depends on your end goal.
09:21 dbwells pcrud calls do allow "fleshing", which allows you to automatically attach linked objects to your main pcrud class.
09:23 yboston joined #evergreen
09:23 dbwells I think you can also join in a pcrud search for the purpose of filtering the results, but I'm not exactly sure of that.  You cannot arbitrarily pull fields from those joins, though.
09:23 jaswinder dbwells: The configuration has links. My goal is to query joined tables and pull columns from joined tables.
09:23 jaswinder Is there an example of how I can join using pcrud call?
09:24 dbwells It sounds like fleshing may work for you.
09:25 dbwells It would be best if you could post a branch somewhere of your code.
09:27 dbwells pcrud is primarily for client-server interaction.  Inter-service communication should use cstore, which gets you access to json_query, which gives you far greater flexibility and performance.
09:29 jaswinder okay, Is there a doc/piece of on fleshing example? I will try cstore as well
09:30 dbwells In fact, I might be mistaken, but it appears there is exactly one use of pcrud in the entire Perl service backend of Evergreen, if that tells you anything :)
09:31 jaswinder okay, so I can either setup config to use cstore and utilize fleshing or write custom sql as pcrud
09:32 Dyrcona jaswinder: You can flesh via pcrud.
09:32 Dyrcona What, exactly, do you want to do?
09:33 Dyrcona But, yeah, pcrud is meant to be used as a client. The backend uses cstore because no authentication is required for cstore.
09:33 dbwells I am trying to steer him away from pcrud based on my sense of what he is trying to do, but we're all at arms length here :)
09:33 jaswinder I have three tables a, b, c. I want to get joined results from a, b, and c along with other filtering and order clause
09:34 Dyrcona jaswinder: How you flesh depends on the details of how the links between tables a, b, and c are set up.
09:35 Dyrcona Example asset.copy (acp) and asset.call_number (acn) have links going both ways, so you can pull call number objects along with copies or vice versa.
09:38 Dyrcona jaswinder: More detail would be useful, such as a past of relevant IDL entries.
09:38 jaswinder Drycona: I am going to paste the IDL now.
09:39 pastebot "Jaswinder" at 64.57.241.14 pasted "IDL Entries for tables needed join" (70 lines) at http://paste.evergreen-ils.org/2418
09:40 dbwells_ joined #evergreen
09:40 jvwoolf joined #evergreen
09:42 dbwells jaswinder: Sorry, lost connection for a second.  If you go here and search the page for 'flesh', you can see a fleshing example:  http://library.calvin.edu/devd​ocs_project/doku.php?id=start
09:43 dbwells That is also the joke the "My API has a flesh wound!" presentation, which shows the sorts of things you are asking about here: http://git.evergreen-ils.org/?p=working/rand​om.git;a=blob_plain;f=api_presentation/web_a​pis.html;hb=refs/heads/collab/berick/eg2015#(18)
09:46 jaswinder dbwells: thanks! What is the purpose of flesh => 1? fetch one record?
09:46 dbwells No, one level deep.
09:47 jaswinder okay, I am trying visualize how it work with different depths
09:47 jaswinder links->links->?
09:47 dbwells So, for example, if you wanted to grab a record (bre), flesh the call numbers (acn), then the copies as well (acp), you would need the depth to be 2.
09:47 dbwells Yes.
09:48 Dyrcona Yes.
09:48 Dyrcona :)
09:48 jaswinder Okay, what is %paging do in the call?
09:49 Dyrcona dbwells: I updated Lp 1732591 if you want to have a look before releases today.
09:49 pinesol_green Launchpad bug 1732591 in Evergreen 3.0 "Array error appears in search box while placing hold after advanced search" [Medium,Confirmed] https://launchpad.net/bugs/1732591
09:50 dbwells Dyrcona++
09:50 Dyrcona jaswinder: I think %pagin is used to set an offset and limit.
09:50 jaswinder okay thanks!
09:51 Dyrcona it probably looks like %paging = ( offset => 0, limit => 25); or something like that.
09:51 Dyrcona I usually manage that in separate variables, but that's a clever trick. :)
09:52 * dbwells doesn't know where "%paging" is coming from :)
09:52 Dyrcona It's in an example on the first link you shared.
09:52 Dyrcona Probably left over code?
09:53 Dyrcona I *think* it would actually work if done like that, but I'd have to test.
09:53 dbwells Ah, thanks.  Yeah, not quite enough context there.
09:54 jaswinder I see
09:55 dbwells Yes, Dyrcona is right, a few lines before that in Account.pm you will find:  my %paging = ($limit or $offset) ? (limit => $limit, offset => $offset) : ();
09:57 Dyrcona BTW, NCIPServer uses PCRUD heavily because it was written to be able to run on a machine where services don't have access to the private router, though I may not have actually achieved that goal.
09:58 Dyrcona If anyone is looking for PCRUD examples, it is not a bad place to start.
10:03 Dyrcona Looks like only 1 use of fleshing in it, though.
10:04 jaswinder I have the flesh method working, but how I can filter at depth 1 or at 2? like b.something = 'ss'
10:08 collum joined #evergreen
10:14 dbwells jaswinder: That's where I am not 100% sure pcrud can go there, but I will paste up a cstore example of that I think you mean.
10:15 pastebot "dbwells" at 64.57.241.14 pasted "cstore filter on joined class" (19 lines) at http://paste.evergreen-ils.org/2420
10:16 dbwells so, two parts needed, a 'join' member is the second argument, and a "+class" member in the filter/where section.
10:17 dbwells s/is the second argument/in the second argument/
10:17 Dyrcona PCRUD does pretty much anything cstore does.
10:19 dbwells I just have vague recollections of hitting limits, because, well, "permissions", but that was in the pre-pcrud-can-flesh days.
10:19 pastebot "Jaswinder" at 64.57.241.14 pasted "Crud Call and Desired SQL" (21 lines) at http://paste.evergreen-ils.org/2422
10:20 jaswinder thanks dbwells. It would be good to see PCRUD example. I have pasted what I have and desired SQL generation I need
10:20 Dyrcona jeffdavis: I'm getting lots of the following in open-ils.ebook_api_stderr.log: Caught error from 'run' method: malformed JSON string, neither array, object, number, string or atom, at character offset 0 (before "Can't connect to int...") at /usr/local/share/perl/5.14.2/OpenSRF/Utils/JSON.pm line 109.
10:21 Dyrcona jeffdavis: Any idea where I should start looking?
10:22 krvmga joined #evergreen
10:24 Dyrcona jeffdavis: [2018-04-18 10:15:51] open-ils.ebook_api [INFO:21947:EbookAPI.pm:374:1524058560191890] EbookAPI: response received from server: 500 Can't connect to integration.api.lib.overdrive.com:443
10:28 Dyrcona And, looks like I have a bad URL configured..... That's what I get for not using a script.
10:32 dbwells jaswinder: Looking over your IDL, I think I see an issue.  '<link field="id"' should probably be '<link field="library_id"'
10:35 beanjammin joined #evergreen
10:37 dbwells_ joined #evergreen
10:39 * dbwells is not having a good connection day
10:42 pastebot "dbwells" at 64.57.241.14 pasted "join filter attempt for jaswinder" (20 lines) at http://paste.evergreen-ils.org/2423
10:42 dwgreen joined #evergreen
10:43 dbwells jaswinder: I usually need to do some fiddling with complex cstore/pcrud/json queries before I get them right, but that paste is a first draft.
10:43 dbwells It is easiest to test such things iteratively in srfsh, I think.
10:47 dbwells jaswinder: also, just to be clear, $my_home is just a made up variable for your '?'
10:49 jaswinder yes
11:03 jaswinder I just looked through the code to find any reference where I can filter the query by linked tables. Is there an example somewhere?
11:04 dbwells jaswinder: Does my paste not work?  It should be doing that.
11:05 jaswinder You have shared teh json call using cstore?
11:05 dbwells I modified your pcrud code: http://paste.evergreen-ils.org/2423
11:06 jaswinder oh thanks! I did not notice. Let me try this
11:07 dbwells jaswinder: That was what I meant talking about "$my_home", so that will need to adjusted for your use.
11:17 jaswinder dbwells: I am getting only one record back instead of two. Do I need to fill anything inside  ebook_rds => {}?
11:18 stephengwills joined #evergreen
11:18 Dyrcona jaswinder: Should you get two records? Do the added joins limit it to 1?
11:19 dbwells jaswinder: It does inner joins by default.  You can specify join type in that place if there is some null-ness going on.
11:20 jaswinder Yes, 2.
11:20 jaswinder inner join is what I need
11:20 Dyrcona Then play with it until you get 2. :)
11:21 jaswinder Dyrcona: haha. I must
11:21 dbwells Dyrcona:  :D
11:26 dbwells jaswinder: Did you fix the IDL mistake I noted earlier?
11:27 jaswinder dbwells: Sorry missed, which one it is?
11:28 dbwells '<link field="id"' should probably be '<link field="library_id"' .  I don't know if that is the source of your problem, but it can't help :)
11:29 dbwells Don't forget to restart services after adjusting the IDL.
11:30 jaswinder I think you are correct. it is a mistake, let me restart
11:33 pinesol_green [evergreen|Jason Stephenson] Lp 1735539: Fix Item Status ability to delete multiple copies. - <http://git.evergreen-ils.org/?p=​Evergreen.git;a=commit;h=e0248ed>
11:35 jaswinder This was the issue. I see the generate sql. I actually need ebook_rds.* records as top level. I just have to play with it
11:37 Dyrcona jaswinder: If you want all ebook_rds records, then there's no need to filter.
11:38 Dyrcona Base your search on ebook_rds and flesh the linked objects from the other two tables.
11:39 jaswinder Dyrcona: The filtering still need if you look at my desired SQL: http://paste.evergreen-ils.org/2422 . The sql has a ebook_rds (ebooks.digital_services) with filter and joins
11:40 jaswinder I just tried and the code produced error. I am doing something incorrect.
11:41 Dyrcona Well, after looking at your IDL again, you can't do what I said because ebook_rds has no links to the other objects. You'll have to make ebook_rdsa be the center of your search to get it in one shot.
11:42 Dyrcona Though, I think you can add "outward" links....
11:42 jaswinder You are correct. how do I add the outward links?
11:45 dbwells jaswinder: though they are used incorrectly in a few places (I keep meaning to do something 'bout that), that is what 'might_have' links are for.  They can be used in conjunction with a virtual field to pull in an object where the key is in the foreign table.
11:46 dbwells jaswinder: In the IDL, you can see an example in ccvm/ccraed relationship.
11:47 Dyrcona I was about to say, you can also do it with the map attribute.
11:47 Dyrcona aba and abaafm objects are an example.
11:47 jaswinder The "might_have" ?
11:48 dbwells jaswinder: the rel_type
11:48 dbwells I mean reltype
11:48 jaswinder got it, I can try that
11:48 Dyrcona Don't mind me. That's a bad example I just gave. :)
11:49 * Dyrcona is doing too much at once as usual. :)
11:49 jaswinder np!
11:51 dbwells jaswinder: We borrowed 'might_have' terminology from Class::DBI.  It causes confusion because it sounds related to nullability, but it is really just about which table has the key to establish the relationship.
11:52 dbwells The code is lax, though, as I believe it does the right thing based on the fields being declared virtual or not.
11:53 jaswinder thanks for the info.
11:53 dbwells Just trying to keep you off some less-useful paths I've wandered down :)
11:54 dbwells jaswinder: Where are you located?  Because you should consider coming to the conference in a few weeks if that is feasible :)
11:55 * dbwells needs to head to a lunch meeting
11:57 jaswinder Enjoy your lunch
11:58 jaswinder dbwells: I am in maryland
11:58 jaswinder Dyrcona: I am still getting an error. Pasting the updated code.
11:58 pastebot "Jaswinder" at 64.57.241.14 pasted "Updated Code" (44 lines) at http://paste.evergreen-ils.org/2426
12:05 jaswinder I am also breaking for lunch
12:13 terran joined #evergreen
12:14 jihpringle joined #evergreen
12:27 khuckins joined #evergreen
12:39 Dyrcona jaswinder: The link is not specified correctly.
12:41 Dyrcona Turns out, aba and abaafm are good examples. :)
12:55 pastebot "Dyrcona" at 64.57.241.14 pasted "jaswinder: Try this." (94 lines) at http://paste.evergreen-ils.org/2427
12:56 Dyrcona Oops. I missed a closing quote in that paste, but you'll figure it out when you get the syntax error. :)
13:03 JBoyer So, deleted-titles-in-search-results, we meet again.
13:04 Dyrcona That's-normal-in-the-staff-client. :)
13:05 JBoyer Only if you include #deleted, which I'm not doing. :/
13:07 JBoyer I know "empty" records in staff searches are normal enough, but these are 404, deleted='t', bona-fide un-records. They have moved on, red-boxes but no DVDs.
13:09 mmorgan JBoyer: What release?
13:10 JBoyer 3.0.mumble-6
13:11 mmorgan :)
13:11 JBoyer Dyrcona is right in that it appears to be limited to the staff client, which is nice, but still unexpected.
13:11 mmorgan Web client or xul?
13:12 JBoyer both
13:15 Christineb joined #evergreen
13:20 beanjammin joined #evergreen
13:22 * mmorgan is not seeing deleted bibs in staff client search results on a 3.0.3 test system.
13:24 JBoyer I've pulled out the query sent to the db to look it over, nothing looks terribly out of place. no source on the bib, no vis_attr_vector, etc.
13:28 JBoyer I suppose it's related to the 250K+ entries in metabib.record_attr_vector_list that point to deleted bibs. :/
13:38 jaswinder joined #evergreen
13:44 Dyrcona jaswinder did you see that I posted at 12:55?
13:45 agoben joined #evergreen
14:04 pinesol_green [evergreen|Jason Boyer] LP1760662: Item Status Holdable Field Display - <http://git.evergreen-ils.org/?p=​Evergreen.git;a=commit;h=06dbcab>
14:04 pinesol_green [evergreen|Jason Stephenson] LP1760662: Item Status Holdable Field Display Follow-up - <http://git.evergreen-ils.org/?p=​Evergreen.git;a=commit;h=ac4d17a>
14:22 jaswinder Dyrcona: Yes, I just did. I do not have "authorizations" Is that there for a reference?
14:23 dbwells jaswinder: that's the virtual field.
14:24 dbwells It is the place in the object to insert the data from another table/object.
14:24 dbwells jaswinder: One question, do any of your tables have a many-to-one relation?  If so, we should use (of course) has_many.
14:26 dbwells My little speech about "might_have" was mostly just a precautionary tale.
14:27 jaswinder ohk, let me try this. Yes, but not these tables
14:28 dbwells jaswinder: I'm not sure why your first try didn't work for you, then.
14:29 dbwells Also, a couple typos I spotted glancing over it:  "digitial_service_id" (two typos in there), and also '<link field="id"' is back.
14:31 jaswinder I tried what you pasted and still receive the error
14:31 jaswinder let me see
14:32 Dyrcona Well, I make no guarantees. I just dashed it off.
14:34 dbwells jaswinder: Does this describe your desired output in English?: Give me all the authorizations where the associated service is enabled and the associated library is x.
14:36 jaswinder dbwells: Good catch on typo. But, No luck on getting this to work. I am looking at the logs now
14:37 dbwells jaswinder: I guess I am just wondering how you concluded that keeping rdsa as the central table wasn't going to work.  Using inner joins and one-to-one relations, join order isn't going to matter.
14:40 jaswinder Well, I am getting more data than I needed rsda.* and data from rds.* tables
14:41 jaswinder I am getting this error: JOIN failed.  No link defined between ebook_rds and ebook_rl
14:43 dbwells If you want to continue with this inversion, you need the same structure again for ebook_rl.
14:43 dbwells That is, a new placeholder field on ebook_rds.
14:44 dbwells But, this is where it gets more confusing, as you now need to traverse two tables.
14:47 dbwells This is where "map" comes in, to allow you to reach "through" the linked object (IIRC).
14:48 jaswinder dbwells: there is not link between ebook_rds and ebook_rl. You are correct
14:48 jaswinder How do make use of map?
14:51 dbwells As the name implies, it is really designed for many-to-many "mapping" tables, but it might work for you here.  But you also don't really have to.
14:52 dbwells You could instead just nest your join.
14:53 dbwells e.g.
14:53 dbwells join => {
14:53 dbwells ebook_rdsa => {
14:53 dbwells join => {ebook_rl => {}}
14:53 dbwells }
14:53 dbwells }
14:55 jaswinder Okay, that worked. Thanks!
14:56 dbwells jaswinder: and with that, off to another meeting!
15:35 khuckins joined #evergreen
15:57 * mmorgan has been looking for the best way to test hold policies.
15:57 mmorgan I've been using the database function action.hold_request_permit_test("pickup_ou" integer, "request_ou" integer, "match_item" bigint, "match_user" integer, "match_requestor" integer) to test, is there a better approach?
16:05 Dyrcona mmorgan: I intended to write a little something to make it easier, but never got around to doing so.
16:06 mmorgan :)
16:07 Dyrcona That seems to be the better function to use.
16:07 Dyrcona I was going to suggest action.find_hold_matrix_matchpoint, but it's not as useful.
16:09 mmorgan The one I've been using gives me a true/false, which is helpful.
16:10 Dyrcona Yeah, it should give your true/false, which matchpoint that came from, and a message as to why it failed.
16:12 mmorgan Yes, for the false ones, the third element I've been getting is config.hold_matrix_test.holdable.
16:12 Dyrcona That means the matrix blocked it.
16:14 mmorgan Is it just testing the matrix? Does it take into account holdable flags on copies and locations, and things like boundaries?
16:15 mmorgan I'm testing the policies, so it's doing what I want. Just curious about the other factors.
16:15 Dyrcona It does.
16:15 Dyrcona It tests everything since it is the main function used when placing a hold.
16:15 mmorgan Ok, good to know!
16:15 Dyrcona It can return more than 1 row.
16:16 mmorgan Howso?
16:16 kaffenkj joined #evergreen
16:17 Dyrcona It returns setof action.matrix_test_result and has a loop with return next.
16:18 Dyrcona So, if your matchpoint failed and the item was not holdable, I think you'd get two results.
16:19 Dyrcona Well, all right, I checked again and there is no loop, but if the two conditions I mentioned are true, you would get two results.
16:19 Dyrcona Some results will short circuit that, such as no matchpoint.
16:22 mmorgan I'm getting item.holdable for the third element now that I've set a holdable flag to false, but still one row. It's serving my purpose at any rate!
16:22 mmorgan Dyrcona++
16:23 Dyrcona It should return two rows if I understand it correctly.
16:30 pinesol_green [evergreen|Dan Wells] Touch up release notes for 3.0.7 - <http://git.evergreen-ils.org/?p=​Evergreen.git;a=commit;h=dc62e8f>
16:30 pinesol_green [evergreen|Dan Wells] Touch up release notes for 3.1.1 - <http://git.evergreen-ils.org/?p=​Evergreen.git;a=commit;h=fad94c1>
16:44 pinesol_green [evergreen|Dan Wells] Forward-port upgrades notes from 3.1.0 - <http://git.evergreen-ils.org/?p=​Evergreen.git;a=commit;h=2ac8fdd>
17:01 mmorgan left #evergreen
17:17 alynn26 joined #evergreen
17:30 stephengwills joined #evergreen
17:30 jvwoolf left #evergreen
18:25 stephengwills joined #evergreen
18:26 dbwells_ joined #evergreen
18:31 pinesol_green News from qatests: Testing Success <http://testing.evergreen-ils.org/~live>
18:38 jaswinder joined #evergreen
20:29 jaswinder joined #evergreen
20:37 stephengwills joined #evergreen
21:22 jaswinde_ joined #evergreen
21:29 stephengwills joined #evergreen
22:04 stephengwills joined #evergreen
22:55 beanjammin joined #evergreen

| Channels | #evergreen index | Today | | Search | Google Search | Plain-Text | summary | Join Webchat