Re: Unable to fetch

James Laska <[email protected]> Sun, 22 May 2005 10:50:04 -0400
Newsgroups gmane.comp.python.modeling
Message-ID <[email protected]>
Sorry to respond to my own post.

It appears this error was triggered by an incorrect specification of
the 'name' attribute of the <entity>.

Failed with:
  <entity name=3D'prefix_project' externalName=3D'prefix_project'
className=3D'Project'>

Works with:
  <entity name=3D'Project' externalName=3D'prefix_project' className=3D'Pro=
ject'>

Thanks,
James Laska

On 5/22/05, James Laska <[email protected]> wrote:
> Greetings,
>=20
> I am new to the Modeling framework and have been reading the
> UsersGuide and working through examples in the document and in tests/.
>  I am at the stage where I have defined a sample model (xml).  I can
> use that model to generate the python classes and the DB schema.
>=20
> $ find testmdl/ -type f -name "*py"
> testmdl/setup.py
> testmdl/MDL/__init__.py
> testmdl/MDL/Project.py
> testmdl/MDL/model_testmdl.py
> testmdl/__init__.py
> testmdl/Project.py
>=20
> I am also able to insert new values into my tables:
>=20
> >>> from Modeling.EditingContext import EditingContext
> >>> from testmdl.Project import Project
> >>> ec =3D EditingContext()
> >>> p =3D Project()
> >>> p.setTitle("Testing 1 2 3")
> >>> ec.insert(p)
> >>> ec.saveChanges()
>=20
> However, when it comes to ec.fetch() or ec.fetchCount() I continue to
> get a traceback (regardless of whether or not I provide a qualifier):
>=20
> >>> ec.fetchCount('Project')
> Traceback (most recent call last):
>   File "<stdin>", line 1, in ?
>   File "/usr/lib/python2.4/site-packages/Modeling/EditingContext.py",
> line 1259, in fetchCount
>     fs=3DFetchSpecification(entityName, qualifier=3Dqualifier, deepFlag=
=3DisDeep)
>   File "/usr/lib/python2.4/site-packages/Modeling/FetchSpecification.py",
> line 52, in __init__
>     raise ValueError, 'Unable to find a ClassDescription for
> entityName: %s. Is the corresponding model loaded?'%entityName
> ValueError: Unable to find a ClassDescription for entityName: Project.
> Is the corresponding model loaded?
>=20
> I can see that my previous insert(s) were properly INSERTed in to the tab=
le:
>=20
> > select proj_id, proj_title from project;
>=20
>  proj_id |  proj_title
> ---------+---------------
>        1 | First
>        2 | Testing 1 2 3
>=20
> Any thoughts on what I might be missing?  I searched the list archives
> (and google) for the same ValueError but have turned up empty.  I have
> also been poking through FetchSpecification+classDescriptionForName
> but have turned up nothing so far.  I have installed out of a cvs
> checkout as of last week (2005-05-17).
>=20
> Any help or guidance would be appreciated.
>


-------------------------------------------------------
This SF.Net email is sponsored by Oracle Space Sweepstakes
Want to be the first software developer in space?
Enter now for the Oracle Space Sweepstakes!
http://ads.osdn.com/?ad_id=7412&alloc_id=16344&op=click