From: Winston W. <st...@ob...> - 2004-08-29 21:24:36
|
I'm trying to get Jason's postgres support working, and I run into a =20 little problem. It seems the sqlIdname() method doesn't appear in =20 MiddleKit.Core.Klass. See the code and stack trace below. I had =20 noticed a similar sqlIdName() method in the Postgres support from =20 before Jason checked in his new files. Could it be that one file was =20= not checked in? -winston --- Here is the code I was running: from mx.DateTime import DateFrom from MiddleKit.Run.PostgreSQLObjectStore import PostgreSQLObjectStore from db.User import User if __name__=3D=3D'__main__': # Set up the store store =3D PostgreSQLObjectStore() store.readModelFileNamed('lib/db/mentor') =09 u =3D User() u.setNameLast('wolff') u.setNameFirst('winston') =09 store.addObject( u ) store.saveChanges() --- Here is the stack trace: SQL 0001. 2004-08-29 14:14:19 select id, name from _MKClassIds; Traceback (most recent call last): File "bee.py", line 26, in ? store.saveChanges() File =20 "/Users/winstonw/svn/Projects/python/extern/WebWare-CVS/webware/=20 MiddleKit/Run/PostgreSQLObjectStore.py", line 78, in saveChanges SQLObjectStore.saveChanges(self) File "MiddleKit/Run/ObjectStore.py", line 310, in saveChanges File =20 "/Users/winstonw/svn/Projects/python/extern/WebWare-CVS/webware/=20 MiddleKit/Run/SQLObjectStore.py", line 213, in commitInserts self._insertObject(object, unknownSerialNums) File =20 "/Users/winstonw/svn/Projects/python/extern/WebWare-CVS/webware/=20 MiddleKit/Run/PostgreSQLObjectStore.py", line 49, in _insertObject seqname =3D "%s_%s_seq" % (object.klass().name(), =20 object.klass().sqlIdName()) AttributeError: Klass instance has no attribute 'sqlIdName' On 29-Aug-2004, at 8:36 AM, Winston WOLFF wrote: > Jason and Diogo- > > I want to thank you also for this PostgreSQL support. I just happen =20= > to be starting to play with middle kit, the timing of this thread is =20= > uncanny. Perhaps I'll work on datetime support since I will probably =20= > need it. > > -winston > >> From: Jason Hildebrand <jason@pe...> > <msg.gif> Re: MiddleKit PostgreSQL support =A0 >> 2004-08-26 18:31 >> >> Hi Diogo, >> >> Thanks for asking. Last year I did some work with PostgreSQL and >> MiddleKit, and had lots of local changes which I"ve been meaning to =20= >> commit. >> Specifically, I made it so that for each table, a corresponding =20 >> postgres >> sequence is created, which is used for getting the next serial = number >> when an object is added to the data store. There were a bunch of =20= >> other >> changes, too, but that was the most significant. >> >> There are several different python bindings for PostgreSQL, but =20 >> AFAICT >> there are only two which are maintained: the bindings included with >> PostgreSQL itself, and psycopg. I can"t remember exactly why, but =20= >> at that >> time I had some problems with PostgreSQL"s bindings, and so I used =20= >> pscyopg. >> >> I"ve just checked in these changes, so please do a fresh CVS =20 >> checkout (it >> may take a few hours to become available on sourceforge"s anon CVS, =20= >> I"m not >> sure) and take a look. Since I haven"t really used it since last =20= >> year, >> there might be a few things which aren"t working any more (due to =20= >> other >> changes in MK), and I think there are a few MK datatypes which still = =20 >> need to >> be implemented for PostgreSQL (i.e. datetime?). >> >> If you improve the support further, please submit patches via =20 >> sourceforge, >> and maybe send me a heads-up, too, so that I notice. :) >> >> peace, >> Jason >> >> >> On Tue, 2004-08-24 at 09:06, Diogo Biazus wrote: >> > Hi People, >> >> > I"ve read some mails about recent patches to make middlekit work =20= >> with >> > pgsql. How can I install and use these patches? >> > Can I help in any way to test or develop it? >> > I"m really in need of the PostgreSQL support, and I"m willing to =20= >> help >> > build it. >> >> > Thanks in advance, >> -- >> Jason D. Hildebrand >> T: 204 775 1212 >> E: jason@pe... > > > |
From: Jason H. <ja...@pe...> - 2004-08-30 03:01:54
|
Hi Winston, Sorry, I left for vacation Thursday evening and checked in that code in a hurry without fully testing it. Several months ago the 'sqlIdName' method was replaced by 'sqlSerialColumnName', and I didn't catch this before committing my code. I've just fixed this in CVS, so you'll just need to do an update to fix this. peace, Jason > I'm trying to get Jason's postgres support working, and I run into a > little problem. It seems the sqlIdname() method doesn't appear in > MiddleKit.Core.Klass. See the code and stack trace below. I had > noticed a similar sqlIdName() method in the Postgres support from > before Jason checked in his new files. Could it be that one file was > not checked in? > > -winston > > --- Here is the code I was running: > > from mx.DateTime import DateFrom > from MiddleKit.Run.PostgreSQLObjectStore import PostgreSQLObjectStore > > from db.User import User > > if __name__=='__main__': > # Set up the store > store = PostgreSQLObjectStore() > store.readModelFileNamed('lib/db/mentor') > > u = User() > u.setNameLast('wolff') > u.setNameFirst('winston') > > store.addObject( u ) > store.saveChanges() > > --- Here is the stack trace: > > SQL 0001. 2004-08-29 14:14:19 select id, name from _MKClassIds; > Traceback (most recent call last): > File "bee.py", line 26, in ? > store.saveChanges() > File > "/Users/winstonw/svn/Projects/python/extern/WebWare-CVS/webware/ > MiddleKit/Run/PostgreSQLObjectStore.py", line 78, in saveChanges > SQLObjectStore.saveChanges(self) > File "MiddleKit/Run/ObjectStore.py", line 310, in saveChanges > File > "/Users/winstonw/svn/Projects/python/extern/WebWare-CVS/webware/ > MiddleKit/Run/SQLObjectStore.py", line 213, in commitInserts > self._insertObject(object, unknownSerialNums) > File > "/Users/winstonw/svn/Projects/python/extern/WebWare-CVS/webware/ > MiddleKit/Run/PostgreSQLObjectStore.py", line 49, in _insertObject > seqname = "%s_%s_seq" % (object.klass().name(), > object.klass().sqlIdName()) > AttributeError: Klass instance has no attribute 'sqlIdName' > > On 29-Aug-2004, at 8:36 AM, Winston WOLFF wrote: > >> Jason and Diogo- >> >> I want to thank you also for this PostgreSQL support. I just happen >> to be starting to play with middle kit, the timing of this thread is >> uncanny. Perhaps I'll work on datetime support since I will probably >> need it. >> >> -winston >> >>> From: Jason Hildebrand <jason@pe...> >> <msg.gif> Re: MiddleKit PostgreSQL support >>> 2004-08-26 18:31 >>> >>> Hi Diogo, >>> >>> Thanks for asking. Last year I did some work with PostgreSQL and >>> MiddleKit, and had lots of local changes which I"ve been meaning to >>> commit. >>> Specifically, I made it so that for each table, a corresponding >>> postgres >>> sequence is created, which is used for getting the next serial number >>> when an object is added to the data store. There were a bunch of >>> other >>> changes, too, but that was the most significant. >>> >>> There are several different python bindings for PostgreSQL, but >>> AFAICT >>> there are only two which are maintained: the bindings included with >>> PostgreSQL itself, and psycopg. I can"t remember exactly why, but >>> at that >>> time I had some problems with PostgreSQL"s bindings, and so I used >>> pscyopg. >>> >>> I"ve just checked in these changes, so please do a fresh CVS >>> checkout (it >>> may take a few hours to become available on sourceforge"s anon CVS, >>> I"m not >>> sure) and take a look. Since I haven"t really used it since last >>> year, >>> there might be a few things which aren"t working any more (due to >>> other >>> changes in MK), and I think there are a few MK datatypes which still >>> need to >>> be implemented for PostgreSQL (i.e. datetime?). >>> >>> If you improve the support further, please submit patches via >>> sourceforge, >>> and maybe send me a heads-up, too, so that I notice. :) >>> >>> peace, >>> Jason >>> >>> >>> On Tue, 2004-08-24 at 09:06, Diogo Biazus wrote: >>> > Hi People, >>> >>> > I"ve read some mails about recent patches to make middlekit work >>> with >>> > pgsql. How can I install and use these patches? >>> > Can I help in any way to test or develop it? >>> > I"m really in need of the PostgreSQL support, and I"m willing to >>> help >>> > build it. >>> >>> > Thanks in advance, >>> -- >>> Jason D. Hildebrand >>> T: 204 775 1212 >>> E: jason@pe... >> >> >> > > > > ------------------------------------------------------- > This SF.Net email is sponsored by BEA Weblogic Workshop > FREE Java Enterprise J2EE developer tools! > Get your free copy of BEA WebLogic Workshop 8.1 today. > http://ads.osdn.com/?ad_idP47&alloc_id808&op=click > _______________________________________________ > Webware-devel mailing list > Web...@li... > https://lists.sourceforge.net/lists/listinfo/webware-devel > > !DSPAM:413248b6260201118715257! > > > |
From: Winston W. <st...@ob...> - 2004-09-02 06:39:43
|
I've found the test cases for Middle Kit. I ran them and I get these results. I know that the Postgres support is not complete, but I don't know how incomplete it is. Does this look about right to you? In order to get these results I did adjust SQLGeneratory.py to write "USE DATABASE" -> "\c DATABASE" as shown below. -winston ------------------------------- RESULTS ------- succeeded MKBasic.mkmodel succeeded MKNone.mkmodel *** FAILED *** MKString.mkmodel *** FAILED *** MKDateTime.mkmodel *** FAILED *** MKEnums.mkmodel *** FAILED *** MKDefaultMinMax.mkmodel succeeded MKTypeValueChecking.mkmodel succeeded MKInheritance.mkmodel succeeded MKInheritanceAbstract.mkmodel *** FAILED *** MKList.mkmodel *** FAILED *** MKObjRef.mkmodel succeeded MKObjRefReuse.mkmodel *** FAILED *** MKDelete.mkmodel *** FAILED *** MKDeleteMark.mkmodel *** FAILED *** MKMultipleStores.mkmodel succeeded MKMultipleThreads.mkmodel succeeded MKModelInh1.mkmodel succeeded MKModelInh2.mkmodel succeeded MKModelInh3.mkmodel skipped MKExcel.mkmodel ---------------- I hacked the generator for the InsertSamples.sql file so it works for PostgreSQL in SQLGenerator.py line 94 like so: # ww - for PostgreSQL file.write('\\c %s;\n\n' % self.sqlDatabaseName()) # file.write('use %s;\n\n' % self.sqlDatabaseName()) |
From: Winston W. <st...@ob...> - 2004-09-02 08:42:21
|
I have some patches to the Postgres files to fix a few of the test cases. It fixes the MKDateTime.mkmodel and MKList.mkmodel tests. Although the middle file is not a proper fix because it will break MySQL and MSSQL. It changes USES to \c which obviously is Postgres specific. -ww --------- % cvs diff Run/PostgreSQLObjectStore.py Design/SQLGenerator.py Design/PostgreSQLSQLGenerator.py Index: Run/PostgreSQLObjectStore.py =================================================================== RCS file: /cvsroot/webware/Webware/MiddleKit/Run/PostgreSQLObjectStore.py,v retrieving revision 1.4 diff -r1.4 PostgreSQLObjectStore.py 124a125 > extend = values.extend 133c134,137 < append(value) --- > if isinstance(value, str): > append(value) > else: > extend(value) # value could be sequence for attrs that require multiple SQL columns Index: Design/SQLGenerator.py =================================================================== RCS file: /cvsroot/webware/Webware/MiddleKit/Design/SQLGenerator.py,v retrieving revision 1.59 diff -r1.59 SQLGenerator.py 97c97,99 < file.write('use %s;\n\n' % self.sqlDatabaseName()) --- > # ww - for PostgreSQL > file.write('\\c %s;\n\n' % self.sqlDatabaseName()) > # file.write('use %s;\n\n' % self.sqlDatabaseName()) Index: Design/PostgreSQLSQLGenerator.py =================================================================== RCS file: /cvsroot/webware/Webware/MiddleKit/Design/PostgreSQLSQLGenerator.py,v retrieving revision 1.3 diff -r1.3 PostgreSQLSQLGenerator.py 139a140,145 > class DateTimeAttr: > > def sqlType(self): > return 'timestamptz' > > |