*** reinhard has joined #gnuenterprise *** aries_mindworks has joined #gnuenterprise hi good morning all *** btami has joined #gnuenterprise hi *** kilo has joined #gnuenterprise good morning *** johannesV has joined #gnuenterprise good morning hi btami, kilo: hi kilo: did you have time to look inside gnue-invoice? hi well had some time yes but havent succeeded in setting it up will try again soon ok *** erkkie has joined #gnuenterprise *** johannesV has quit IRC *** johannesV has joined #gnuenterprise *** kilo has quit IRC *** kilo has joined #gnuenterprise *** jcater has quit IRC *** btami has quit IRC *** kilo has left #gnuenterprise *** btami has joined #gnuenterprise *** jcater has joined #gnuenterprise *** yure has joined #gnuenterprise *** yure_ has joined #gnuenterprise *** derek has quit IRC *** derek has joined #gnuenterprise *** jamest has joined #gnuenterprise *** aries_mindworks has left #gnuenterprise reinhard: gnue datasources now support the master/detail relationships don't they? they always did unless I misunderstand what you are asking just a sec and I'll elaborate ok i've started moving my code to business objects here that map to tables here is a complete class class Note(DataAware): """ Contains a timestamped claim note """ def __init__(self, connections=None): DataAware.__init__(self, connections) self._tableName = 'note' self._fieldMap = { # Table field : Instance variable 'claim_no' : 'claim_no', 'userid' : 'userid', 'date' : 'timestamp', 'note' : 'text' } self._initializeFieldMap() DataAware is a class that uses gnue datasources to store the info ok so then in my code I can do item = ClaimActualItem() item.load(claim_no = '99-TEST-001', pos_no = 0) assert item.state == 'PRE-ORDER', \ 'Item did not load properly' or item = ClaimActualItem() resultList = item.multiLoad(claim_no = '99-TEST-001') assert len(resultList) == 3, \ 'Items did not load properly' it's my hope that over time this will make it far easier for me to port to an appserver type setup yes that clearly looks very appserverish that's the idea however I still don't get your question regarding master/detail however where I get into trouble is when an object contains other objects say an invoice that lists invoice items right now I override the base DataAware load and post methods so that in the case of the invoice object it loads via the standard load the invoice data then adds a multiLoad to populate a list of items so by loading the invoice I have all the items associated with the invoice in memory as instances of InvoiceItem so I started looking at how SQLObject handled this and they provide code like ok items = MultiJoin('ClassName') so i see a few options this has to happen on your object->sql layer IMHO 1. emulate the sqlobjects behavour in my DataAware you could of course make it more generic 2. replace my DataAware which uses our DataSources with a object that inherits from our datasources i was thinking that our ResultSet would provide me with the equiv of MultiJoin already if I defined the master/detail relationship as part of the object initialization no as one time I know that was handles in forms but I thought it moved to common so it's used in appserver, reports, etc, etc hmmm I'm not sure if it could be doable somehow my goals are several fold 1. i think i like the my DataAware setup the more I use it and see it as a first step in appserving my apps porting all my stuff to appserver in a single pass would overwhelm me so I taking small steps 2. reading about sqlobjects I believe gnue datasources are more flexible so I think this would be something others might have interest in 3. I could stop overriding every object I have when it contains something else :) but you don't think it doable? I think you could add that to your DataAware something like in __init__ have details = {'items': ('invoice_item', condition_for_the_link)} then in load and post methods you could generically go through that details list now there's an idea i didn't think about how would appserver expose this? if I your example I'd end up with invoice = instance of Invoice invoice.items = list of instances of InvoiceItem with appserver you would have to do how close would that be to what appserver would give me on a loaded invoice invoice_items = find ('invoiceItems', condition = {invoiceHead: myInvoice}, propertylist = [count, price, discount]) and you could also do things like invoice_items_with_special_status = find ('invoiceItems', condition = {invoiceHead: myInvoice, status: 'foo'}, propertylist = [count, price, discount]) there are no "list properties" in appserver we have talked about them quite a few times, but never found any reasonable way to design it so you just populate a std python list in the init of the main object? no we do that *outside* the object definition in the application or you store them completely separate yes so you can't load invoice and get all the invoice items not other than with a line like above the proble is if we supported something like myInvoice.items we couldn't define what sort order the list should have what fields to load from the db (gets important if every invoice item contains a blob with the picture of the item...) and all that stuff makes sense fwiw: i think sql object makes all such references Generators that load data upon demand yes, this is also a solution it also by default performs an update each time a object property value is changed * jamest shudders ah oh so you mean foo = MyThing() every access to a single property of the object issues its own sql statement? foo.x = 1 foo.y = 2 foo.z = foo.a + foo.b ? not in that case it caches in memory so I think they do but if foo.a is accessed for the first time? foo = Object() (with items being a MUltiJoin) for item in foo.items[:10] then after that I do foo.items[2] foo.items[15] but what fields does it include in the select? all? yes in sqlobject it looks like you do def Foo: then in the __init__ add text column bar add int column baby add text column oh_yeah length = 10 then a Foo.createTable() foo bar text baby integer oh_yeah varchar(10) ok but I didn't see anything that limited the load of fields and complex joins are impossible and if I need the oh_yeah field only in 1% of the cases * jamest read thru the docs only didn't setup a test install it would still be requested anytime I access foo? ok i believe so this is why I think our datasources are more flexible nice that pretty much stops you from using blobs ;-) as even in my DataAware i can do load(field = 1, field2= 3) or load (conditions=) i think think it'd be fairly trivial to add load (condiitons, excludeFIelds = ()) yeah or includeFields :) right so I really see our datasources as better I agree entirely it sounds like I need to not think about inheriting from our datasources directly and instead extend my DataAware to be more flexible I would think so although I haven't thought through it in depth datasources never wanted to be an object-sql mapper in the first place (AFAICT) no, it never was i'm just trying to make the jump to business objects from a system not designed for business objects less painful and I'm just watching from afar, so I can "borrow" jamest's code when he's got the bugs worked out i have to go pick up my wife but I'd be curious if this stuff would be useful in common at all another issue involves the connection manager might be jcater: i completely forgot I do have a singlton setup for that, i went in to add it and it was already there :) *** johannesV_ has joined #gnuenterprise *** johannesV has quit IRC *** johannesV_ has quit IRC *** johannesV has joined #gnuenterprise *** btami has quit IRC *** btami has joined #gnuenterprise *** sjc has joined #gnuenterprise *** btami has quit IRC *** johannesV has quit IRC reinhard: you guys haven't happened to setup a set of test tables have you? with some test data we usually use zipcode for testing (2-tier) would there be an advantage to having maybe 2 tables testTableA and testTableB with an 1:N relationship zipcode is 2 tables with a 1:N relationship with every field type commonly in use ah we've done that "every field type" thingy in the appserver sample I think kilo has ported this sample to 2-tier that might work should be findable in gnue-forms samples IIRC however that one doesn't have master/detail i'm just getting ready to try extend my object mapper and so started writing unit tests for it and thought maybe this would be handy for gnue unit tests as well are you talking about gnue-samples/testcases/appserver ? the gsd in there? I'm not sure, I've never used it myself but it sounds like that, yes well, it actually *has* a 1:N relationship with country : person reinhard: looks like a gsd file doesn't exist which I assume would be avail if kilo ported it iirc appserver used gcd files *** dyfet has joined #gnuenterprise is gnue-schema still used? gsscvs? yes i'm trying to get it to dump a schema from a gsd file I just made --mode=data errors out and it's not adding the data to the output file it's also assuming a username of gnue and failing on login instead of defaulting to the connection managers login prompts if a username/password isn't passed in is that how it should work? are you running on a connection or into a file? trying into a file, running to a connection tracebacks what did you try? (can you give me the command line?) gsscvs -f -o out.sql -c devel -u jamest -p *snip* testTables.gsd if I lose the -u and -p then it complains about pam failure for user gnue if I lose the -p then pam failure for user jamest if I lose the -f and -o ...........odd.........it now doesn't give the None type traceback weird it actually shouldn't try to log in at all if you do -f with just gsscvs -c devel -f -o out.sql testTables.sql it gives a PAM authentication failed for user "gnue" not that it would *completely* explain the symptom but could you maybe try in datasources/readgsd.py lines 237 and 238 replace 'username' with '_username' and 'password' with '_password'? err no line 246 and 247 but I keep getting confused with the 'username' vs. '_username' parameter same I mean it should accept username and password on command line then oh that worked if you left -p off it'd fail something is hosed here if (loginData.has_key ('username')): loginData ['_username'] = loginData ['username'] del loginData ['username'] if (loginData.has_key ('password')): loginData ['_password'] = loginData ['password'] del loginData ['password'] that actually does exactly this username -> _username care to create an issue in our tracker? :-) must run off for a bit but bbl *** yure has quit IRC *** kilo has joined #gnuenterprise back *** klasstek has joined #gnuenterprise *** jamest has quit IRC *** jamest has joined #gnuenterprise *** klasstek has quit IRC *** klasstek has joined #gnuenterprise *** jamest has left #gnuenterprise *** erkkie has quit IRC *** klasstek has quit IRC *** klasstek has joined #gnuenterprise *** dyfet has quit IRC good night all *** reinhard has quit IRC *** kilo has left #gnuenterprise *** derek has quit IRC *** klasstek has quit IRC *** jcater has left #gnuenterprise *** jamest has joined #gnuenterprise *** jamest has quit IRC *** sjc has quit IRC *** jcater has joined #gnuenterprise *** jamest has joined #gnuenterprise *** jcater has left #gnuenterprise *** derek has joined #gnuenterprise *** sacha__ has joined #gnuenterprise *** jcater has joined #gnuenterprise *** jamest has quit IRC *** jcater has left #gnuenterprise *** derek has quit IRC *** derek has joined #gnuenterprise *** derek has quit IRC *** bigbrother` has joined #gnuenterprise *** bigbrother has quit IRC *** Poincare has quit IRC *** nickr has quit IRC *** nickr has joined #gnuenterprise *** Poincare has joined #gnuenterprise