I am attempting to get MiddleKit working with PostgreSQL,
but I am having problems with Polymorphism in the Videos
database example that I don't beleive is related to my
porting.  If you try to reference a subclass of an abstract
object, the database query fails because it tries to use
the name of the abstract class in the query clause on the
real class.

Spcifically:

Python 2.1 (#1, Jun 28 2001, 13:54:34)
[GCC 2.96 20000731 (Red Hat Linux 7.1 2.96-81)] on linux2
Type "copyright", "credits" or "license" for more information.
 >>> from MiddleKit.Run.PostgreSQLObjectStore import PostgreSQLObjectStore
 >>> store = PostgreSQLObjectStore(user='me', password='mypasswd', 
host='myhost:1234')
 >>> store.readModelFileNamed("Videos")
SQL 0001. 2001-07-24 19:42:40 select id, name from _MKClassIds;
 >>>
 >>> from Role import Role
 >>> roles = store.fetchObjectsOfClass(Role)
SQL 0002. 2001-07-24 19:42:44 select roleId,videoId,karacter,personId from Role ;
 >>> roles[0].video()
SQL 0003. 2001-07-24 19:42:44 select movieId,title,year,rating from Movie 
where videoId=1;
Traceback (most recent call last):
   File "<stdin>", line 1, in ?
   File "GeneratedPy/GenRole.py", line 26, in video
     self.__dict__['_video'] = self._mk_store.fetchObjRef(self._video)
   File "/wb/people/greg/projects/Webware/MiddleKit/Run/SQLObjectStore.py", 
line 341, in fetchObjRef
     objs = self.fetchObjectsOfClass(klass, clauses)
   File "/wb/people/greg/projects/Webware/MiddleKit/Run/SQLObjectStore.py", 
line 206, in fetchObjectsOfClass
     deepObjs.extend(self.fetchObjectsOfClass(subklass, clauses, isDeep, 
serialNum))
   File "/wb/people/greg/projects/Webware/MiddleKit/Run/SQLObjectStore.py", 
line 219, in fetchObjectsOfClass
     conn, cur = self.executeSQL('select %s from %s %s;' % (
   File "/wb/people/greg/projects/Webware/MiddleKit/Run/SQLObjectStore.py", 
line 271, in executeSQL
     cur.execute(sql.strip())
   File "/wb/apps/freeware/lib/python2.1/site-packages/pgdb.py", line 189, in 
execute
     self.executemany(operation, (params,))
   File "/wb/apps/freeware/lib/python2.1/site-packages/pgdb.py", line 208, in 
executemany
     raise DatabaseError, "error '%s' in '%s'" % ( msg, sql )
pgdb.DatabaseError: error 'ERROR:  Attribute 'videoid' not found
' in 'select movieId,title,year,rating from Movie where videoId=1;'
 >>>



Note the failed query:
     select movieId,title,year,rating from Movie where videoId=1;

It's trying the clause "where videoId=1" instead of "where movieId=1"
when it trys to load all of the sub-classes in fetchObjectsOfClass().

These seems like basic functionality using the provided example.
Has anyone had success with the MiddleKit example, even with MySQL?

Greg


_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
http://lists.sourceforge.net/lists/listinfo/webware-discuss

Reply via email to