modeling-users Mailing List for Object-Relational Bridge for python (Page 19)
Status: Abandoned
Brought to you by:
sbigaret
You can subscribe to this list here.
2002 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(2) |
Sep
(3) |
Oct
|
Nov
|
Dec
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
2003 |
Jan
(19) |
Feb
(55) |
Mar
(54) |
Apr
(48) |
May
(41) |
Jun
(40) |
Jul
(156) |
Aug
(56) |
Sep
(90) |
Oct
(14) |
Nov
(41) |
Dec
(32) |
2004 |
Jan
(6) |
Feb
(57) |
Mar
(38) |
Apr
(23) |
May
(3) |
Jun
(40) |
Jul
(39) |
Aug
(82) |
Sep
(31) |
Oct
(14) |
Nov
|
Dec
(9) |
2005 |
Jan
|
Feb
(4) |
Mar
(13) |
Apr
|
May
(5) |
Jun
(2) |
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
|
Dec
(1) |
2006 |
Jan
(1) |
Feb
(1) |
Mar
(9) |
Apr
(1) |
May
|
Jun
(1) |
Jul
(5) |
Aug
|
Sep
(5) |
Oct
(1) |
Nov
|
Dec
|
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(2) |
Nov
(1) |
Dec
|
2009 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(4) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2011 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Sebastien B. <sbi...@us...> - 2003-11-13 23:12:45
|
Mario Ruggier <ma...@ru...> wrote: > I have an entity (B) inheriting from another (A), with the > constraint that any instance of either must be related > to one instance of B. The corresponding model is therefore: >=20 > model.entities =3D [ > Entity('A', ...), > Entity('B', parent=3D'A', ...), > ] > model.associations=3D[ > # A is always related to a B > Association('A','B', > relations=3D['b','as'], > multiplicity=3D[ [1,1], [0,None] ], > delete=3D['nullify','deny'], > keys=3D['fkBId','id'], > ), > ] Okay, so you have a kind of a reflexive relationship on the inheritance tree of A, joining A to Bs (and thus, B to Bs) --your 'b' should then be related to a 'B' itself, maybe himself, or you have a cycle there. That's fine, I just want to make it clear so that we understand each other. > I can create the instances and rels in the expected way, > but when I come to delete them, there is a problem: > I try to get to the b for the a in question, to nullify the > relation (respecting the "deny" delete rule). Thus I do: >=20 > > > > a =3D ec.fetch('A',qualifier=3D'...',isDeep=3D1)[0] # gives correc= t a > > > > b =3D a.getB() > > > > b > .<pympack.A.A instance at 0x95ba60> > > > > for related_a in b.getAs(): > b.removeFromAs(related_a) > Traceback (most recent call last): > for related_a in b.getAs(): > AttributeError: A instance has no attribute 'getAs' >=20 > Thus, he insists that the b instance is of type A, > and does not find the getAs() rel-method on it (but the > id and other b-only non-rel attributes are correctly > present!). I made some tries but really could not get into this situation: whatever I try, getB() always returns 'B' instances, never 'A' instances. Could you please give the exact sequence of operations leading to this particular situation? I'm probably too tired now for this, but I cannot find of a way to make this happen, so a complete sequence of instructions revealing the bug would be a great help. Thanks! > But, removing known objects "explicitly", with : >=20 > a.removeObjectFromBothSidesOfRelationshipWithKey(b,'b') >=20 > as many times as necessary (for each a related to this b) works > just fine. >=20 > Any enlightenment? > > Cheers, mario >=20 > ps: ah, but when did relations ever behave nicely when inheritance is > involved ;-? ...and how come you find some many bugs in one day? I thought this was somehow regulated by an international agreement!?!! Thanks for reporting, and looking forward to see what makes this happen, -- S=E9bastien. |
From: Sebastien B. <sbi...@us...> - 2003-11-13 22:34:25
|
Mario Ruggier <ma...@ru...> wrote: > thanks... Created bug 841315 for this: > "Model associations do not set the multiplicity bounds" >=20 > I have installed the patch, but there are some problems. >=20 > First, the first installation test fails: > % python ./run.py > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > FAIL: [PyModel] unqualified_relationships_with_inverse > ---------------------------------------------------------------------- > Traceback (most recent call last): > File "test_PyModel.py", line 393, in > test_08_qualified_relationships_with_inverse > self.check_model(model) > File "test_PyModel.py", line 92, in check_model > self.failIf(fkStore.isRequired()!=3DtoStore.multiplicityLowerBound()) > File > "/BinaryCache/python/python-3.root~193/usr/lib/python2.2/unittest.py", l= ine > 258, in failIf > if expr: raise self.failureException, msg > AssertionError [...] Okay, thanks for reporting. In fact the test is right --it checks that the PyModel does what is expected, i.e. that the FK, when automatically created, is mandatory/required when the multiplicity's lower bound is 1. Since this correlation was not coded but the multiplicity is now correctly forwarded, the test now fails ;) I've attached to bug ticket #841315 the corresponding patch (it is an extension of the one I posted earlier today). That's a 2-in-1 bugfix, cool. > Then, for my model, on validation I get a warning for each > such relationship, e.g: >=20 > Object: Relationship A.b > ------------------------------- > * Warning(s): > - relationship is mandatory but source attribute A.fkBId is not req= uired Yes, this warning is "normal" in the bug context, it is due to the fact that the FK is not marked as mandatory as it should (in particular, this makes mdl_generate_DB_schema.py mark the FK as a NOT NULL column). It will disappear w/ the new patch applied. Please note: this is not integrated into cvs yet, I still need to add test for the other discovered bug --but this will be in the next release for sure. Thanks for the report, -- S=E9bastien. |
From: Mario R. <ma...@ru...> - 2003-11-13 17:46:47
|
Hi, I have an entity (B) inheriting from another (A), with the constraint that any instance of either must be related to one instance of B. The corresponding model is therefore: model.entities = [ Entity('A', ...), Entity('B', parent='A', ...), ] model.associations=[ # A is always related to a B Association('A','B', relations=['b','as'], multiplicity=[ [1,1], [0,None] ], delete=['nullify','deny'], keys=['fkBId','id'], ), ] I can create the instances and rels in the expected way, but when I come to delete them, there is a problem: I try to get to the b for the a in question, to nullify the relation (respecting the "deny" delete rule). Thus I do: > > > a = ec.fetch('A',qualifier='...',isDeep=1)[0] # gives correct a > > > b = a.getB() > > > b .<pympack.A.A instance at 0x95ba60> > > > for related_a in b.getAs(): b.removeFromAs(related_a) Traceback (most recent call last): for related_a in b.getAs(): AttributeError: A instance has no attribute 'getAs' Thus, he insists that the b instance is of type A, and does not find the getAs() rel-method on it (but the id and other b-only non-rel attributes are correctly present!). But, removing known objects "explicitly", with : a.removeObjectFromBothSidesOfRelationshipWithKey(b,'b') as many times as necessary (for each a related to this b) works just fine. Any enlightenment? Cheers, mario ps: ah, but when did relations ever behave nicely when inheritance is involved ;-? |
From: Mario R. <ma...@ru...> - 2003-11-13 10:26:24
|
> And, if I try to run my test code, on the first import line for the > entity (A), > I get a strange error: > > ImportError: No module named pympack.A > Exception exceptions.TypeError: "'NoneType' object is not callable" in > <bound method EditingContext.__del__ of > <Modeling.EditingContext.EditingContext instance at 0x1c9b70>> ignored My mistake on this one... for some reason my script to regenerate the db and code stops after the validation phase (becuase of the warnings I guess). As I had cleaned up the package before doing it, there is therefore physically no module on disk... so, for sure it fails ;) If I regenerate the py package and run my code, when such a required relationship is not set, saveChanges fails correctly. mario |
From: Mario R. <ma...@ru...> - 2003-11-13 10:14:00
|
Hi, thanks... Created bug 841315 for this: "Model associations do not set the multiplicity bounds" I have installed the patch, but there are some problems. First, the first installation test fails: % python ./run.py =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D FAIL: [PyModel] unqualified_relationships_with_inverse ---------------------------------------------------------------------- Traceback (most recent call last): File "test_PyModel.py", line 393, in =20 test_08_qualified_relationships_with_inverse self.check_model(model) File "test_PyModel.py", line 92, in check_model self.failIf(fkStore.isRequired()!=3DtoStore.multiplicityLowerBound())= File =20 "/BinaryCache/python/python-3.root~193/usr/lib/python2.2/unittest.py", =20= line 258, in failIf if expr: raise self.failureException, msg AssertionError ---------------------------------------------------------------------- Ran 107 tests in 7.906s FAILED (failures=3D1) 'Errors' indicate exceptions other than AssertionError. 'Failures' indicate AssertionError 0 errors, 1 failures Then, for my model, on validation I get a warning for each such relationship, e.g: Object: Relationship A.b ------------------------------- * Warning(s): - relationship is mandatory but source attribute A.fkBId is not =20 required And, if I try to run my test code, on the first import line for the =20 entity (A), I get a strange error: ImportError: No module named pympack.A Exception exceptions.TypeError: "'NoneType' object is not callable" in =20= <bound method EditingContext.__del__ of =20 <Modeling.EditingContext.EditingContext instance at 0x1c9b70>> ignored mario > Quick answer: you're not misunderstanding anything here, but the pb. = is > not w/ the validation code (which is tested enough ;), rather w/ the > pymodel itself: associations do not set the multiplicity bounds, you =20= > can > convince yourself with: > >>>> import AB >>>> from Modeling.ModelSet import defaultModelSet >>>> = defaultModelSet().entityNamed('A').relationshipNamed('b').multiplici=20 >>>> tyLowerBound() > 0 > > Try the attached patch, it should solve the pb. Please add a bug = report > if you find some time, so I won't forget to integrate this in cvs > tonight. > > -- S=E9bastien. > > > Index: PyModel.py > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D > RCS file: /cvsroot/modeling/ProjectModeling/Modeling/PyModel.py,v > retrieving revision 1.6 > diff -u -r1.6 PyModel.py > --- PyModel.py 30 Aug 2003 12:55:05 -0000 1.6 > +++ PyModel.py 13 Nov 2003 09:30:13 -0000 > @@ -895,7 +895,8 @@ > > # Relationships > toOne_kw=3D{} ; toMany_kw=3D{} > - for k in =20 > ('delete','isClassProperty','joinSemantic','displayLabel','doc'): > + for k in =20 > ('delete','isClassProperty','joinSemantic','displayLabel','doc', > + 'multiplicity'): > toOne_kw[k]=3Dgetattr(self, k)[0] > toMany_kw[k]=3Dgetattr(self, k)[1] > toOne_kw['src']=3DsrcAtt.name ; toOne_kw['dst']=3DdstAtt.name > > Mario Ruggier <ma...@ru...> wrote: >> Hi, >> >> I have associations where a row of one entity should >> always be related to 1 and only 1 row of another entity, >> like so: >> >> model.entities =3D [ >> Entity('A', ...), >> Entity('B', ...), >> ] >> >> model.associations=3D[ >> # A is always related to a B >> Association('A','B', >> relations=3D['b','as'], >> multiplicity=3D[ [1,1], [0,None] ], >> delete=3D['nullify','deny'], >> keys=3D['fkBId','id'], >> ), >> ] >> >> However, if i create a row A and not relate it to any B, >> saveChanges on the EC is successful, and the "fkBId" >> value is NULL (running this with SQLite). I was expecting >> that the framework will will throw up on this. >> Am I misunderstanding something here? >> >> Cheers, mario > |
From: Sebastien B. <sbi...@us...> - 2003-11-13 09:33:34
|
Quick answer: you're not misunderstanding anything here, but the pb. is not w/ the validation code (which is tested enough ;), rather w/ the pymodel itself: associations do not set the multiplicity bounds, you can convince yourself with: >>> import AB >>> from Modeling.ModelSet import defaultModelSet >>> defaultModelSet().entityNamed('A').relationshipNamed('b').multiplicityL= owerBound() 0 Try the attached patch, it should solve the pb. Please add a bug report if you find some time, so I won't forget to integrate this in cvs tonight. -- S=E9bastien. Index: PyModel.py =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D RCS file: /cvsroot/modeling/ProjectModeling/Modeling/PyModel.py,v retrieving revision 1.6 diff -u -r1.6 PyModel.py --- PyModel.py 30 Aug 2003 12:55:05 -0000 1.6 +++ PyModel.py 13 Nov 2003 09:30:13 -0000 @@ -895,7 +895,8 @@ =20 # Relationships toOne_kw=3D{} ; toMany_kw=3D{} - for k in ('delete','isClassProperty','joinSemantic','displayLabel','do= c'): + for k in ('delete','isClassProperty','joinSemantic','displayLabel','do= c', + 'multiplicity'): toOne_kw[k]=3Dgetattr(self, k)[0] toMany_kw[k]=3Dgetattr(self, k)[1] toOne_kw['src']=3DsrcAtt.name ; toOne_kw['dst']=3DdstAtt.name Mario Ruggier <ma...@ru...> wrote: > Hi, >=20 > I have associations where a row of one entity should > always be related to 1 and only 1 row of another entity, > like so: >=20 > model.entities =3D [ > Entity('A', ...), > Entity('B', ...), > ] >=20 > model.associations=3D[ > # A is always related to a B > Association('A','B', > relations=3D['b','as'], > multiplicity=3D[ [1,1], [0,None] ], > delete=3D['nullify','deny'], > keys=3D['fkBId','id'], > ), > ] >=20 > However, if i create a row A and not relate it to any B, > saveChanges on the EC is successful, and the "fkBId" > value is NULL (running this with SQLite). I was expecting > that the framework will will throw up on this. > Am I misunderstanding something here? >=20 > Cheers, mario |
From: Mario R. <ma...@ru...> - 2003-11-13 08:18:18
|
Hi, I have associations where a row of one entity should always be related to 1 and only 1 row of another entity, like so: model.entities = [ Entity('A', ...), Entity('B', ...), ] model.associations=[ # A is always related to a B Association('A','B', relations=['b','as'], multiplicity=[ [1,1], [0,None] ], delete=['nullify','deny'], keys=['fkBId','id'], ), ] However, if i create a row A and not relate it to any B, saveChanges on the EC is successful, and the "fkBId" value is NULL (running this with SQLite). I was expecting that the framework will will throw up on this. Am I misunderstanding something here? Cheers, mario |
From: Mario R. <ma...@ru...> - 2003-11-12 15:24:31
|
Hi, I have applied this 2nd patch, and the code that was previously failing does not fail anymore (python 2.2, OS X 10.2.8). Thanks! mario > Sorry, I posted too quickly: the 1st patch solved the circular-import > problem, but broke the generated code. > > The 2nd patch works as expected --at least it now passes all tests for > python code generation (tests/test_generate_python_code.sh). You'll =20= > find > it at: > https://sf.net/tracker/=20 > index.php?func=3Ddetail&aid=3D839231&group_id=3D58935&atid=3D489335 > > If you already applied the first patch, revert it then apply the 2nd > one. > > -- S=E9bastien. > > Sebastien Bigaret <sbi...@us...> wrote: >> Mario Ruggier <ma...@ru...> wrote: >>> Hello Seb, >>>> Can you confirm that you used the '-B'/--base generation scheme? = The >>>> -C/compact scheme does not suffer from this as far as I can see. >>> >>> Yes, i use the --base scheme. Sorry I forgot to mention it before, =20= >>> as for >>> me this is hidden inside a little custom script that i use to =20 >>> generate >>> the package. >> >> Ok. >> >>> OK. I have filed this as bug 839231. >> >> Thanks. I've just attached a patch to this bug report; you'll need =20= >> to >> patch your local copy and reinstall the framework (templates need to =20= >> be >> recompiled w/ cheetah-compile). Hopefully this solves the problem = --at >> least that's what I see. I still need to redesign some tests so that >> this can be detected in the future, then I'll probably add it to the =20= >> cvs >> trunk if you confirm that this solves the problem on your side as =20 >> well, >> whatever order you use in the import-sequence. >> >> Thanks for reporting. FYI this was due to circular imports induced =20= >> by >> useless imports in generated MDL/__init__.py. These imports are now >> done, when necessary, in the dedicated .py modules. >> >> -- S=E9bastien.= |
From: Sebastien B. <sbi...@us...> - 2003-11-11 22:31:16
|
<luk...@po...> writes: > Hi >=20 > First, thanks to you Sebastien for quick and precise response about > "fetchSQL". >=20 > And I've got another problem: > Why there are no semicolons after every SQL expression generated by > mdl_generate_DB_schema.py? In "quick overview" example they are. I use > PostgreSQL and there the semicolons are required. After few recreations of > my database queries I'm tired with manually inserting this characters. As= I > remember Oracle also requires them ( but MySQL doesn't). [...] Okay, there's two things, in fact. The generated SQL statements are w/o any semi-colons. Now you make me notice that there is a problem on the "quick overview" page: the line that says: << Or create the database directly: shell> mdl_generate_DB_schema.py -c -C \ --admin-dsn=3D"localhost:template1:postgres:" sample_pymodel.py >> Should say: << shell> mdl_generate_DB_schema.py -C \ --admin-dsn=3D"localhost:template1:postgres:" sample_pymodel.py >> --> without the '-c' (=3D=3D --stdout), this command issues the sql statements directly to the db, without you having to copy-paste them within the db cmdline (I've just corrected that, thanks). That's why it needs the --admin-dsn option. > I generate sql with mdl_generate_DB_schema.py and I don't get semicolons.= Is > it caused by my shortage of knowledge how to get the semicolons or it is > some author's oversight? If it is my fault please give me some piece of > advice. Else maybe in the future releases some additional parameter to the > mdl_generate_DB_schema.py script could be added? For example: > mdl_generate_DB_schema.py -m > With -m the sql expressions would be generated with semicolons at the end, > else and default - without them. That's definitely not a lack of knowledge. In fact, this was reported one+ month ago by Erny, check this thread: https://sourceforge.net/mailarchive/forum.php?thread_id=3D3140798&forum_id= =3D10674 (this discussion also exposes some other reasons why there is no semi-colon after sql statements generated by the framework). You'll find the related patch at: https://sourceforge.net/tracker/index.php?func=3Ddetail&aid=3D812708&group_= id=3D58935&atid=3D489338 With this patch, the sql statements generated by the script 'mdl_generate_DB_schema.py -c' have a semi-colon at their end by default. Use option -e/--end-with to change that. Now you now why I want to make a release in the coming days: I've been ''distracted'' too long ;) BTW: I *never* close a bug ticket or a RFE before the correction/patch is integrated in a released version, so you'll always be able to find the latest fix on the bugs- & RFE- pages without having to use CVS. This is probably something I should write somewhere in clear... > SB> I'll also be pleased to hear from your own > SB> application, at least of the aggregations you're thinking about when > SB> asking this (if you can disclose): it always help to learn about the > SB> context in which feature requests raises. >=20 > Of course. Actually I'm learning Modeling Framework and trying to use it = in > my application (bussines-portal in Zope(Plone)). As you see I've got many > problems with it :-) After the scheme of the database and queries will ha= ve > been completed I'll send you some description and 'aggregaton queries from > the real life' (I think that I'll do it outside the mailing list) That's fine, I can wait until then! However, do I understand you right that you're about to test integration of MDL within plone products, right? I've not played w/ Plone for a while, and I'm quite interested in hearing from problems and progress in general. Maybe this could be a good start for a tutorial, so if you're willing to and have some time maybe we could collaborate on such a tutorial --just let me know. -- S=E9bastien. |
From: <luk...@po...> - 2003-11-11 20:52:59
|
Hi First, thanks to you Sebastien for quick and precise response about "fetchSQL". And I've got another problem: Why there are no semicolons after every SQL expression generated by mdl_generate_DB_schema.py? In "quick overview" example they are. I use PostgreSQL and there the semicolons are required. After few recreations o= f my database queries I'm tired with manually inserting this characters. As= I remember Oracle also requires them ( but MySQL doesn't). I generate sql with mdl_generate_DB_schema.py and I don't get semicolons.= Is it caused by my shortage of knowledge how to get the semicolons or it is some author's oversight? If it is my fault please give me some piece of advice. Else maybe in the future releases some additional parameter to th= e mdl_generate_DB_schema.py script could be added? For example: mdl_generate_DB_schema.py -m With -m the sql expressions would be generated with semicolons at the end= , else and default - without them. SB> I'll also be pleased to hear from your own SB> application, at least of the aggregations you're thinking about when SB> asking this (if you can disclose): it always help to learn about the SB> context in which feature requests raises. Of course. Actually I'm learning Modeling Framework and trying to use it = in my application (bussines-portal in Zope(Plone)). As you see I've got many problems with it :-) After the scheme of the database and queries will ha= ve been completed I'll send you some description and 'aggregaton queries fro= m the real life' (I think that I'll do it outside the mailing list) ******************************** * =A3ukasz =A3akomy * Goodwill Internet Factory * * luk...@gi... ******************************** |
From: Sebastien B. <sbi...@us...> - 2003-11-11 17:36:16
|
Hi, <luk...@po...> wrote: [...] SB> Your voice has been heard. However, this won't happen in the coming SB> days, for sure. Would a integrated fetchSQL() make you happy in the SB> meantime? [...] >=20 > Yes, but I've got the latest version (I think so) 0.9-pre-15 and there is= n't > anything like "fetchSQL". Is this "meantime", you've mentioned is present= or > a rather near or far future? > Is there a possibility to run now any query (with aggregations, group by's > etc.) in Modeling framework? If is, could you suggest how to do it? The > nicest way would be a simple piece of Python code, but some links to manu= als > or another sources of information are also good. Sorry for not having been any clearer: yes, I meant that this could be added in the next release. The next release is planned at the end of the week, probably. Now that I'm back and convalescing I guess it's time to make things happen again ;) Back on the subject, yes, there is a possibility to run any query you want w/ the current release, and previous ones as well. The way it can be done is exposed in tests' test_EditingContext_Global.py, method test_999_customSQLQuery(). However, this is unfinished --I've realized that something more needs to be done. I'm including at the end of the mail method fetchSQL() which demonstrates how this can be done, and that you can try as-is with the following examples. Example of use (using test-model AuthorBooks): >>> from Modeling.EditingContext import EditingContext >>> from Modeling import ModelSet >>> import AuthorBooks, pprint >>> ec=3DEditingContext() >>> model=3DModelSet.defaultModelSet().modelNamed('AuthorBooks') >>> sql=3D"select avg(age), sum(age) from WRITER" >>> attrs=3D["average_age", "sum_age"] >>> pprint.pprint(fetchSQL(ec, model, sql, attrs)) [{'average_age': 204.66666666666666, 'sum_age': 614L}] >>> sql=3D"select avg(age), sum(age), last_name from WRITER GROUP BY(last_n= ame)" >>> attrs=3D["average(age)", "sum(age)", "Last name"] >>> pprint.pprint(fetchSQL(ec, model, sql, attrs)) [{'Last name': 'Cleese', 'average(age)': 24.0, 'sum(age)': 24L}, {'Last name': 'Dard', 'average(age)': 82.0, 'sum(age)': 82L}, {'Last name': 'Rabelais', 'average(age)': 508.0, 'sum(age)': 508L}] Why do we need a model? To be sure that we get through the right DBContext down to the database. Last comment: when aggregating, sometimes you just get aggregates, sometimes you also get informations on real objects that you might be interested in retrieving as such (I mean, as real objects). Here is an example: let's fetch those writers whose books have an average price less the 4.5: [ NB: I changed the default test db with: update book set price=3D2.3 where id=3D1; update book set price=3D3.3 where id=3D2; update book set price=3D8.7 where id=3D3; update book set price=3D1.1 where id=3D4; ] >>> sql=3D"SELECT t0.id, t0.last_name, AVG(t1.price) FROM WRITER t0 INNER J= OIN BOOK t1 ON t0.id=3Dt1.fk_writer_id GROUP BY t0.id, t0.last_name HAVING = AVG(t1.price)<4.5" >>> attrs=3D["id", "Author's last name", "Average price"] >>> result=3DfetchSQL(ec, model, sql, attrs) >>> pprint.pprint(result) [{"Author's last name": 'Rabelais', 'Average price': 2.2999999999999998, 'id': 2}, {"Author's last name": 'Dard', 'Average price': 4.3666666666666671, 'id': = 3}] --> Now, if you need the real objects --the corresponding writers--, simply get them from the raw row (this topic is also discussed here, from a different point of view however: http://modeling.sf.net/UserGuide/ec-fetch-raw-rows.html) >>> authors=3D[ec.faultForRawRow(r, "Writer") for r in result] >>> pprint.pprint([{a.getLastName():a} for a in authors]) [{'Rabelais': <Writer.Writer instance at 0x84f3114>}, {'Dard': <Writer.Writer instance at 0x8545a6c>}] In fact, you can turn any dictionary into real objects using ec.faultForRawRow() at the only condition that the PKs for the entity is included in the dictionary --that's why WRITER.id was included in the result set here. I hope this could fit your requirements. I'll probably add such a method to EditingContext for the next release, or at least add something liek this in the documentation. I'll also be pleased to hear from your own application, at least of the aggregations you're thinking about when asking this (if you can disclose): it always help to learn about the context in which feature requests raises. And to all: if you have any specific requirements, comments etc. about this, it's probably the time to speak ;) -- S=E9bastien. ------------------------------------------------------------------------ def fetchSQL(ec, model, sql, attributeNames): """A method demonstrating how to fetch using any sql statement within the MDL framework. Parameters: model -- the model related to the db one wants to fetch data from sql -- a valid sql expression attributeNames -- the name to give to each column in the result set, supplied in the order in which they are fetched Returns: a sequence of dictionaries, mapping attributes'names to the fetched values """ class FakeAttr: def __init__(self, name): self._name=3Dname def name(self): return self._name =20=20 attrs=3D[FakeAttr(n) for n in attributeNames] from Modeling import DatabaseContext dbContext=3DDatabaseContext.registeredDatabaseContextForModel(model, ec) adaptorChannel=3DdbContext.availableChannel().adaptorChannel() sqlExpr=3DadaptorChannel.adaptorContext().adaptor().expressionClass()() sqlExpr.setStatement(sql) adaptorChannel.setAttributesToFetch(attrs) adaptorChannel.adaptorContext().beginTransaction() res=3D[] try: adaptorChannel.evaluateExpression(sqlExpr) row=3DadaptorChannel.fetchRow() while row: res.append(row) row=3DadaptorChannel.fetchRow() =20=20=20=20=20=20 adaptorChannel.cancelFetch() finally: adaptorChannel.adaptorContext().rollbackTransaction() return res ------------------------------------------------------------------------ |
From: <luk...@po...> - 2003-11-11 16:09:12
|
Hi ---Original Message----- From: mod...@li... [mailto:mod...@li...]On Behalf Of Sebastien Bigaret Sent: Monday, November 10, 2003 1:17 PM To: luk...@po... Cc: Modeling Mailinglist Subject: Re: [Modeling-users] 1. Permission denied during SELECT 2. Aggregations [...] Your voice has been heard. However, this won't happen in the coming days, for sure. Would a integrated fetchSQL() make you happy in the meantime? [...] Yes, but I've got the latest version (I think so) 0.9-pre-15 and there isn't anything like "fetchSQL". Is this "meantime", you've mentioned is present or a rather near or far future? Is there a possibility to run now any query (with aggregations, group by's etc.) in Modeling framework? If is, could you suggest how to do it? The nicest way would be a simple piece of Python code, but some links to manuals or another sources of information are also good. ******************************** * Lukasz Lakomy * Goodwill Internet Factory * * luk...@gi... ******************************** |
From: Sebastien B. <sbi...@us...> - 2003-11-10 15:44:02
|
Sorry, I posted too quickly: the 1st patch solved the circular-import problem, but broke the generated code. The 2nd patch works as expected --at least it now passes all tests for python code generation (tests/test_generate_python_code.sh). You'll find it at: https://sf.net/tracker/index.php?func=3Ddetail&aid=3D839231&group_id=3D5893= 5&atid=3D489335 If you already applied the first patch, revert it then apply the 2nd one. -- S=E9bastien. Sebastien Bigaret <sbi...@us...> wrote: > Mario Ruggier <ma...@ru...> wrote: > > Hello Seb, > > > Can you confirm that you used the '-B'/--base generation scheme? The > > > -C/compact scheme does not suffer from this as far as I can see. > >=20 > > Yes, i use the --base scheme. Sorry I forgot to mention it before, as f= or > > me this is hidden inside a little custom script that i use to generate > > the package. >=20 > Ok. >=20 > > OK. I have filed this as bug 839231. >=20 > Thanks. I've just attached a patch to this bug report; you'll need to > patch your local copy and reinstall the framework (templates need to be > recompiled w/ cheetah-compile). Hopefully this solves the problem --at > least that's what I see. I still need to redesign some tests so that > this can be detected in the future, then I'll probably add it to the cvs > trunk if you confirm that this solves the problem on your side as well, > whatever order you use in the import-sequence. >=20 > Thanks for reporting. FYI this was due to circular imports induced by > useless imports in generated MDL/__init__.py. These imports are now > done, when necessary, in the dedicated .py modules. >=20 > -- S=E9bastien. |
From: Yannick G. <yan...@sa...> - 2003-11-10 15:37:56
|
=2D----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On November 10, 2003 10:32 am, Yannick Gingras wrote: > you just need to assign to a variable and it pass : > > out =3D ''' > if toTired: > sleep(random()) > ''' Ehhhh I needed a siesta too ! Please forget the previous post... ; ) =2D --=20 Yannick Gingras Byte Gardener, Savoir-faire Linux inc. http://www.savoirfairelinux.com/ =2D----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (GNU/Linux) iD8DBQE/r7DRrhy5Fqn/MRARAo0kAJ9/+meeHOhCWrvaZ5qeREYWrmoY+wCfax8U 7wsq0q52sIZKtDcrCuF067A=3D =3DIhb0 =2D----END PGP SIGNATURE----- |
From: Yannick G. <yan...@sa...> - 2003-11-10 15:32:11
|
=2D----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 On November 10, 2003 10:00 am, Mario Ruggier wrote: > ooops, sorry to bother everyone with this message -- I should > have better done to have a siesta instead! (Commenting list items > using ''' is invalid code, and list items that look like python blocks > are still list items ;-\ ) you just need to assign to a variable and it pass :=20 out =3D ''' if toTired: sleep(random()) ''' =2D --=20 Yannick Gingras Byte Gardener, Savoir-faire Linux inc. http://www.savoirfairelinux.com/ =2D----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (GNU/Linux) iD8DBQE/r694rhy5Fqn/MRARAgkeAJkB8uXg6tMmG7nOE4MaqzdKX1mzeQCdHkqt ESXgo5ucicE/PSxhhX8SNa0=3D =3DK8je =2D----END PGP SIGNATURE----- |
From: Mario R. <ma...@ru...> - 2003-11-10 15:00:29
|
ooops, sorry to bother everyone with this message -- I should have better done to have a siesta instead! (Commenting list items using ''' is invalid code, and list items that look like python blocks are still list items ;-\ ) mario > Hi, > > another little snag -- if, while developing a pymodel, I comment > out an entity or an assoc using triple quotes, for example: > > model.entities = [ > Entity('One', ... ), > ''' > Entity('Two', ... ), > ''' > Entity('Three', ... ), > ] > > then validation of the model fails with: > > Loading the model... > Serious: couldn't load the model > exceptions.ValueError > Unable to handle python file <file> > Reason: exception raised: > Traceback (most recent call last): > File "/usr/lib/python2.2/site-packages/Modeling/Model.py", line 158, > in loadModel > module=imp.load_module(modulename,file,pathname,description) > File "<string>", line 129 > Entity('Three', > ^ > SyntaxError: invalid syntax > > If I use # instead, it works fine. |
From: Sebastien B. <sbi...@us...> - 2003-11-10 14:32:20
|
Mario Ruggier <ma...@ru...> wrote: > Hello Seb, > > Can you confirm that you used the '-B'/--base generation scheme? The > > -C/compact scheme does not suffer from this as far as I can see. >=20 > Yes, i use the --base scheme. Sorry I forgot to mention it before, as for > me this is hidden inside a little custom script that i use to generate > the package. Ok. > OK. I have filed this as bug 839231. Thanks. I've just attached a patch to this bug report; you'll need to patch your local copy and reinstall the framework (templates need to be recompiled w/ cheetah-compile). Hopefully this solves the problem --at least that's what I see. I still need to redesign some tests so that this can be detected in the future, then I'll probably add it to the cvs trunk if you confirm that this solves the problem on your side as well, whatever order you use in the import-sequence. Thanks for reporting. FYI this was due to circular imports induced by useless imports in generated MDL/__init__.py. These imports are now done, when necessary, in the dedicated .py modules. -- S=E9bastien. |
From: Mario R. <ma...@ru...> - 2003-11-10 14:07:16
|
Hi, another little snag -- if, while developing a pymodel, I comment out an entity or an assoc using triple quotes, for example: model.entities = [ Entity('One', ... ), ''' Entity('Two', ... ), ''' Entity('Three', ... ), ] then validation of the model fails with: Loading the model... Serious: couldn't load the model exceptions.ValueError Unable to handle python file <file> Reason: exception raised: Traceback (most recent call last): File "/usr/lib/python2.2/site-packages/Modeling/Model.py", line 158, in loadModel module=imp.load_module(modulename,file,pathname,description) File "<string>", line 129 Entity('Three', ^ SyntaxError: invalid syntax If I use # instead, it works fine. Shall I create a bug report for this? mario |
From: Mario R. <ma...@ru...> - 2003-11-10 13:54:58
|
Hello Seb, thanks for the quick reply, and solution! > Hi Mario, > > Okay, got it: this happens whenever you import a class with=20 > sub-classes at > first. Current solution is: first import a class without sub-classes=20= > :/ > > Can you confirm that you used the '-B'/--base generation scheme? The > -C/compact scheme does not suffer from this as far as I can see. Yes, i use the --base scheme. Sorry I forgot to mention it before, as=20 for me this is hidden inside a little custom script that i use to generate the package. > Sorry, this is definitely a bug, and this is confusing indeed. I'm > gonna review the python generation process and post here when this = is > corrected. If you find some time, could you fill in a bug report? OK. I have filed this as bug 839231. Thanks! mario > -- S=E9bastien. |
From: Sebastien B. <sbi...@us...> - 2003-11-10 13:35:14
|
Hi Mario, Okay, got it: this happens whenever you import a class with sub-classes at first. Current solution is: first import a class without sub-classes :/ Can you confirm that you used the '-B'/--base generation scheme? The -C/compact scheme does not suffer from this as far as I can see. Sorry, this is definitely a bug, and this is confusing indeed. I'm gonna review the python generation process and post here when this is corrected. If you find some time, could you fill in a bug report? -- S=E9bastien. Mario Ruggier <ma...@ru...> wrote: > Hi all, >=20 > I have been surprised with an ImportError ("cannot import name <CustomCla= ss>") > that occurs only for some custom object Classes. >=20 > I have traced it down to the order that the imports are declared > in the module that uses the model. In my particular case, I have > the following pymodel (sketch): >=20 > model.entities =3D [ > Entity('A_1', ...), > Entity('A_2', ...), > Entity('A_2sub', parent=3D'A_2' ...), > Entity('B_1', ...), > Entity('B_1sub', parent=3D'B_1', ...), > ] >=20 > model.associations=3D[ > Association('A_2','A_1', ... ), > Association('B_1','B_1sub', ...), > ] >=20 > In the module that uses the model, if I import in the order: >=20 > from pympack.B_1 import B_1 > from pympack.B_1sub import B_1sub > from pympack.A_1 import A_1 > from pympack.A_2 import A_2 > from pympack.A_2sub import A_2sub >=20 > I get the ImportError: cannot import name B_1 > However, all works fine if I change the import order to: >=20 > from pympack.A_1 import A_1 > from pympack.A_2 import A_2 > from pympack.A_2sub import A_2sub > from pympack.B_1 import B_1 > from pympack.B_1sub import B_1sub >=20 > I found this very confusing, especially given also that the > "A" and "B" sets of classes exist in distinct inheritance > hierarchies, and with no relations across the hierarchies. > They just happen to be two distinct models, in the same model! >=20 > Is there something I do not see here, or is this a bug? > Is there a relation, or are there constraints to respect, between > the import order and entity definition order in a model? > (BTW, I am using last CVS version) >=20 > mario |
From: Mario R. <ma...@ru...> - 2003-11-10 12:47:26
|
Hi all, I have been surprised with an ImportError ("cannot import name <CustomClass>") that occurs only for some custom object Classes. I have traced it down to the order that the imports are declared in the module that uses the model. In my particular case, I have the following pymodel (sketch): model.entities = [ Entity('A_1', ...), Entity('A_2', ...), Entity('A_2sub', parent='A_2' ...), Entity('B_1', ...), Entity('B_1sub', parent='B_1', ...), ] model.associations=[ Association('A_2','A_1', ... ), Association('B_1','B_1sub', ...), ] In the module that uses the model, if I import in the order: from pympack.B_1 import B_1 from pympack.B_1sub import B_1sub from pympack.A_1 import A_1 from pympack.A_2 import A_2 from pympack.A_2sub import A_2sub I get the ImportError: cannot import name B_1 However, all works fine if I change the import order to: from pympack.A_1 import A_1 from pympack.A_2 import A_2 from pympack.A_2sub import A_2sub from pympack.B_1 import B_1 from pympack.B_1sub import B_1sub I found this very confusing, especially given also that the "A" and "B" sets of classes exist in distinct inheritance hierarchies, and with no relations across the hierarchies. They just happen to be two distinct models, in the same model! Is there something I do not see here, or is this a bug? Is there a relation, or are there constraints to respect, between the import order and entity definition order in a model? (BTW, I am using last CVS version) mario |
From: Sebastien B. <sbi...@us...> - 2003-11-10 12:17:03
|
Hi, <luk...@po...> wrote: > 1. > I've got some problems under Windows with Modeling and/or PostgreSQL. I = did > exactly like it is said in "quick overview" and I used Persons and Adress= es. > The verifcation and Python object creation was successful, but when I run > script (a bit simplified than in overview): [...] > ec=3DEditingContext() > os.environ['MDL_ENABLE_DATABASE_LOGGING']=3D'1'; > os.environ['MDL_PREFERRED_PYTHON_POSTGRESQL_ADAPTOR']=3D'pypgsql' > # fetch objects > in_london=3Dec.fetch('Person') > [(p.getLastName(), p.getFirstName()) for p in in_london] > except: > print 'errors', > raise; > #------------------------------------ >=20 > i got this error message: >=20 > Traceback (most recent call last): > File "uzycie.py", line 28, in ? > in_london=3Dec.fetch('Person') [...] > "C:\PROGRA~1\Zope2.6.2\bin\Modeling\DatabaseAdaptors\AbstractDBAPI2Adapto= rLa > yer\AbstractDBAPI2AdaptorChannel.py", > line 297, in selectAttributes > raise GeneralAdaptorException, msg > Modeling.Adaptor.GeneralAdaptorException: Couldn't evaluate expression > SELECT t0.ID, t0.FIRST_NAME, t0.LAST_NAME FROM PERSON t0. Reason: > libpq.OperationalError:ERROR: person: permission denied >=20 > I think that isn't because incorrect: username/host/database/password > because they works in PostgreSQL client PSQL and in pyPgSQL (Python > adapter). So what's wrong? I'm a quite advanced databases user and i first > saw acces denied on SELECT after successful connection to the database. The code seems ok --and it's definitely possible that you get an access denied after connection to the db; it is just a matter of privileges the user you're connecting with have. Are you definitely sure that you can *SELECT* w/ this user with 'psql' command-line or raw pypgsql python conn.? The error you get comes from libpq, that's why I'm quite confident in that this is the database itself that rejects the SELECT for that user (BTW the user is logged when connecting to the db w/ MDL_ENABLE_DATABASE_LOGGING set to true) Oh, now I think I remember how this might have happen: did you, by any chance, access the database w/ another user than the one you used to create it (the owner)? By default, postgresql denies the access to the db to any user than the owner (except admin users of course). Try to connect to the db as a db.admin and type: GRANT ALL ON TABLE PERSON to <your_user_name>; (same for table ADDRESS) --then things should go fine. For further informations on pg's privileges, you can refer to http://www.postgresql.org/docs/7.3/interactive/privileges.html http://www.postgresql.org/docs/7.3/static/sql-grant.html > 2. > I also unite with the voice of Ernesto Revilla (Re: Summary objects and > Proxy objects, 2003-06-12 16:56) that extension that allows: aggregations > (sum,min,max...), having's, group by's is ESSENTIAL. Using more advanced > queries, that uses that features, is inpossible now. So I can't use Model= ing > in my application because of it and must use the "pure" pgSQL adapter. Your voice has been heard. However, this won't happen in the coming days, for sure. Would a integrated fetchSQL() make you happy in the meantime? -- S=E9bastien. |
From: <luk...@po...> - 2003-11-10 11:07:19
|
Hi 1. I've got some problems under Windows with Modeling and/or PostgreSQL. I = did exactly like it is said in "quick overview" and I used Persons and Adress= es. The verifcation and Python object creation was successful, but when I run script (a bit simplified than in overview): #------------------------------------ from Sample.Person import Person from Sample.Address import Address from Modeling.EditingContext import EditingContext import sys import os try: ec=3DEditingContext() os.environ['MDL_ENABLE_DATABASE_LOGGING']=3D'1'; os.environ['MDL_PREFERRED_PYTHON_POSTGRESQL_ADAPTOR']=3D'pypgsql' # fetch objects in_london=3Dec.fetch('Person') [(p.getLastName(), p.getFirstName()) for p in in_london] except: print 'errors', raise; #------------------------------------ i got this error message: Traceback (most recent call last): File "uzycie.py", line 28, in ? in_london=3Dec.fetch('Person') File "C:\PROGRA~1\Zope2.6.2\bin\Modeling\EditingContext.py", line 1419,= in fetch return self.objectsWithFetchSpecification(fs) File "C:\PROGRA~1\Zope2.6.2\bin\Modeling\EditingContext.py", line 1302,= in objectsWithFetchSpecification objects=3Dself.parentObjectStore().objectsWithFetchSpecification(fs, = ec) File "C:\PROGRA~1\Zope2.6.2\bin\Modeling\ObjectStoreCoordinator.py", li= ne 434, in objectsWithFetchSpecification return store.objectsWithFetchSpecification(aFetchSpecification, anEditingContext) File "C:\PROGRA~1\Zope2.6.2\bin\Modeling\DatabaseContext.py", line 1764= , in objectsWithFetchSpecification anEditingContext) File "C:\PROGRA~1\Zope2.6.2\bin\Modeling\DatabaseChannel.py", line 394,= in selectObjectsWithFetchSpecification entity) File "C:\PROGRA~1\Zope2.6.2\bin\Modeling\DatabaseAdaptors\AbstractDBAPI2Adapto= rLa yer\AbstractDBAPI2AdaptorChannel.py", line 297, in selectAttributes raise GeneralAdaptorException, msg Modeling.Adaptor.GeneralAdaptorException: Couldn't evaluate expression SELECT t0.ID, t0.FIRST_NAME, t0.LAST_NAME FROM PERSON t0. Reason: libpq.OperationalError:ERROR: person: permission denied I think that isn't because incorrect: username/host/database/password because they works in PostgreSQL client PSQL and in pyPgSQL (Python adapter). So what's wrong? I'm a quite advanced databases user and i firs= t saw acces denied on SELECT after successful connection to the database. 2. I also unite with the voice of Ernesto Revilla (Re: Summary objects and Proxy objects, 2003-06-12 16:56) that extension that allows: aggregations (sum,min,max...), having's, group by's is ESSENTIAL. Using more advanced queries, that uses that features, is inpossible now. So I can't use Model= ing in my application because of it and must use the "pure" pgSQL adapter. ******************************** * =A3ukasz =A3akomy * Goodwill Internet Factory * * luk...@gi... ******************************** |
From: Sebastien B. <sbi...@us...> - 2003-10-28 06:43:42
|
Vladimir <vla...@gu...> wrote: > OK, I'm again here. > Sebastien helped me to install prodacts "ZModelizationTool" and > "ZEditingContextSessioning" but products "ZModelManager" and > "ZClassDescriptionManager" still remain broken. About those broken produc= ts > I've got these error messages from Zope server: [snip] Oh well, you can safely forget about those two products. To quote the README shipped with the ZModeling tarball: << The two other products, ZModelManager and ZClassDescriptionManager are f= or debugging purposes only and should probably not be used unless you're debugging the framework itself. Note that it is possible that they are out-of-sync with the current version of the framework. >> I'm afraid this is actually the case: those two products are now out of sync. w/ the current core ; the fact is that I've not used them for a while, and they probably shouldn't be shipped anymore in the tarball. Sorry for the time lost on that, my fault, I'll probably remove them. -- S=E9bastien. |
From: Vladimir <vla...@gu...> - 2003-10-27 17:53:01
|
OK, I'm again here. Sebastien helped me to install prodacts "ZModelizationTool" and =20 "ZEditingContextSessioning" but products "ZModelManager" and=20 "ZClassDescriptionManager" still remain broken. About those broken=20 products I've got these error messages from Zope server: Import Traceback Traceback (most recent call last): File "C:\Zope262\lib\python\OFS\Application.py", line 522, in import_pr= oduct product=3D__import__(pname, global_dict, global_dict, silly) File "C:\Zope262\lib\python\Products\ZModelManager\__init__.py", line 3= 3, in ? import ZModelManager File "C:\Zope262\lib\python\Products\ZModelManager\ZModelManager.py", l= ine 43, in ? from Interface import verify_class_implementation ImportError: cannot import name verify_class_implementation Import Traceback Traceback (most recent call last): File "C:\Zope262\lib\python\OFS\Application.py", line 522, in import_pr= oduct product=3D__import__(pname, global_dict, global_dict, silly) File "C:\Zope262\lib\python\Products\ZClassDescriptionManager\__init__.= py", line 29, in ? import ZClassDescriptionManager File "C:\Zope262\lib\python\Products\ZClassDescriptionManager\ZClassDes= criptionManager.py", line 42, in ? from Interface import verify_class_implementation ImportError: cannot import name verify_class_implementation So, if somebody knows how to solve this problem.... Regards, Vladimir > Vladimir, > >if you do not mind, I'd prefer if you could mail directly to the mailing= -list >instead of >privately to me, so that others having the same kind of problems in the >future can find some hints in the archives. Thanks! > > BTW: the short answer is: you need egenix mxDateTime. >See the Installation guide at http://modeling.sourceforge.net/ for its u= rl. > > Hope this helps, >-- S=E9bastien. >> Hi, Sebastien, >> I've tried again and the product ZEditingContextSessioning is now=20 >> installed OK. But other products (ZModelizationTool, ZModelManager and >>=20 >> ZClassDescriptionManager) remain broken. I've got this error message=20 >> from Zope: >>=20 >>=20 >> Import Traceback >>=20 >> Traceback (most recent call last): >> File "C:\Zope262\lib\python\OFS\Application.py", line 522, in >> import_product >> product=3D__import__(pname, global_dict, global_dict, silly) >> File "C:\Zope262\lib\python\Products\ZModelizationTool\__init__.py", >> line 28, in ? >> import ZModelizationTool >> File >> "C:\Zope262\lib\python\Products\ZModelizationTool\ZModelizationTool.py= ", >> line 40, in ? >> from Modeling.Entity import Entity >> File "C:\Zope262\lib\python\Modeling\Entity.py", line 37, in ? >> from Attribute import Attribute >> File "C:\Zope262\lib\python\Modeling\Attribute.py", line 58, in ? >> from mx.DateTime import DateTime, DateFrom >> ImportError: No module named mx.DateTime >>=20 >> Is it something wrong with the Zope version? I have Zope-2.6.2 >>=20 >> Regards, >> Vladimir >>=20 >>=20 >>=20 >> Sebastien Bigaret wrote: >>=20 > =20 > >>> > Hi Vladimir, >>> > >>> >Vladimir <vla...@gu...> wrote: >>> > =20 >>> > >> =20 >> >>>> >>Hi to everyone! >>>> >>I'm new to Modeling so I'll need lot of help.... >>>> >>I was looking for a tool in Zope envirenment, which should be able= to >>> =20 >>> >> use > =20 > >>>> >>complex queries on two or more tables in a database. Modeling seem= s >>>> >>interesting and so I decided to try it. >>>> >>Sebastien helped me to install it on windows: >>>> >>=09 >>>> >>http://modeling.sourceforge.net/download/ModelingCore-0.9-pre-15.w= in32.exe >>>> >>http://modeling.sourceforge.net/download/NotificationFramework-0.6= .win32.exe >>>> >>But now I have this problem: How to make it working in Zope >>> =20 >>> >> environment? > =20 > >>>> >>Unfortunately the Modeling installation wizard can not find the >>> =20 >>> >> Zope's > =20 > >>>> >>python installation and by default installs it in other python >>> =20 >>> >> installation > =20 > >>>> >>directory. >>>> >> =20 >>>> >> >>> =20 >>> >>> > >>> >For the MDL-core, you should copy the >>> >lib/python2.1/site-packages/Modeling into your Zope installation, in >>> >lib/python2.1/site-packages/ also. >>> > >>> >For the tools, such as the ZModelizationTool, download and untar the >>> >archive, and move the directories ZModelizationTool/ and >>> >ZEditingContextSessioning/ into Zope's Products directory >>> >(lib/python/Products/). >>> > >>> > In case this does not work, it would help a lot if you could send >> =20 >> >> the > =20 > >>> > error messages written by Zope. >>> > >>> > Now, could you elaborate on what you intend to do w/ Zope & the >> =20 >> >> MDL? > =20 > >>> >For the moment being, the ZModeler and the ZEditingContextSessioning >> =20 >> >> are > =20 > >>> >the only products available for Zope. This means in particular that >> =20 >> >> you > =20 > >>> >won't get a running product out-of-the-box to query your database, >> =20 >> >> based > =20 > >>> >on the model ; you'll need to design your own products for that. We >>> >can discuss this if you want to. >>> > >>> >-- S=E9bastien. >> =20 >> |