sqlobject-discuss Mailing List for SQLObject (Page 406)
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
You can subscribe to this list here.
2003 |
Jan
|
Feb
(2) |
Mar
(43) |
Apr
(204) |
May
(208) |
Jun
(102) |
Jul
(113) |
Aug
(63) |
Sep
(88) |
Oct
(85) |
Nov
(95) |
Dec
(62) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2004 |
Jan
(38) |
Feb
(93) |
Mar
(125) |
Apr
(89) |
May
(66) |
Jun
(65) |
Jul
(53) |
Aug
(65) |
Sep
(79) |
Oct
(60) |
Nov
(171) |
Dec
(176) |
2005 |
Jan
(264) |
Feb
(260) |
Mar
(145) |
Apr
(153) |
May
(192) |
Jun
(166) |
Jul
(265) |
Aug
(340) |
Sep
(300) |
Oct
(469) |
Nov
(316) |
Dec
(235) |
2006 |
Jan
(236) |
Feb
(156) |
Mar
(229) |
Apr
(221) |
May
(257) |
Jun
(161) |
Jul
(97) |
Aug
(169) |
Sep
(159) |
Oct
(400) |
Nov
(136) |
Dec
(134) |
2007 |
Jan
(152) |
Feb
(101) |
Mar
(115) |
Apr
(120) |
May
(129) |
Jun
(82) |
Jul
(118) |
Aug
(82) |
Sep
(30) |
Oct
(101) |
Nov
(137) |
Dec
(53) |
2008 |
Jan
(83) |
Feb
(139) |
Mar
(55) |
Apr
(69) |
May
(82) |
Jun
(31) |
Jul
(66) |
Aug
(30) |
Sep
(21) |
Oct
(37) |
Nov
(41) |
Dec
(65) |
2009 |
Jan
(69) |
Feb
(46) |
Mar
(22) |
Apr
(20) |
May
(39) |
Jun
(30) |
Jul
(36) |
Aug
(58) |
Sep
(38) |
Oct
(20) |
Nov
(10) |
Dec
(11) |
2010 |
Jan
(24) |
Feb
(63) |
Mar
(22) |
Apr
(72) |
May
(8) |
Jun
(13) |
Jul
(35) |
Aug
(23) |
Sep
(12) |
Oct
(26) |
Nov
(11) |
Dec
(30) |
2011 |
Jan
(15) |
Feb
(44) |
Mar
(36) |
Apr
(26) |
May
(27) |
Jun
(10) |
Jul
(28) |
Aug
(12) |
Sep
|
Oct
|
Nov
(17) |
Dec
(16) |
2012 |
Jan
(12) |
Feb
(31) |
Mar
(23) |
Apr
(14) |
May
(10) |
Jun
(26) |
Jul
|
Aug
(2) |
Sep
(2) |
Oct
(1) |
Nov
|
Dec
(6) |
2013 |
Jan
(4) |
Feb
(5) |
Mar
|
Apr
(4) |
May
(13) |
Jun
(7) |
Jul
(5) |
Aug
(15) |
Sep
(25) |
Oct
(18) |
Nov
(7) |
Dec
(3) |
2014 |
Jan
(1) |
Feb
(5) |
Mar
|
Apr
(3) |
May
(3) |
Jun
(2) |
Jul
(4) |
Aug
(5) |
Sep
|
Oct
(11) |
Nov
|
Dec
(62) |
2015 |
Jan
(8) |
Feb
(3) |
Mar
(15) |
Apr
|
May
|
Jun
(6) |
Jul
|
Aug
(6) |
Sep
|
Oct
|
Nov
|
Dec
(19) |
2016 |
Jan
(2) |
Feb
|
Mar
(2) |
Apr
(4) |
May
(3) |
Jun
(7) |
Jul
(14) |
Aug
(13) |
Sep
(6) |
Oct
(2) |
Nov
(3) |
Dec
|
2017 |
Jan
(6) |
Feb
(14) |
Mar
(2) |
Apr
|
May
(1) |
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
(4) |
Nov
(3) |
Dec
|
2018 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2019 |
Jan
|
Feb
(1) |
Mar
|
Apr
(44) |
May
(1) |
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
(1) |
2020 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
|
Dec
(1) |
2021 |
Jan
|
Feb
(1) |
Mar
|
Apr
|
May
|
Jun
(3) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2022 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
(1) |
2023 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
(1) |
Nov
(2) |
Dec
|
2024 |
Jan
|
Feb
|
Mar
|
Apr
(4) |
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(1) |
2025 |
Jan
|
Feb
(1) |
Mar
(1) |
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Brad B. <br...@bb...> - 2003-10-03 18:40:06
|
On Friday, October 3, 2003, at 11:36 AM, Simon Willison wrote: > I just spent some time trying to figure out how to execute the > equivalent of a "where col like '%text%'" query using SQLObject. I'm > now using the following: > > results = Story.select(CONTAINSSTRING(Story.q.body, query)) > > This is a bit of an eye-sore, especially compared to the neat > Story.q.body.startswith('blah') and Story.q.body.endswith('blah') > shortcuts. You're in luck. select() takes a string as a where argument. So: Story.select("body like '%something%'") (replaced with proper variables and escaping the %'s as necessary, if applicable.) The startswith and endwith are just methods of Python string objects, and because SQLObject is (mostly) transparent, string columns act like Python strings. > Ideally I'd like to be able to perform this type of query using > Python's "in" operator. From reading through SQLBuilder.py this seems > to be already overloaded to support SQL "something IN ('blah1', > 'blah2')" operations. Is there any way this could be inteligently > overloaded to perform like %% queries on strings and IN queries on > tuples? Python's "in" operator checks for the existence of a value in a sequence. What you're trying to do is ask for all the objects (or all the SQLObjects, as it were :) that meet a certain criteria. The semantics are different. > Alternatively, a contains() method similar to startswith() and > endswith() would be useful. Python strings already have a find() method, but I think you meant to pass a string as the where clause. Hope that helps, -- Brad Bollenbach BBnet.ca |
From: Simon W. <cs...@ba...> - 2003-10-03 15:36:49
|
I just spent some time trying to figure out how to execute the equivalent of a "where col like '%text%'" query using SQLObject. I'm now using the following: results = Story.select(CONTAINSSTRING(Story.q.body, query)) This is a bit of an eye-sore, especially compared to the neat Story.q.body.startswith('blah') and Story.q.body.endswith('blah') shortcuts. Ideally I'd like to be able to perform this type of query using Python's "in" operator. From reading through SQLBuilder.py this seems to be already overloaded to support SQL "something IN ('blah1', 'blah2')" operations. Is there any way this could be inteligently overloaded to perform like %% queries on strings and IN queries on tuples? Alternatively, a contains() method similar to startswith() and endswith() would be useful. Cheers, Simon |
From: Ian B. <ia...@co...> - 2003-10-02 22:56:30
|
On Thursday, October 2, 2003, at 12:43 PM, Scott Chapman wrote: > In SQLObject.html, it shows the following: > > p = Person.new(firstName="John", lastName="Doe") > #>> QueryIns: > # INSERT INTO person (last_name, middle_initial, first_name) > # VALUES ('Doe', NULL, 'John') > # > #-- Not quite optimized, we don't remember the values we used to > #-- create the object, so they get re-fetched from the database: > #>> QueryOne: > # SELECT last_name, middle_initial, first_name > # FROM person > # WHERE id = 1 > > Where does it learn that the new Person has an ID of 1? > > I tried the same commands manually and the insert doesn't return the > ID. How > does SQLObject know what the ID is? It's database-specific, and usually uses some DB-API extension. On MySQL there's a lastrowid method (or something like that) that you can get the ID from after an insert, and Postgres has a lastoid attribute (or something like that). SQLite too. Firebird uses generators/sequences, and it gets the ID and then uses it in the insert. Oracle will do the same. So SQLObject is papering over this diversity. Ian |
From: Scott C. <sco...@mi...> - 2003-10-02 20:59:28
|
On Thursday 02 October 2003 12:27, Luke Opperman wrote: > > Where does it learn that the new Person has an ID of 1? > > > > I tried the same commands manually and the insert doesn't return the ID. > > How does SQLObject know what the ID is? > > Depends on the database/dbdriver. You'll find the implementation in > SQlObject/DBConnection.py, _queryInsertID() for each DBConnection-class. > Some Python db interfaces provide a non-standard option for getting this > from the cursor (MySQL, SQLite), some require a second query of the > database (Postgres using OIDs, for instance). I'm using Postgres. It seems like OID's would be a good replacement for ID in this case (save some processing). However, I think they can roll over and that might cause a serious problem. Thanks for the answer. Cordially, Scott |
From: Luke O. <lu...@me...> - 2003-10-02 19:27:48
|
> > Where does it learn that the new Person has an ID of 1? > > I tried the same commands manually and the insert doesn't return the ID. > How does SQLObject know what the ID is? Depends on the database/dbdriver. You'll find the implementation in SQlObject/DBConnection.py, _queryInsertID() for each DBConnection-class. Some Python db interfaces provide a non-standard option for getting this from the cursor (MySQL, SQLite), some require a second query of the database (Postgres using OIDs, for instance). - Luke |
From: Scott C. <sco...@mi...> - 2003-10-02 17:43:40
|
In SQLObject.html, it shows the following: p = Person.new(firstName="John", lastName="Doe") #>> QueryIns: # INSERT INTO person (last_name, middle_initial, first_name) # VALUES ('Doe', NULL, 'John') # #-- Not quite optimized, we don't remember the values we used to #-- create the object, so they get re-fetched from the database: #>> QueryOne: # SELECT last_name, middle_initial, first_name # FROM person # WHERE id = 1 Where does it learn that the new Person has an ID of 1? I tried the same commands manually and the insert doesn't return the ID. How does SQLObject know what the ID is? Confsued, Scott |
From: Ian B. <ia...@co...> - 2003-10-01 23:46:11
|
On Wednesday, October 1, 2003, at 06:25 PM, Simon Willison wrote: > When you run a SQLObject SELECT statement and get back an array of > objects matching that select, are all of the represented rows from the > database loaded in to memory? If so, that could cause a great deal of > memory usage for large queries. An interesting trick I saw a while ago > was using generators to yield a single row from a query at a time, > allowing code to iterate through a whole database result set without > first having to load everything in to a Python list: > > http://www.halfcooked.com/mt/archives/000497.html > > Are there any plans to add some kind of mechanism to SQLObject to > support this kind of more efficient SELECT access? Or does it exist > already and I juste haven't spotted it yet. Yes, this is what SQLObject already does. SQLObject.SelectResults is what .select() returns, and when you iterate over it you get an iterator from DBConnection.DBAPI._iterSelect (How exactly this interacts with caching under different loads, I'm not as sure) Ian |
From: Simon W. <cs...@ba...> - 2003-10-01 23:25:34
|
When you run a SQLObject SELECT statement and get back an array of objects matching that select, are all of the represented rows from the database loaded in to memory? If so, that could cause a great deal of memory usage for large queries. An interesting trick I saw a while ago was using generators to yield a single row from a query at a time, allowing code to iterate through a whole database result set without first having to load everything in to a Python list: http://www.halfcooked.com/mt/archives/000497.html Are there any plans to add some kind of mechanism to SQLObject to support this kind of more efficient SELECT access? Or does it exist already and I juste haven't spotted it yet. Cheers, Simon Willison http://simon.incutio.com/ |
From: Vidar B. <vid...@ve...> - 2003-10-01 14:22:21
|
A friendly SQLObject proponent Victor Ng (http://www.crankycoder.com/archives/000066.html)pointed out to me that I had forgotten to import my data model into my servlet code. As a newbie to Pyton and SQLobject, these things happen very easily. I wish there were some extensive examples on the usage of SQLObject beyond the 'official' documentation. Do yo know of any 'referece' implementations for public view? regards, - vidar > > From: Ian Bicking <ia...@co...> > Date: 2003/09/30 Tue PM 10:09:01 EDT > To: vi...@br... > CC: <sql...@li...> > Subject: Re: [SQLObject] SQLObject and Webware newbie > > On Tuesday, September 30, 2003, at 09:02 PM, Vidar Brekke wrote: > > but when I try to execute this code within webkit (below), I get an > > error saying "NameError: name 'Member' is not defined" > > Are you importing the SQLObject class properly? Is the name of the > servlet clobbering the name of the SQLObject class? > > Ian > > |
From: James R. <jcr...@ya...> - 2003-10-01 14:19:49
|
> I am using Mandrake 9.1 which has xinetd (seems to > be an improvement > over init.d) and has this in the firebird > description in > /etc/xinetd.d/firebird > > # default: on > # description: Interbase server > service gds_db > { > flags = REUSE > socket_type = stream > wait = no > user = root > log_on_success += USERID > log_on_failure += USERID > server = > /opt/interbase/bin/gds_inet_server > disable = no > } > I think the equivalent line for inetd.conf would be: gds_db stream tcp nowait root /usr/interbase/bin/gds_inet_server gds_inet_server James __________________________________ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com |
From: James R. <jcr...@ya...> - 2003-10-01 13:56:08
|
--- Ian Bicking <ia...@co...> wrote: > DeleteSelectTest.testSelect, PeopleTest.dynamicJoin: > The Cursor unknown error -- some problem with > using a connection with > two cursors, or something. It happens when an > iterator still is using > a cursor and you execute another statement. The > exact problem I'm not > sure of, nor the resolution. I'm not sure if this is the same issue or not, but it seems very similar: http://kinterbasdb.sourceforge.net/dist_docs/usage.html#db_api_optional_unsupported > Firebird is really slow for me. Like, the tests > take seven minutes to > run, compared to 3sec for Mysql, and 9sec for > Postgres (MySQL doesn't > actually do as many tests). Are other people > getting similar results? Although Firebird can be as slow as a turtle with bad knees when doing metadate updates, seven minutes for the tests is excessive. For me, they run in 36 sec. on doze, 9 seconds on Linux (vs. 3 sec and 2 sec for mysql). Are you using SuperServer version or Classic? SS is known to have issues under Linux. This article may help: http://www.ibphoenix.com/a519.htm Also, consider changing/setting a pagesize when you create the database. HTH, James __________________________________ Do you Yahoo!? The New Yahoo! Shopping - with improved product search http://shopping.yahoo.com |
From: Dirk E. <D....@ex...> - 2003-10-01 13:38:21
|
I used Ian's Firebird/Interbase quoting example and got the same results for Oracle. - Dirk -- -------------------------------------------------------------------------- Dirk Evers Bioinformatics Research Scientist Exelixis Deutschland Fon: +49 (0)7071-9655-16 Spemannstr. 35 Fax: +49 (0)7071-9655-96 D-72076 Tuebingen, Germany URL: http://www.exelixis.com/ -------------------------------------------------------------------------- |
From: david <da...@su...> - 2003-10-01 13:36:03
|
Ian, > Firebird is really slow for me. Like, the tests take seven minutes to > run, compared to 3sec for Mysql, and 9sec for Postgres (MySQL doesn't > actually do as many tests). Are other people getting similar results? > I'm *hoping* my Firebird is badly configured, because I'm not that patient. My guess is that you are using Firebird Classic (a process started by init.d for each connection) and the tests are creating lots of connections very quickly. If that is the case then init.d or xinetd.d can put a limit on the rate at which they will create new processes. We have had this problem on some machines used by developers. I am using Mandrake 9.1 which has xinetd (seems to be an improvement over init.d) and has this in the firebird description in /etc/xinetd.d/firebird # default: on # description: Interbase server service gds_db { flags = REUSE socket_type = stream wait = no user = root log_on_success += USERID log_on_failure += USERID server = /opt/interbase/bin/gds_inet_server disable = no } I think the wait value is probably the critical one. Sorry I can't remember how we fixed it on init.d Dave -- David Warnock: http://davew.typepad.com/42 | Sundayta Ltd: http://www.sundayta.com iDocSys for Document Management. VisibleResults for Fundraising. Development and Hosting of Web Applications and Sites. |
From: Ian S. <ia...@et...> - 2003-10-01 13:04:29
|
"Ian Bicking" <ia...@co...> wrote in message news:A61...@co...... > It's probably easier if we just start quoting all the columns. That's > pretty easy with automatic SQL generation anyway. Postgres uses > "column", MySQL `column`, what does Firebird use? (SQLite?) Firebird/Interbase quoting example : CREATE TABLE "my test" ( id INT NOT NULL, username VARCHAR(20) NOT NULL, "my other test" VARCHAR(2) ) What Luke says about quoting and case-sensitivity is the same for Firebird too. For the above table this is valid : SELECT * FROM "my test" this is not : SELECT * FROM "MY TEST" neither is this : SELECT "my OTHER test" FROM "my test" Overall quoting seems a good let-out of our reserved word problems but at a cost.... - Ian S. |
From: John Dell'A. <de...@ml...> - 2003-10-01 03:45:49
|
Ian is correct, I simply added REFERENCES to table creation. I purposely did not add an ON DELETE clause because I want a database error if any funny business happens. "Ian Bicking" <ia...@co...> wrote in message news:2AF...@co...... > On Tuesday, September 30, 2003, at 08:08 AM, Ian Sparks wrote: > > "John Dell'Aquila" <de...@ml...> wrote in message > > news:blb1e5$p6t$1...@se...... > >> I don't fully understand the framework yet but I've managed to get > >> all the > >> column types working. I also implemented referential integrity > >> constraints > >> on ForeignKey columns since I want the tables to be safe for use from > >> the > >> database side as well. I also want to get columnsFromSchema > >> implemented if > > I > >> can figure out what's going on from the Postgres implementation. > > > > I'd be interested in the Referential integrity additions for porting to > > Firebird - espcially if you have dealt with the cacheing issue (cascade > > deletes removing child objects from the cache). > > I assume John is talking about REFERENCES in the automatic table > creation -- which would be a nice addition. Cascading deletes are... > challenging. > > Right now I'd suggest just overloading destroySelf(), doing the > cascading manually. Maybe there could also be a soft destroySelf -- > like, remind the object it's dead (but the object doesn't have to > delete itself from the database). Either way, you could do it by > adding an attribute to Col/ForeignKey objects to control it, and then > handle that in destroySelf. (And, while we're at it, all the foreign > key stuff should be moved out of Col and into ForeignKey, though that > would require a little refactoring to keep it as general as it is) > > Ian > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf |
From: John Dell'A. <de...@ml...> - 2003-10-01 03:33:25
|
Correction: all_tab_columns instead of user_tab_columns "John Dell'Aquila" <de...@ml...> wrote in message news:bldg27$5ro$1...@se...... > Very nice, and only one typo (TRUE). I had to query against all_tables > though because my tables weren't in all_user_tables. > > Thank you! > > - John > > "Dirk Evers" <D....@ex...> wrote in message > news:200...@ag...... > > Hi, > > > > I just hacked together the basic columnsFromSchema implementation for > Oracle. > > I'll post it here for John. Can't help it, I'm sitting behind a firewall. > > I tried out the SQL statement behind it, but not the python code itself, > > so there might be some stupid mistakes/typos in there... > > > > The MySQL version of columnsFromSchema and guessClass is much easier to > understand > > than the PostgreSQL version. > > > > Regards > > Dirk > > > > >>> snip > > > > def columnsFromSchema(self, tableName, soClass): > > # DE: Oracle is nice to us here, for a change! > > colData = self.queryAll("SELECT column_name, data_type, > data_length, data_precision, data_scale, nullable, data_default FROM > user_tab_columns WHERE table_name = UPPER('%s') ORDER BY column_id" > > % tableName) > > results = [] > > for field, t, dataLength, dataPrec, dataScale, nullAllowed, > default, in colData: > > if field == 'ID': > > continue > > > > colClass, kw = > self.guessClass(t,dataLength,dataPrec,dataScale) > > kw['name'] = soClass._style.dbColumnToPythonAttr(field) > > if nullAllowed == 'Y': > > # DE: nullable is a 'Y', 'N' column > > kw['notNone'] = False > > else: > > kw['notNone'] = True > > kw['default'] = default > > # @@ skip key... > > # @@ skip extra... > > results.append(colClass(**kw)) > > return results > > > > def guessClass(self, t, dataLength, dataPrec, dataScale): > > # DE: Oracle gave us all, so there's no need to guess > > col = None > > kw = {} > > if t.startswith('NUMBER'): > > # DE: INT is NUMBER in Oracle > > col = Col.IntCol > > if dataPrec: > > kw['precision'] = int(dataPrec) > > if dataScale: > > kw['scale'] = int(dataPrec) > > elif t.startswith('VARCHAR'): > > col = Col.StringCol > > kw['length'] = int(dataLength) > > kw['varchar'] = TRUE > > elif t.startswith('CHAR'): > > col = Col.StringCol > > kw['length'] = int(dataLength) > > kw['varchar'] = False > > elif t.startswith('DATE'): > > col = Col.DateTimeCol > > elif t.startswith('bool'): > > # DE: Hmm, no good idea how to check for bool yet! > > # DE: Need to identify CONSTRAINT CHECK by name maybe... > > col = Col.BoolCol > > else: > > col = Col.Col > > > > return col, kw > > > > <<< snip > > > > -- > > -------------------------------------------------------------------------- > > Dirk Evers Bioinformatics Research Scientist > > Exelixis Deutschland Fon: +49 (0)7071-9655-16 > > Spemannstr. 35 Fax: +49 (0)7071-9655-96 > > D-72076 Tuebingen, Germany URL: http://www.exelixis.com/ > > -------------------------------------------------------------------------- > > > > > > ------------------------------------------------------- > > This sf.net email is sponsored by:ThinkGeek > > Welcome to geek heaven. > > http://thinkgeek.com/sf > > > > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf |
From: John Dell'A. <de...@ml...> - 2003-10-01 03:01:40
|
Very nice, and only one typo (TRUE). I had to query against all_tables though because my tables weren't in all_user_tables. Thank you! - John "Dirk Evers" <D....@ex...> wrote in message news:200...@ag...... > Hi, > > I just hacked together the basic columnsFromSchema implementation for Oracle. > I'll post it here for John. Can't help it, I'm sitting behind a firewall. > I tried out the SQL statement behind it, but not the python code itself, > so there might be some stupid mistakes/typos in there... > > The MySQL version of columnsFromSchema and guessClass is much easier to understand > than the PostgreSQL version. > > Regards > Dirk > > >>> snip > > def columnsFromSchema(self, tableName, soClass): > # DE: Oracle is nice to us here, for a change! > colData = self.queryAll("SELECT column_name, data_type, data_length, data_precision, data_scale, nullable, data_default FROM user_tab_columns WHERE table_name = UPPER('%s') ORDER BY column_id" > % tableName) > results = [] > for field, t, dataLength, dataPrec, dataScale, nullAllowed, default, in colData: > if field == 'ID': > continue > > colClass, kw = self.guessClass(t,dataLength,dataPrec,dataScale) > kw['name'] = soClass._style.dbColumnToPythonAttr(field) > if nullAllowed == 'Y': > # DE: nullable is a 'Y', 'N' column > kw['notNone'] = False > else: > kw['notNone'] = True > kw['default'] = default > # @@ skip key... > # @@ skip extra... > results.append(colClass(**kw)) > return results > > def guessClass(self, t, dataLength, dataPrec, dataScale): > # DE: Oracle gave us all, so there's no need to guess > col = None > kw = {} > if t.startswith('NUMBER'): > # DE: INT is NUMBER in Oracle > col = Col.IntCol > if dataPrec: > kw['precision'] = int(dataPrec) > if dataScale: > kw['scale'] = int(dataPrec) > elif t.startswith('VARCHAR'): > col = Col.StringCol > kw['length'] = int(dataLength) > kw['varchar'] = TRUE > elif t.startswith('CHAR'): > col = Col.StringCol > kw['length'] = int(dataLength) > kw['varchar'] = False > elif t.startswith('DATE'): > col = Col.DateTimeCol > elif t.startswith('bool'): > # DE: Hmm, no good idea how to check for bool yet! > # DE: Need to identify CONSTRAINT CHECK by name maybe... > col = Col.BoolCol > else: > col = Col.Col > > return col, kw > > <<< snip > > -- > -------------------------------------------------------------------------- > Dirk Evers Bioinformatics Research Scientist > Exelixis Deutschland Fon: +49 (0)7071-9655-16 > Spemannstr. 35 Fax: +49 (0)7071-9655-96 > D-72076 Tuebingen, Germany URL: http://www.exelixis.com/ > -------------------------------------------------------------------------- > > > ------------------------------------------------------- > This sf.net email is sponsored by:ThinkGeek > Welcome to geek heaven. > http://thinkgeek.com/sf |
From: Ian B. <ia...@co...> - 2003-10-01 02:27:07
|
On a more general note, I'm happy to add Oracle support, but as a backend it won't receive the support from me that the other databases get. I have all the currently supported databases installed on my machine, and regularly do regression tests (and it's not uncommon for me to break something for a single database). But I'm not going to be able to do that with Oracle. So it'll require someone (one of you, or someone) to take up maintenance at least for that specific backend, and I'd imagine that CVS will generally be less stable for that backend (though we should at least be able to sync everything up before a release). The same is true of Sybase, which I think Sidnei is working on some. (And I'm just hoping that no one wants to use SAP DB ;) But anyway, Oracle support would still be cool. On Tuesday, September 30, 2003, at 04:06 AM, Dirk Evers wrote: > Hi, > > I also started to work on an Oracle version of SQLObject a few days > ago, > also using cx_Oracle. > > Problems I encountered are the slice notation > access to tables, because Oracle does not have anything like > LIMIT and OFFSET. Workarounds need a more complex SQL statement with > the original statement included as a sub-select. Not very nice! > This makes it necessary to overload functions at a higher level in > SQLObject > -- i.e. queryForSelect -- because the added statement is not just an > added suffix. > (Haven't implemented this yet.) Firebird required this as well. The methods are slightly different now, and might make it more workable. I'm surprised Oracle doesn't have anything to make it easier... but then it's weird the things you get used to without realizing they aren't universally supported. > Moreover, Oracle does not know anything like AUTOINCREMENT for the > PRIMARY KEY > statement, which makes things a tad more complicated. I used sequences > to > implement this. I was just about to start on the columnsFromSchema > functions > when I read your email. :-) Yes, that's what Firebird does, and what Postgres used to do. But you probably already figured that out. > John, let's compare our code changes to SQLObject and take it from > there. > I would be very happy to see an Oracle version of SQLObject come to > production > very fast! |
From: Ian B. <ia...@co...> - 2003-10-01 02:15:48
|
On Tuesday, September 30, 2003, at 08:08 AM, Ian Sparks wrote: > "John Dell'Aquila" <de...@ml...> wrote in message > news:blb1e5$p6t$1...@se...... >> I don't fully understand the framework yet but I've managed to get >> all the >> column types working. I also implemented referential integrity >> constraints >> on ForeignKey columns since I want the tables to be safe for use from >> the >> database side as well. I also want to get columnsFromSchema >> implemented if > I >> can figure out what's going on from the Postgres implementation. > > I'd be interested in the Referential integrity additions for porting to > Firebird - espcially if you have dealt with the cacheing issue (cascade > deletes removing child objects from the cache). I assume John is talking about REFERENCES in the automatic table creation -- which would be a nice addition. Cascading deletes are... challenging. Right now I'd suggest just overloading destroySelf(), doing the cascading manually. Maybe there could also be a soft destroySelf -- like, remind the object it's dead (but the object doesn't have to delete itself from the database). Either way, you could do it by adding an attribute to Col/ForeignKey objects to control it, and then handle that in destroySelf. (And, while we're at it, all the foreign key stuff should be moved out of Col and into ForeignKey, though that would require a little refactoring to keep it as general as it is) Ian |
From: Ian B. <ia...@co...> - 2003-10-01 02:09:05
|
On Tuesday, September 30, 2003, at 09:02 PM, Vidar Brekke wrote: > but when I try to execute this code within webkit (below), I get an > error saying "NameError: name 'Member' is not defined" Are you importing the SQLObject class properly? Is the name of the servlet clobbering the name of the SQLObject class? Ian |
From: Vidar B. <vid...@ve...> - 2003-10-01 02:09:01
|
Dear good people of SQLObject list: Im trying to learn Python have decided to try out webware (webkit) and SQLObjet. When I execute the following code in from the command line, every thing works fine. ----- from SQLObject import * class ListMember(SQLObject): conn = MySQLConnection(user='user', db='club') m = Member.select(Member.q.firstName=="Peter") print tuple(m) ----- but when I try to execute this code within webkit (below), I get an error saying "NameError: name 'Member' is not defined" ----- from WebKit.Page import Page from SQLObject import * class ListMember(SQLObject): def writeContent(self): conn = MySQLConnection(user='user', db='club') m = Member.select(Member.q.firstName=="Peter") print tuple(m) ----- Can anyone tell me what I need to do to get SQLObject working within webkit? thanks, - vidar, New York |
From: Vidar B. <vid...@ve...> - 2003-10-01 02:06:32
|
Dear good people, Im trying to learn Python have decided to try out webware (webkit) and SQLObjet. When I execute the following code in from the command line, every thing works fine. ----- from SQLObject import * class ListMember(SQLObject): conn = MySQLConnection(user='user', db='club') m = Member.select(Member.q.firstName=="Peter") print tuple(m) ----- but when I try to execute this code within webkit (below), I get an error saying "NameError: name 'Member' is not defined" ----- from WebKit.Page import Page from SQLObject import * class ListMember(SQLObject): def writeContent(self): conn = MySQLConnection(user='user', db='club') m = Member.select(Member.q.firstName=="Peter") print tuple(m) ----- Can anyone tell me what I need to do to get SQLObject working within webkit? thanks, - vidar, New York |
From: Vidar B. <vid...@ve...> - 2003-10-01 02:03:21
|
Dear good people, Im trying to learn Python have decided to try out webware (webkit) and SQLObjet. When I execute the following code in from the command line, every thing works fine. ----- from SQLObject import * class ListMember(SQLObject): conn = MySQLConnection(user='user', db='club') m = Member.select(Member.q.firstName=="Peter") print tuple(m) ----- but when I try to execute this code within webkit (below), I get an error saying "NameError: name 'Member' is not defined" ----- from WebKit.Page import Page from SQLObject import * class ListMember(SQLObject): def writeContent(self): conn = MySQLConnection(user='user', db='club') m = Member.select(Member.q.firstName=="Peter") print tuple(m) ----- Can anyone tell me what I need to do to get SQLObject working within webkit? thanks, - vidar, New York |
From: Vidar B. <vid...@ve...> - 2003-10-01 02:03:08
|
Dear good people, Im trying to learn Python have decided to try out webware (webkit) and SQLObjet. When I execute the following code in from the command line, every thing works fine. ----- from SQLObject import * class ListMember(SQLObject): conn = MySQLConnection(user='user', db='club') m = Member.select(Member.q.firstName=="Peter") print tuple(m) ----- but when I try to execute this code within webkit (below), I get an error saying "NameError: name 'Member' is not defined" ----- from WebKit.Page import Page from SQLObject import * class ListMember(SQLObject): def writeContent(self): conn = MySQLConnection(user='user', db='club') m = Member.select(Member.q.firstName=="Peter") print tuple(m) ----- Can anyone tell me what I need to do to get SQLObject working within webkit? thanks, - vidar, New York |
From: Ian B. <ia...@co...> - 2003-10-01 01:58:08
|
Okay, I've applied some of the things James sent me, and a few other small fixes as well. Interested parties may wish to download the CVS snapshot. These are the bugs that remain: DeleteSelectTest.testSelect, PeopleTest.dynamicJoin: The Cursor unknown error -- some problem with using a connection with two cursors, or something. It happens when an iterator still is using a cursor and you execute another statement. The exact problem I'm not sure of, nor the resolution. ValidationTest: We seem to be getting something other than strings back... some sort of funny string-like object? Doesn't seem to cause actual problems unless we are specifically checking the type. DeleteSelectTest.testNewline (and others): Like SQLite, Firebird doesn't like backslash escapes in string literals. One resolution might be to get rid of backslashes, and not quote anything except ' (as ''). Firebird is really slow for me. Like, the tests take seven minutes to run, compared to 3sec for Mysql, and 9sec for Postgres (MySQL doesn't actually do as many tests). Are other people getting similar results? I'm *hoping* my Firebird is badly configured, because I'm not that patient. Ian |