Thread: Fwd: Re: [SQLObject] FireBird / Interbase
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: James R. <jcr...@ya...> - 2003-09-27 14:53:49
|
Oops...perhaps it would be helpful to actually include my response :-) --- Ian Sparks <ia...@et...> wrote: > I've been playing with the people.py example under > Firebird 1.0 (and IB 6.01 > with some tweaks to SO) using the Mostly live CVS > tarball from 2 days ago. "Mostly" is an important word here. The initial cut at ib/fb support was done against the .4 release of SO instead of the cvs version <doh!>. That has been corrected but Ian (Bicking) has been buried (I hope I can speak for him here) with other (real?) work, changes and patches. And, as any (good) steward of an OS project, he'd prefer to review changes before dumping them in. With that in mind, see my responses below. > Observations : > > * people.py defines a SQLObject class Role. ROLE is > an IB/Firebird reserved > word. Changing the role references to userRole > worked for me. True. I also wrestle with the test suite for similar reasons. Name and names are reserved words in fb, but are used frequently as field and class/table names in test.py > * I'm not sure the supportTransactions setting is > right for Firebird : > > class FirebirdConnection(DBAPI): > supportTransactions = False > > should be : > > class FirebirdConnection(DBAPI): > supportTransactions = True > > at least, it does for me if I want any commits to > occur. Right again. And I would add that one should use the explicit Transaction if using pooled connections in a threaded application. If not, you risk facing the infamous "phantom record" when you add or change a record. BTW, supportTransation wasn't in .4 ;-) If someone can point me in the right direction for turning on 'auto-commit' for kinterbasdb, I'd be eternally greatful. The setAutoCommit (required when supportTransations = True) in the patched version does nothing. > * The current Firebird support doesn't have anything > for Enum fields which are part of the people.py tests. Here is something > that will at least work : > > Col.py : > > class SOEnumCol(SOCol): > def _firebirdType(self): > length = max(map(len, self.enumValues)) > return "VARCHAR(%i)" % (length,) > > In general the postgresql approach to adding check > constraints isn't going > to work for Firebird. It appears you can't do : > > CREATE TABLE FRED ( > COL1 VARCHAR(10) CHECK (VALUE IN > ('one','two','three')) NOT NULL > ) There are 2 problems here: - the placement of the "NOT NULL" clause. FB is VERY picky about the order of constaints in a create table statement. - the referenced column in the check constraint must be explicitly given. This should work (which is what the SOEnumCol generates for postgres...the pending version of Col.py simply calls self._postgresType()): CREATE TABLE FRED ( COL1 VARCHAR(10) NOT NULL CHECK (COL1 IN ('one', 'two', 'three')) ) as does this: alter table fred add check (col1 in ('one','two','three')); > * It might be useful to allow additional Indexes to > be created for a table. > So : <snip> Nice feature. Although, in my experience, most db optimizations are done after the fact...when the "great dba in the sky" does his cypherin' (wink to Jethro from the Beverly Hillbillies) on which fields will most greatly benefit from index additions. James __________________________________ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com |
From: Ian S. <ia...@et...> - 2003-09-27 22:19:09
|
"James Ralston" <jcr...@ya...> wrote in message news:200...@we...... > "Mostly" is an important word here. The initial cut > at ib/fb support was done against the .4 release of SO > instead of the cvs version <doh!>. That has been > corrected but Ian (Bicking) has been buried (I hope It doesn't look like your changes are in the SF CVS - are you keeping them somewhere else? Accessible? I'd rather not have to find all the known issues myself. > Nice feature. Although, in my experience, most db > optimizations are done after the fact...when the > "great dba in the sky" does his cypherin' (wink to > Jethro from the Beverly Hillbillies) on which fields > will most greatly benefit from index additions. True, but once that has happened you really want to feed that information back into the model. At least I do. I don't know of a way to extract the Query Plan from kinterbasdb but if this exists then debug mode could extract the plan, do a count of NATURAL and give you a list of queries that require optimization. This at least makes the DBA's job easier. Most of us can't afford to have a truly great DBA on staff but with the help of PLAN we can add indexes to remove all the natural joins and at least make them much more efficient. Thanks James, Firebird support is already usable. If I can help in any way to improve the FB support I'd be glad to. - Ian Sparks. |
From: Ian B. <ia...@co...> - 2003-09-27 23:03:49
|
On Saturday, September 27, 2003, at 05:25 PM, Ian Sparks wrote: > "James Ralston" <jcr...@ya...> wrote in message > news:200...@we...... > >> "Mostly" is an important word here. The initial cut >> at ib/fb support was done against the .4 release of SO >> instead of the cvs version <doh!>. That has been >> corrected but Ian (Bicking) has been buried (I hope > > It doesn't look like your changes are in the SF CVS - are you keeping > them > somewhere else? Accessible? I'd rather not have to find all the known > issues > myself. That's my fault actually, I've been sitting on those changes for much too long. I'm just at this minute testing some of the changes for Firebird, after finally having gotten it set up to do testing. Runs tests very slowly... I imagine it must be slow at table creation and dropping, which the tests do a lot of. Anyway, I'll post a followup when I have it applied and uploaded. Ian |