sqlobject-discuss Mailing List for SQLObject (Page 383)
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: Oleg B. <ph...@ma...> - 2004-05-11 22:07:04
|
On Tue, May 11, 2004 at 05:24:05PM -0400, Eduardo Elgueta wrote: > My mistake. I meant this: Too much code. But what do you want to achieve? Oleg. -- Oleg Broytmann http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Luke O. <lu...@me...> - 2004-05-11 21:50:49
|
It's been a while since I've done this (ie, a couple revs of SQLObject ago), but the limitations on inheritance in SQLObject have always been about concrete classes, and since 0.4 or so, abstract columns could be inherited. It is quite possible to define common elements in abstract base classes, I use it regularly to have a common _connection. Again, the subclassing limitation is that every subclass table will be expected to actually have those columns, but I think that's exactly your situation. So (untested) I think this will do what you want for *create*: class MainObject(SQLObject): createdBy = StringCol(default="me") createdOn = DateTimeCol(default=now) class MyObjOne(MainObject): otherColumn = ... class MyObjTwo(MainObject): someColumn = ... (Note the default=now, not default=now() - SQLObject will use it as a callback since you don't want the value of now() as of creation time, but at insert). Shouldn't have to override anything else, the default will be inserted if you ignore those column names for your subclasses. Now, for update you'd have to override _SO_setValue() and set(). (Again, untested, and based on 0.5 that I have in front of me.) I'm going to treat all _SO_setValue calls as effectively set() calls, since we now have multiple values. class MainObject(SQLObject): createdBy = StringCol(default="me") createdOn = DateTimeCol(default=now) updateBy = StringCol(default="me") updateOn = DateTimeCol(default=now) def _SO_setValue(self, name, value, fromPython): if fromPython: value = fromPython(value, self._SO_validatorState) updates = {'updateBy': "me", 'updateOn': now(), name: value} self.set(**updates) def set(self, **kw): if not kw.get('updateOn',None): kw['updateOn'] = now() if not kw.get('updateBy',None): kw['updateBy'] = "me" super(MainObject, self).set(**kw) Disclaimer again: this is looking at SO 0.5, I'm not sure I really like it, it would be nice to write a database-agnostic trigger system as part of SQLObject. But I certainly don't have the time for it (it was was mentioned on the list a long time ago, nothing really came of it). And my example may not work at all because of something I've forgotten. Hopefully it gets you on a workable track though. - Luke Quoting Eduardo Elgueta <eel...@na...>: > Oleg and anyone else, > > I tried Daniel Savard's patch and I can see I could use it to achieve > what I want, but creating an unnatural hierarchy. > > What I would like to have is something like this: > > def MyOnUpdate (sqlObj): > sqlObj.addColumn(StringCol("updateBy", "me"); > sqlObj.addColumn(DateTimeCol("updateOn", now()); > > def MyOnInsert (sqlObj): > sqlObj.addColumn(StringCol("createdBy", "me"); > sqlObj.addColumn(DateTimeCol("createdOn", now()); > MyOnUpdate(sqlObj) > > def MySQLObject1 (SQLObject): > myField = StringCol() > onInsert = MyOnInsert(self) > onUpdate = MyOnUpdate(self) > > def MySQLObject2 (SQLObject): > myField = IntCol() > onInsert = MyOnInsert(self) > onUpdate = MyOnUpdate(self) > > What I need is to find the place to insert the self.onUpdate(self) call. > Any suggestion? > > TIA, > > Ed. > > PS: In other words, I need triggers which MySQL (my database backend) > does not provide. > > Eduardo Elgueta wrote: >> Oleg, >> >> Thank you for your answer. >> >> I'm not sure inheritance is what I need, but I'll certainly give it >> a try. Where can I get that patch? >> >> Ed. >> >> Oleg Broytmann wrote: >> >>> On Mon, May 10, 2004 at 05:37:21PM -0400, Eduardo Elgueta wrote: >>> >>>> I have some basic audit fields in my tables, that I used to update >>>> in my rudimentary ORM superclass. >>>> >>>> I've seen in the FAQ/docs that SQLObject classes are not meant to >>>> be subclassed >>> >>> >>> >>> There was a Daniel Savard's inheritance patch. I cannot find it on >>> the web, but I have patches for SQLObject 0.5.1 and 0.5.2. >>> >>> Oleg. >> >> >> >> >> ------------------------------------------------------- >> This SF.Net email is sponsored by Sleepycat Software >> Learn developer strategies Cisco, Motorola, Ericsson & Lucent use to >> deliver higher performing products faster, at low TCO. >> http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3 > > > > ------------------------------------------------------- > This SF.Net email is sponsored by Sleepycat Software > Learn developer strategies Cisco, Motorola, Ericsson & Lucent use to > deliver higher performing products faster, at low TCO. > http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3 > _______________________________________________ > sqlobject-discuss mailing list > sql...@li... > https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss -- The Pursuit of Counterfactual Histories |
From: Eduardo E. <eel...@na...> - 2004-05-11 21:24:13
|
Oleg, My mistake. I meant this: def MyOnUpdate (sqlObj): sqlObj.addColumn(StringCol("updateBy", "me"); sqlObj.addColumn(DateTimeCol("updateOn", now()); def MyOnInsert (sqlObj): sqlObj.addColumn(StringCol("createdBy", "me"); sqlObj.addColumn(DateTimeCol("createdOn", now()); MyOnUpdate(sqlObj) class MySQLObject1 (SQLObject): myField = StringCol() onInsert = MyOnInsert(self) onUpdate = MyOnUpdate(self) class MySQLObject2 (SQLObject): myField = IntCol() onInsert = MyOnInsert(self) onUpdate = MyOnUpdate(self) Ed. Oleg Broytmann wrote: > On Tue, May 11, 2004 at 04:56:33PM -0400, Eduardo Elgueta wrote: > >>What I would like to have is something like this: >> >>def MyOnUpdate (sqlObj): >> sqlObj.addColumn(StringCol("updateBy", "me"); >> sqlObj.addColumn(DateTimeCol("updateOn", now()); >> >>def MyOnInsert (sqlObj): >> sqlObj.addColumn(StringCol("createdBy", "me"); >> sqlObj.addColumn(DateTimeCol("createdOn", now()); >> MyOnUpdate(sqlObj) >> >>def MySQLObject1 (SQLObject): >> myField = StringCol() >> onInsert = MyOnInsert(self) >> onUpdate = MyOnUpdate(self) >> >>def MySQLObject2 (SQLObject): >> myField = IntCol() >> onInsert = MyOnInsert(self) >> onUpdate = MyOnUpdate(self) >> >>What I need is to find the place to insert the self.onUpdate(self) call. >> >>PS: In other words, I need triggers which MySQL (my database backend) >>does not provide. > > > I do not understand what you really want. May be all you need is jsut > an accessor? > > Oleg. |
From: Oleg B. <ph...@ma...> - 2004-05-11 21:07:41
|
On Tue, May 11, 2004 at 04:56:33PM -0400, Eduardo Elgueta wrote: > What I would like to have is something like this: > > def MyOnUpdate (sqlObj): > sqlObj.addColumn(StringCol("updateBy", "me"); > sqlObj.addColumn(DateTimeCol("updateOn", now()); > > def MyOnInsert (sqlObj): > sqlObj.addColumn(StringCol("createdBy", "me"); > sqlObj.addColumn(DateTimeCol("createdOn", now()); > MyOnUpdate(sqlObj) > > def MySQLObject1 (SQLObject): > myField = StringCol() > onInsert = MyOnInsert(self) > onUpdate = MyOnUpdate(self) > > def MySQLObject2 (SQLObject): > myField = IntCol() > onInsert = MyOnInsert(self) > onUpdate = MyOnUpdate(self) > > What I need is to find the place to insert the self.onUpdate(self) call. > > PS: In other words, I need triggers which MySQL (my database backend) > does not provide. I do not understand what you really want. May be all you need is jsut an accessor? Oleg. -- Oleg Broytmann http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Eduardo E. <eel...@na...> - 2004-05-11 20:56:38
|
Oleg and anyone else, I tried Daniel Savard's patch and I can see I could use it to achieve what I want, but creating an unnatural hierarchy. What I would like to have is something like this: def MyOnUpdate (sqlObj): sqlObj.addColumn(StringCol("updateBy", "me"); sqlObj.addColumn(DateTimeCol("updateOn", now()); def MyOnInsert (sqlObj): sqlObj.addColumn(StringCol("createdBy", "me"); sqlObj.addColumn(DateTimeCol("createdOn", now()); MyOnUpdate(sqlObj) def MySQLObject1 (SQLObject): myField = StringCol() onInsert = MyOnInsert(self) onUpdate = MyOnUpdate(self) def MySQLObject2 (SQLObject): myField = IntCol() onInsert = MyOnInsert(self) onUpdate = MyOnUpdate(self) What I need is to find the place to insert the self.onUpdate(self) call. Any suggestion? TIA, Ed. PS: In other words, I need triggers which MySQL (my database backend) does not provide. Eduardo Elgueta wrote: > Oleg, > > Thank you for your answer. > > I'm not sure inheritance is what I need, but I'll certainly give it a > try. Where can I get that patch? > > Ed. > > Oleg Broytmann wrote: > >> On Mon, May 10, 2004 at 05:37:21PM -0400, Eduardo Elgueta wrote: >> >>> I have some basic audit fields in my tables, that I used to update in >>> my rudimentary ORM superclass. >>> >>> I've seen in the FAQ/docs that SQLObject classes are not meant to be >>> subclassed >> >> >> >> There was a Daniel Savard's inheritance patch. I cannot find it on >> the web, but I have patches for SQLObject 0.5.1 and 0.5.2. >> >> Oleg. > > > > > ------------------------------------------------------- > This SF.Net email is sponsored by Sleepycat Software > Learn developer strategies Cisco, Motorola, Ericsson & Lucent use to > deliver higher performing products faster, at low TCO. > http://www.sleepycat.com/telcomwpreg.php?From=osdnemail3 |
From: Eduardo E. <eel...@na...> - 2004-05-11 13:16:52
|
Oleg, Thank you for your answer. I'm not sure inheritance is what I need, but I'll certainly give it a try. Where can I get that patch? Ed. Oleg Broytmann wrote: > On Mon, May 10, 2004 at 05:37:21PM -0400, Eduardo Elgueta wrote: > >>I have some basic audit fields in my tables, that I used to update in my >>rudimentary ORM superclass. >> >>I've seen in the FAQ/docs that SQLObject classes are not meant to be >>subclassed > > > There was a Daniel Savard's inheritance patch. I cannot find it on > the web, but I have patches for SQLObject 0.5.1 and 0.5.2. > > Oleg. |
From: Gavin <bra...@ri...> - 2004-05-11 08:52:47
|
With the new method, I get an error about regarding a missing argument to the method for a notNull db field. Do you have to enter every field with the new method? - Gavin |
From: Oleg B. <ph...@ph...> - 2004-05-11 07:59:47
|
On Mon, May 10, 2004 at 05:37:21PM -0400, Eduardo Elgueta wrote: > I have some basic audit fields in my tables, that I used to update in my > rudimentary ORM superclass. > > I've seen in the FAQ/docs that SQLObject classes are not meant to be > subclassed There was a Daniel Savard's inheritance patch. I cannot find it on the web, but I have patches for SQLObject 0.5.1 and 0.5.2. Oleg. -- Oleg Broytmann http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Eduardo E. <eel...@na...> - 2004-05-10 21:50:29
|
Hi All, I have some basic audit fields in my tables, that I used to update in my rudimentary ORM superclass. I've seen in the FAQ/docs that SQLObject classes are not meant to be subclassed, so I was thinking that may be there is some event that I can hook into, but this related post (news://news.gmane.org:119/1080605589.21688.13.camel@gandalf) received no answer. That only leaves me the option to find the method where sql statements are passed to the db driver and intercept/modify this statements. Is this feasible? If so, where should I look? TIA. Ed. |
From: Scott R. <sc...@to...> - 2004-05-09 14:13:21
|
On Sun, 2004-05-09 at 09:30, Gavin wrote: > streamcast.StreamSources(stream_name='Enemy Combatant > Radio',stream_source='http://radio.indymedia.org:8001/sf-hifi.mp3',start_date='2004-05-09 > 23:25:00',end_date='2004-05-09 23:30:00') > > I get this error: > TypeError: __new__() got an unexpected keyword argument 'stream_name' > What version of SO? If it's an older one (even maybe the current stable), you need to change streamcast.StreamSources(stream_name='Enemy Combatant to streamcast.StreamSources.new(stream_name='Enemy Combatant This has changed in recent versions, though, so YMMV. |
From: Gavin <bra...@ri...> - 2004-05-09 13:27:41
|
With the following code: import streamcast streamcast.StreamSources(stream_name='Enemy Combatant Radio',stream_source='http://radio.indymedia.org:8001/sf-hifi.mp3',start_date='2004-05-09 23:25:00',end_date='2004-05-09 23:30:00') I get this error: TypeError: __new__() got an unexpected keyword argument 'stream_name' The StreamSource class: class StreamSources(SQLObject.SQLObject): db = Database() _connection = SQLObject.MySQLConnection(db=db.name,user=db.user,passwd=db.password) _style = SQLObject.Style() _table = 'streamcast' stream_name = SQLObject.StringCol(length=150,notNull=True) stream_source = SQLObject.StringCol(length=255,notNull=True) start_date = SQLObject.DateTimeCol(notNull=True) end_date = SQLObject.DateTimeCol(notNull=True) default_stream = SQLObject.BoolCol() - Gavin |
From: Oleg B. <ph...@ph...> - 2004-05-07 14:43:16
|
Hi! A few weeks ago I complained about slowness of SQLObject.new(): http://article.gmane.org/gmane.comp.python.sqlobject/1443 The figures are: QPS-based script does 180 INSERTs per second, SQLObject does 2 or 3 :( QPS-based script runs 3 minutes, SQLObject-based - 2.5 hours )': I patched SQLObject a bit (the patch is attached). In short, the patch prevents SELECT after INSERT. This is not a universal patch, of course - just an ugly hack to do an experiment. Well, now SQLObjects does 120 INSERTs per second and the script runs 4.5 minutes. Much better! So SQLObject by itself is not very slow - it is that excessive SELECT that makes things so slow. Now I need to invent a patch to disable it. In my opinion the simplest way will be to pass a row of values to the _init() from _SO_finishCreate(). Is it a correct way? Oleg. -- Oleg Broytmann http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Oleg B. <ph...@ph...> - 2004-05-04 12:46:07
|
Hi! There is a problem in the Converters.py, IntConverter (SQLObject 0.5.2): >>> repr(int(11111111111111111111111111L)) '11111111111111111111111111L' And of course Postgres complaints about that 'L'. The code should be something like def IntConverter(value, db): s = repr(int(value)) if s[-1] == 'L': s = s[:-1] return s Oleg. -- Oleg Broytmann http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Marek K. <pyt...@we...> - 2004-05-01 09:26:38
|
On Fri, 30 Apr 2004 14:45:46 +0200 Philippe Normand <sw...@fr...> wrote: > In my opinion the URI system is far more powerfull. For instance, if I > want to store db login/passwd, etc in a config file it is not so > trivial to handle Connection types. URIs can be easily stored in > config files, all the informations (db type, login, passwd, db name) > reside in a simple string. I absolutely agree, but I thought there would be some releases with botz systems. greets, Marek |
From: Marek K. <pyt...@we...> - 2004-05-01 09:26:36
|
On Fri, 30 Apr 2004 10:42:57 -0500 Ian Bicking <ia...@co...> wrote: > I have to look at this more, but the old system is supposed to work, > and should continue to work at least for a release or two (or more). That's why I wondered. greets, Marek |
From: Ian B. <ia...@co...> - 2004-04-30 15:43:10
|
Philippe Normand wrote: > On Wed, Apr 28, 2004 at 06:28:00PM +0200, Marek Kubica wrote: > >>I've checked out the newest revision (105) and I tried this script: >> >># SNIP >>from sqlobject import * >>__connection__ = SQLiteConnection('database.db') >>#__connection__ = GadflyConnection('gad.fly.db') >>class Person(SQLObject): >> _connection = __connection__ >> firstName = StringCol() >> middleInitial = StringCol(length=1, default=None) >> lastName = StringCol() >> > > > If you're using sqlobject 0.6 (SVN), use the new URI system: > > __connection__ = dbconnection.connectionForURI('sqlite:///tmp/database.db') > > May it be helpfull to raise some Exception if somebody tries to use > the old system ... I have to look at this more, but the old system is supposed to work, and should continue to work at least for a release or two (or more). |
From: Philippe N. <sw...@fr...> - 2004-04-30 12:58:08
|
On Fri, Apr 30, 2004 at 01:48:44PM +0200, Marek Kubica wrote: > On Wed, 28 Apr 2004 21:17:06 +0200, Philippe Normand wrote: > > If you're using sqlobject 0.6 (SVN), use the new URI system: > >=20 > > __connection__ =3D > > dbconnection.connectionForURI('sqlite:///tmp/database.db') > >=20 > > May it be helpfull to raise some Exception if somebody tries to use > > the old system ... > So the old system won't be supported? >=20 Well it could be supported. In my opinion the URI system is far more powerfull. For instance, if I=20 want to store db login/passwd, etc in a config file it is not so trivial=20 to handle Connection types. URIs can be easily stored in config files,=20 all the informations (db type, login, passwd, db name) reside in a simple= =20 string. --=20 Philippe Normand |
From: Marek K. <pyt...@we...> - 2004-04-30 12:39:08
|
On Wed, 28 Apr 2004 21:17:06 +0200, Philippe Normand wrote: > If you're using sqlobject 0.6 (SVN), use the new URI system: > > __connection__ = > dbconnection.connectionForURI('sqlite:///tmp/database.db') > > May it be helpfull to raise some Exception if somebody tries to use > the old system ... So the old system won't be supported? greets, Marek |
From: Scott R. <sc...@to...> - 2004-04-30 10:58:48
|
On Thu, 2004-04-29 at 07:28, Samir Patel wrote: > MySQL is support in sql object using MySQLdb package. I found a very good > package "pymssql.sourceforge.net" to connect to MS SQL from unix or windows. > So to support MS SQL backend, should I copy mysql folder and modify it to use > pymssql? If I add this backend, can it be added to your official sql object? > - Samir Samir, Why not make and test it, and then offer the patch. Usually, inclusion in a project is based on readability, functionality, performance, and how it fits into the overall package. Asking if it will be accepted before writing it and showing it to the maintainers is just impossible to call. Most likely, if it has reasonable performance, is written up to the standards of the rest of the project, brings value, and does not force unacceptable requirements, it will be accepted - the SO guys are reasonable and value contribution. - Scott |
From: Samir P. <sp...@la...> - 2004-04-30 08:18:49
|
MySQL is support in sql object using MySQLdb package. I found a very good package "pymssql.sourceforge.net" to connect to MS SQL from unix or windows. So to support MS SQL backend, should I copy mysql folder and modify it to use pymssql? If I add this backend, can it be added to your official sql object? - Samir |
From: Samir P. <sp...@la...> - 2004-04-29 16:42:15
|
I found a very good package "pymssql.sourceforge.net" to connect to MS SQL from unix or windows. So to support MS SQL backend, should I copy mysql folder and modify it to use pymssql or should I start with sybase and modify that? Which will require least amount of coding change? If I add this backend, can it be added to official sql object? - Samir |
From: Philippe N. <sw...@fr...> - 2004-04-28 19:29:34
|
On Wed, Apr 28, 2004 at 06:28:00PM +0200, Marek Kubica wrote: > I've checked out the newest revision (105) and I tried this script: >=20 > # SNIP > from sqlobject import * > __connection__ =3D SQLiteConnection('database.db') > #__connection__ =3D GadflyConnection('gad.fly.db') > class Person(SQLObject): > _connection =3D __connection__ > firstName =3D StringCol() > middleInitial =3D StringCol(length=3D1, default=3DNone) > lastName =3D StringCol() >=20 If you're using sqlobject 0.6 (SVN), use the new URI system: __connection__ =3D dbconnection.connectionForURI('sqlite:///tmp/database.db= ') May it be helpfull to raise some Exception if somebody tries to use the old system ... --=20 Philippe Normand |
From: Marek K. <pyt...@we...> - 2004-04-28 18:26:36
|
On Mon, 26 Apr 2004 10:55:56 -0500 Ian Bicking <ia...@co...> wrote: > > This is for lazy loading -- you'll note that SQLiteConnection imports > sqlite in its __init__. > > But you're probably encountering a more mundane problem where you > aren't giving your SQLObject subclass a _connection object, so the > connection is simply None. I've checked out the newest revision (105) and I tried this script: # SNIP from sqlobject import * __connection__ = SQLiteConnection('database.db') #__connection__ = GadflyConnection('gad.fly.db') class Person(SQLObject): _connection = __connection__ firstName = StringCol() middleInitial = StringCol(length=1, default=None) lastName = StringCol() Person.dropTable(ifExists=True) Person.createTable() p = Person(firstName="John", lastName="Doe") print p print p.firstName p.middleInitial = 'Q' print p.middleInitial p2 = Person.get(1) print p2 print p is p2 # SNIP This is a lighter version of simpleperson.py from the examples. __connection__ points to the SQLite backend. File "C:\sqlobject\sqlobject\main.py", line 943, in dropTable if ifExists and not cls._connection.tableExists(cls._table): AttributeError: 'NoneType' object has no attribute 'tableExists' The same error happens! My gadfly backend has the same problem, since it uses 90% of the sqlite code. Is anybody (more experienced than I) working on the sqlite code? greets, Marek |
From: Oleg B. <ph...@ph...> - 2004-04-28 12:53:08
|
Hello! Preamble. I am developing a site that consists of FTP scanner and a web interface to the database full of files descriptions. The scanner and the site have been running for some time. I use QPS (http://ppa.sf.net/); actually I use only qBricks module, which is a kind of ORM, oriented towards QPS needs. Now I am trying to replace qBricks with SQLObject. And I found that the scanner became very slow. Slow as death :( qBricks-based scanner scanned my FTP for about 10 seconds (just did LIST -R and parsed the answer) and spent 2-3 minutes to INSERT all descriptions. SQLObject-based scanner was running for about 15 minutes, and I killed it to investigate its slowness. First problem that I see in the log is that SQLObject does a SELECT for every INSERT: 1/QueryIns: INSERT INTO files (id, updated, mtime, directory, resource, size, dnld_count, filename) VALUES (24577, 't', '2002-11-05 00:00:00', '/pub/Software/Java', 1, '22839295', 0, 'j2re-1_4_1_01-linux-i586.bin') 1/COMMIT : auto 1/QueryOne: SELECT resource, updated, filename, mtime, directory, dnld_count, size FROM files WHERE id = 24577 1/COMMIT : auto 1/QueryIns: INSERT INTO files (id, updated, mtime, directory, resource, size, dnld_count, filename) VALUES (24578, 't', '2002-11-14 00:00:00', '/pub/Software/Java', 1, '9937344', 0, 'j2re-1_4_1_01-windows-i586-i.exe') 1/COMMIT : auto 1/QueryOne: SELECT resource, updated, filename, mtime, directory, dnld_count, size FROM files WHERE id = 24578 1/COMMIT : auto Why? SQLObject has got all neccessary information - all values for all columns. Why does it SELECT them back? Well, even if it really needs it - I want to stop it in this particular case. After the INSERT I don't need the object - the program is moving to the next object and the next INSERT. How can I do it - INSERT without SELECT? SQLObject 0.5.2, PostgreSQL. Oleg. -- Oleg Broytmann http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Samir P. <sp...@la...> - 2004-04-26 16:59:37
|
So Best thing is to start with sybase connection, right? -----Original Message----- From: Ian Bicking [mailto:ia...@co...] Sent: Monday, April 26, 2004 11:53 AM To: Samir Patel Cc: 'sql...@li...' Subject: Re: [SQLObject] MS SQL Sever Backend Samir Patel wrote: > At one point, I read that there is somebody working on MS SQL Server > backend for SQL Object? Where can I find it? If my information is not > correct and nobody is working on this, how difficult it is to create one? I > don't mind doing it if it is not that difficult. I don't remember anyone talking about it before. There is some not-quite-complete Sybase support in there now, which should mostly apply to SQL Server as well. (I believe it's fairly complete insofar as it goes, but it might not implement all features) Ian |