sqlobject-discuss Mailing List for SQLObject (Page 389)
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: Ian B. <ia...@co...> - 2004-03-18 03:38:52
|
On Mar 17, 2004, at 8:18 PM, David Warnock wrote: > Our Java connection pool tests every connection before it gives it to > the client (by setting autocommit). If the test fails then the > connection is removed from the pool and the next connection (or if > required a new connection) is returned. > > We added this because both MySQL and MS SQL Server seemed to not like > having connections around for long periods of time and would close > them at inopportune times. > > Maybe SQL Object could do something similar. It would be easy to add *if* there's an interface to do this with the database driver. If there was, DBAPIConnection.getConnection() could ping the database before returning the connection. -- Ian Bicking | ia...@co... | http://blog.ianbicking.org |
From: David W. <da...@su...> - 2004-03-18 02:18:08
|
Victor, > I'm getting the following error in my application using SQLObject 0.5.1 > and MySQL. > > Any ideas on how to work around this problem? I'd like to be able to > set an expiry option on the connection pool so that connections will > only be used 'N' number of times before they get closed and discarded. Our Java connection pool tests every connection before it gives it to the client (by setting autocommit). If the test fails then the connection is removed from the pool and the next connection (or if required a new connection) is returned. We added this because both MySQL and MS SQL Server seemed to not like having connections around for long periods of time and would close them at inopportune times. Maybe SQL Object could do something similar. Regards Dave -- David Warnock, Sundayta Ltd. http://www.sundayta.com iDocSys for Document Management. VisibleResults for Fundraising. Development and Hosting of Web Applications and Sites. |
From: Victor Ng <vn...@sy...> - 2004-03-18 00:54:39
|
Grrr.... This is really annoying. I'm using MySQL for this one database because Postgresql seems to have broken the error handling between 7.2 and 7.4. I've got 7.2 on my production server and 7.4 on my laptop right now. Trying to connect with psycopg on a 7.4 client to a 7.4 server doesn't work properly so I can't connect to Postgres from my laptop which is running pgsql 7.4. I can only connect remotely to the Postgres 7.2 database using a lone Linux machine sitting in the corner of the room. I've tried switching to a Unix Domain socket from a TCP connection in MySQLdb and I still get errors (different errors - but errors nonetheless). I hate MySQL. Gah. Thanks for the help - at least I don't feel completely stupid. I'll be switching back to Postgresql. vic On Mar 17, 2004, at 3:01 PM, Frank Barknecht wrote: > Hallo, > Victor Ng hat gesagt: // Victor Ng wrote: > >> I'm getting the following error in my application using SQLObject >> 0.5.1 >> and MySQL. >> >> Any ideas on how to work around this problem? > > Install and use PostgreSQL. > > Sorry to say this, but at least I was fighting and googling this > problem for weeks to no avail at all, I tried various patches to > python-mysql, nothing helped. As my project was nearing release time, > I switched to PostgreSQL the night before deadline which finally fixed > all my problems. I don't know who to blame, but I don't blame me > anymore. ;) > > No I can do python progamming again instead of struggling with a (to > me) unsolvable problem. > > ciao > -- > Frank Barknecht _ ______footils.org__ > > > ------------------------------------------------------- > This SF.Net email is sponsored by: IBM Linux Tutorials > Free Linux tutorial presented by Daniel Robbins, President and CEO of > GenToo technologies. Learn everything from fundamentals to system > administration.http://ads.osdn.com/?ad_id=1470&alloc_id=3638&op=click > _______________________________________________ > sqlobject-discuss mailing list > sql...@li... > https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss > > --- "We are what we repeatedly do. Excellence then, is not an act. It is a habit." - Aristotle |
From: Frank B. <fb...@fo...> - 2004-03-17 20:58:46
|
Hallo, Victor Ng hat gesagt: // Victor Ng wrote: > I'm getting the following error in my application using SQLObject 0.5.1 > and MySQL. > > Any ideas on how to work around this problem? Install and use PostgreSQL. Sorry to say this, but at least I was fighting and googling this problem for weeks to no avail at all, I tried various patches to python-mysql, nothing helped. As my project was nearing release time, I switched to PostgreSQL the night before deadline which finally fixed all my problems. I don't know who to blame, but I don't blame me anymore. ;) No I can do python progamming again instead of struggling with a (to me) unsolvable problem. ciao -- Frank Barknecht _ ______footils.org__ |
From: Victor Ng <vn...@ma...> - 2004-03-17 16:14:30
|
I'm getting the following error in my application using SQLObject 0.5.1 and MySQL. Any ideas on how to work around this problem? I'd like to be able to set an expiry option on the connection pool so that connections will only be used 'N' number of times before they get closed and discarded. 16912 File "/usr/local/lib/python2.3/site-packages/SQLObject/Join.py", line 104, in performJoin 16913 inst.id) 16914 File "/usr/local/lib/python2.3/site-packages/SQLObject/DBConnection.py", line 328, in _SO_selectJoin 16915 return self.queryAll("SELECT %s FROM %s WHERE %s = %s" % 16916 File "/usr/local/lib/python2.3/site-packages/SQLObject/DBConnection.py", line 136, in queryAll 16917 return self._runWithConnection(self._queryAll, s) 16918 File "/usr/local/lib/python2.3/site-packages/SQLObject/DBConnection.py", line 72, in _runWithConnection 16919 val = meth(conn, *args) 16920 File "/usr/local/lib/python2.3/site-packages/SQLObject/DBConnection.py", line 129, in _queryAll 16921 c.execute(s) 16922 File "/usr/local/lib/python2.3/site-packages/MySQLdb/cursors.py", line 61, in execute 16923 r = self._query(query) 16924 File "/usr/local/lib/python2.3/site-packages/MySQLdb/cursors.py", line 168, in _query 16925 rowcount = self._BaseCursor__do_query(q) 16926 File "/usr/local/lib/python2.3/site-packages/MySQLdb/cursors.py", line 112, in __do_query 16927 db.query(q) 16928 OperationalError: (2013, 'Lost connection to MySQL server during query') |
From: Ben <be...@me...> - 2004-03-13 07:27:33
|
RE: my connection pool increasing (SQLObject 0.5.2, FreeBSD, psychopg / Postgres): i've isolated where the connection numbers are increasing: self.itemcls.select(orderBy=self.orderBySQL)[start:start+self.pa\ geLen] i found this in the release notes: Using .select() would hold on to a connection, and also release it back to the connection pool. Very un-threadsafe and all-around bad. is this bug still in existence? how do i select limit / offset without keeping allocating a connection? thanks, Ben Lee |
From: Ben <be...@me...> - 2004-03-13 05:53:59
|
sorry in advance i'm a sqlobject newbie. i'm using sqlobject 0.5.2 in mod_python + apache / freebsd with psycopg + postgres. as it is a long living server with a lot of processes, i need to keep the connection count down to avoid running out of connections. since i'm on freebsd and apache threads don't work there, i'm using the prefork model, so each child process is single-threaded. now, correct me if i'm wrong, but AFAICT this means that i should never need more than one connect per child. however i log os.getpid + DBConnection._connectionCount and i see the number growing inside the processes. this is troubling. i know SQLObject is doing connection pooling, but since it's single threaded, why is this pool growing? in fact psycopg CURSORS can be shared between threads, so we shouldn't even need more than one of those, right? help! thanks, Ben Lee |
From: charles b. <li...@st...> - 2004-03-12 10:40:04
|
Thank you Luke and Ian! alternateID was exactly what I was looking for. It always seems so obvious after the fact. :) Would it make sense to mention it earlier in the docs when talking about fetching instances that already exist? Something like the following maybe? "You can use the class method .get() to fetch instances that already exist. So if you wanted to fetch the Person by id 10, you'd call Person.get(10). To fetch using data from other unique columns, specify alternateID=True in that column's initialization and use the class method .by<ColumnName>(). (see alternateID for more detail)" Ian's lookup class example was also what I had in mind. I think there was one minor typo in the select that I fixed below, incase others try that. > > class Person(SQLObject): > def lookup(cls, email, connection=None): > return cls.select(cls.q.email=email, connection=connection)[0] > lookup = classmethod(lookup) > I need to read up on new class styles now.. :) Thanks for the pointers... -Charles. |
From: Luke O. <lu...@me...> - 2004-03-11 16:18:16
|
Sounds like you might be looking for the alternateID=True argument for columns: email = StringCol(alternateID=True) will add an access method to Person so that: user = Person.byEmail('ab...@xy...') will work. - Luke Quoting charles brandt <li...@st...>: > user = Person.select(Person.q.email=="ab...@xy...", connection=req.conn)[0] > > but that seems rather unintuitive compared to Person(10) (or Person.get(10) > now). |
From: Ian B. <ia...@co...> - 2004-03-11 08:01:57
|
On Mar 11, 2004, at 1:19 AM, charles brandt wrote: > Sorry for the newbie question, but I'm having a hard time finding the > right > way to fetch an existing class instance using a different column than > id. > Assuming the example Person class with an added "email = StringCol()", > I am > able to fetch based on the email using something like: > > user = Person.select(Person.q.email=="ab...@xy...", > connection=req.conn)[0] > > but that seems rather unintuitive compared to Person(10) (or > Person.get(10) > now). I think I'm envisioning an overridden _init but the magic of > the > metaclass is confusing me on how to implement it. I was also thinking > something along the lines of a class function (ie > user=Person.lookup("ab...@xy...", req.conn) ) would be nice, but since > it is > actually being initialized I don't think this is correct. > > Any ideas/comments? Thanks in advance... class Person(SQLObject): email = StringCol(alternateID=True) user = Person.byEmail("ab...@xy...") Or just: user = Person.select(email="ab...@xy...")[0] Or: class Person(SQLObject): def lookup(cls, email, connection=None): return cls.select(email=email, connection=connection)[0] lookup = classmethod(lookup) -- Ian Bicking | ia...@co... | http://blog.ianbicking.org |
From: charles b. <li...@st...> - 2004-03-11 07:37:11
|
Hi List, Sorry for the newbie question, but I'm having a hard time finding the right way to fetch an existing class instance using a different column than id. Assuming the example Person class with an added "email = StringCol()", I am able to fetch based on the email using something like: user = Person.select(Person.q.email=="ab...@xy...", connection=req.conn)[0] but that seems rather unintuitive compared to Person(10) (or Person.get(10) now). I think I'm envisioning an overridden _init but the magic of the metaclass is confusing me on how to implement it. I was also thinking something along the lines of a class function (ie user=Person.lookup("ab...@xy...", req.conn) ) would be nice, but since it is actually being initialized I don't think this is correct. Any ideas/comments? Thanks in advance... -Charles. |
From: Chris G. <ch...@il...> - 2004-03-11 02:19:36
|
"CLIFFORD ILKAY" <cli...@di...> wrote in message news:5.2.0.9.0.20040310151025.04674140@localhost... > If the order of the columns is not as one would expect, that would wreck > INSERT statements that rely on the position of columns rather than the > absolute name of the columns. This is probably not a problem in SQLObject > but it could be if one uses other tools to manipulate the same database. Eeeew.. there are tools that use the column number rather than the name?! What a horrible coding practice. |
From: CLIFFORD I. <cli...@di...> - 2004-03-10 23:43:24
|
At 06:14 10/03/2004 -0500, Chris Gahan wrote: >Ian answered your first question, so I'll field the second one. :) > >"Clifford Ilkay" <cli...@di...> wrote in message >news:200403091343.17553.clifford_ilkay at dinamis.com... > > testdb=# select * from person; > > id | last_name | is_member | first_name > > ----+-----------+-----------+------------ > > 1 | Duck | t | Donald > > 2 | Mouse | t | Mickey > > 3 | Mouse | t | Minnie > > 4 | Dog | t | Pluto > > 5 | Dog | t | Goofy > > (5 rows) > > > > As you can see, I tried various ways of expressing "False" but none of >them > > seemed to work. What am I missing? Also, why is the order of the columns >not > > the same as the order that was specified in the class definition? > >I haven't looked this up, but this is probably what's happening: > >When you create a subclass of an SQLObject, you're creating a new python >object. To create the table, SQLObject has to inspect this python object's >attributes to see which of them are Col() classes. Now, internally, python >stores all the attributes of a class in a dict(), so that when you look up >an attribute, it just does a lookup in the dict(). The reason they're out of >order is that dictionaries don't maintain any kind of order. The order of >the things in a dictionary depends on the order you inserted them. So, >basically, either SQLObject would have to pre-sort the dictionary, or it >would have to be psychic. Hi Chris, Thanks for explaining that. It is not a big deal for me since I do not intend to use SQLObject to create the tables anyway. I have a SQL script that I use to do that. Since one has to specify the columns/attributes in the new() method anyway, the order of columns makes no difference. Regards, Clifford Ilkay Dinamis Corporation 3266 Yonge Street, Suite 1419 Toronto, Ontario Canada M4N 3P6 Tel: 416-410-3326 |
From: CLIFFORD I. <cli...@di...> - 2004-03-10 20:42:46
|
Hello Ian, At 13:07 09/03/2004 -0600, Ian Bicking wrote: >Clifford Ilkay wrote: [snip] >>Anyway, now I can insert but, SQLObject always inserts a "t" regardless >>of whether I specify the boolean should be true or false. Here is the code: >> >>>>>from SQLObject import * >>>>>conn = PostgresConnection('user=cilkay dbname=testdb') >>>>>class Person(SQLObject): >>... _connection = conn >>... firstName = StringCol() >>... lastName = StringCol() >>... isMember = BoolCol() >>... >> >>>>>Person.createTable() >>>>>p = Person.new(firstName="Donald", lastName="Duck", isMember="t") >>>>>p = Person.new(firstName="Mickey", lastName="Mouse", isMember="f") >>>>>p = Person.new(firstName="Minnie", lastName="Mouse", isMember="0") >>>>>p = Person.new(firstName="Pluto", lastName="Dog", isMember="False") >>>>>p = Person.new(firstName="Goofy", lastName="Dog", isMember="false") > >Those are all "true" values in the Python sense (any non-empty string is >considered true). 0 (the integer) or None or False are all false in the >Python sense. Thank you very much for pointing out this simple error on my part. Once I used isMember=False or isMember=True, it worked as expected. >>testdb=# select * from person; >> id | last_name | is_member | first_name >>----+-----------+-----------+------------ >> 1 | Duck | t | Donald >> 2 | Mouse | t | Mickey >> 3 | Mouse | t | Minnie >> 4 | Dog | t | Pluto >> 5 | Dog | t | Goofy >>(5 rows) >>As you can see, I tried various ways of expressing "False" but none of >>them seemed to work. What am I missing? Also, why is the order of the >>columns not the same as the order that was specified in the class definition? > >I'm not sure what you mean by the order. According to the docs, the SQL create script that SQLObject would execute when we run Person.tableCreate() for the above class should be: create table person ( id int primary key autoincrement, first_name text, last_name text, is_member boolean ); If you look at the output of the describe table below, you will notice that the order of the columns is not as we would have expected if the SQL create script were actually as above. testdb=# \d person Table "public.person" Column | Type | Modifiers ------------+---------+------------------------------------------------------ id | integer | not null default nextval('public.person_id_seq'::text) last_name | text | is_member | boolean | first_name | text | Indexes: "person_pkey" primary key, btree (id) If the order of the columns is not as one would expect, that would wreck INSERT statements that rely on the position of columns rather than the absolute name of the columns. This is probably not a problem in SQLObject but it could be if one uses other tools to manipulate the same database. Regards, Clifford Ilkay Dinamis Corporation 3266 Yonge Street, Suite 1419 Toronto, Ontario Canada M4N 3P6 Tel: 416-410-3326 |
From: charles b. <li...@st...> - 2004-03-10 18:05:54
|
Hi List: I was wondering if it is possible to use automatic class generation = (http://sqlobject.sourceforge.net/docs/SQLObject.html#automatic-class-gen= eration) and pass a database connection object in at the time of = instance creation. I was thinking something along the lines of: from objects import Trial u =3D Trial.new(_connection=3Dreq.conn, userName=3D"WUMPUS") content =3D u.userName where Trial is: from SQLObject import * class Trial(SQLObject): _fromDatabase =3D True When I try this I'm getting an error indicating that there is no = connection object yet:=20 File "/<path>/SQLObject.py", line 523, in addColumnsFromDatabase for columnDef in cls._connection.columnsFromSchema(cls._table, cls): AttributeError: 'NoneType' object has no attribute 'columnsFromSchema' If I set Trial to: from SQLObject import * class Trial(SQLObject): userName =3D StringCol() every thing seems to work ok, so I don't think its a problem with the = connection. It does take automatic class generation out of the picture = though. Maybe something to do with the order things are initialized? I = suppose that ultimately I should define my classes manually, so maybe = its no big deal. Also, I noticed that SQLObject.new() method accepts the connection as a = keyword argument, but the standard constructor will only accept it as = the second argument? i.e. u =3D Trial(1, req.conn) Is there a more = consistent way to pass the connection to various creation methods? Thanks in advance... -Charles |
From: Ian B. <ia...@co...> - 2004-03-10 17:04:51
|
Peter Wilkinson wrote: > Hi, > I'm currently in the situation of needing to find an elegant way of > having multiple processes all use caching turned on and yet have them > track changes made in one of the other processes. > > eg. > Process A is running doing mainly reads, while process B is occasionally > making changes, process A in this situation would ideally be able to > deal with this and see the changed objects. > > Currently I'm doing this by assuming and accepting that process B will > occasionally be out of sync with he reality of the database by having it > having it kill itself periodically. Now this works but is far from > elegant and ends up defeating the use of a cache which is extremely > handy in a process that is really only deals with the database read-only. > > How have others dealt with this? Is something like putting the cache in > shared memory feasible? You can expire a single object using .expire(), which will cause it to resync with the database when you next use the object. You can expire all the objects as well, though there's no direct method for it right now. Look at DBConnection.Transaction.rollback for that. If you wanted some sort of event-based expiration, process A would have to be listening to process B in some way, and your objects in process B would have to have some notification code added. That's a little more complicated, but it would keep the two processes solidly in sync. Ian |
From: Chris G. <ch...@il...> - 2004-03-10 11:32:31
|
Ian answered your first question, so I'll field the second one. :) "Clifford Ilkay" <cli...@di...> wrote in message news:200...@di...... > testdb=# select * from person; > id | last_name | is_member | first_name > ----+-----------+-----------+------------ > 1 | Duck | t | Donald > 2 | Mouse | t | Mickey > 3 | Mouse | t | Minnie > 4 | Dog | t | Pluto > 5 | Dog | t | Goofy > (5 rows) > > As you can see, I tried various ways of expressing "False" but none of them > seemed to work. What am I missing? Also, why is the order of the columns not > the same as the order that was specified in the class definition? I haven't looked this up, but this is probably what's happening: When you create a subclass of an SQLObject, you're creating a new python object. To create the table, SQLObject has to inspect this python object's attributes to see which of them are Col() classes. Now, internally, python stores all the attributes of a class in a dict(), so that when you look up an attribute, it just does a lookup in the dict(). The reason they're out of order is that dictionaries don't maintain any kind of order. The order of the things in a dictionary depends on the order you inserted them. So, basically, either SQLObject would have to pre-sort the dictionary, or it would have to be psychic. I've been doing some research into psychic computing, and the early results have been promising, so don't rule that out! :) |
From: Peter W. <pw-...@te...> - 2004-03-10 02:05:41
|
Hi, I'm currently in the situation of needing to find an elegant way of having multiple processes all use caching turned on and yet have them track changes made in one of the other processes. eg. Process A is running doing mainly reads, while process B is occasionally making changes, process A in this situation would ideally be able to deal with this and see the changed objects. Currently I'm doing this by assuming and accepting that process B will occasionally be out of sync with he reality of the database by having it having it kill itself periodically. Now this works but is far from elegant and ends up defeating the use of a cache which is extremely handy in a process that is really only deals with the database read-only. How have others dealt with this? Is something like putting the cache in shared memory feasible? -- peter w. |
From: Ian B. <ia...@co...> - 2004-03-09 19:27:02
|
Clifford Ilkay wrote: > Hi, > > I had posted a message a few weeks ago about how I was having problems > inserting boolean columns into PostgreSQL and Ian thought it might have > something to do with an earlier version of Python 2.2. That was indeed the > case since I was using Python 2.2.2 on Mandrake 9.1. Of course that started a > never ending cycle upgrading various things eventually culminating in > installing Mandrake 10.0rc1 on another machine. Anyway, now I can insert but, > SQLObject always inserts a "t" regardless of whether I specify the boolean > should be true or false. Here is the code: > > >>>>from SQLObject import * >>>>conn = PostgresConnection('user=cilkay dbname=testdb') >>>>class Person(SQLObject): > > ... _connection = conn > ... firstName = StringCol() > ... lastName = StringCol() > ... isMember = BoolCol() > ... > >>>>Person.createTable() >>>>p = Person.new(firstName="Donald", lastName="Duck", isMember="t") >>>>p = Person.new(firstName="Mickey", lastName="Mouse", isMember="f") >>>>p = Person.new(firstName="Minnie", lastName="Mouse", isMember="0") >>>>p = Person.new(firstName="Pluto", lastName="Dog", isMember="False") >>>>p = Person.new(firstName="Goofy", lastName="Dog", isMember="false") Those are all "true" values in the Python sense (any non-empty string is considered true). 0 (the integer) or None or False are all false in the Python sense. > testdb=# select * from person; > id | last_name | is_member | first_name > ----+-----------+-----------+------------ > 1 | Duck | t | Donald > 2 | Mouse | t | Mickey > 3 | Mouse | t | Minnie > 4 | Dog | t | Pluto > 5 | Dog | t | Goofy > (5 rows) > > As you can see, I tried various ways of expressing "False" but none of them > seemed to work. What am I missing? Also, why is the order of the columns not > the same as the order that was specified in the class definition? I'm not sure what you mean by the order. Ian |
From: Clifford I. <cli...@di...> - 2004-03-09 19:00:33
|
Hi, I had posted a message a few weeks ago about how I was having problems inserting boolean columns into PostgreSQL and Ian thought it might have something to do with an earlier version of Python 2.2. That was indeed the case since I was using Python 2.2.2 on Mandrake 9.1. Of course that started a never ending cycle upgrading various things eventually culminating in installing Mandrake 10.0rc1 on another machine. Anyway, now I can insert but, SQLObject always inserts a "t" regardless of whether I specify the boolean should be true or false. Here is the code: >>> from SQLObject import * >>> conn = PostgresConnection('user=cilkay dbname=testdb') >>> class Person(SQLObject): ... _connection = conn ... firstName = StringCol() ... lastName = StringCol() ... isMember = BoolCol() ... >>> Person.createTable() >>> p = Person.new(firstName="Donald", lastName="Duck", isMember="t") >>> p = Person.new(firstName="Mickey", lastName="Mouse", isMember="f") >>> p = Person.new(firstName="Minnie", lastName="Mouse", isMember="0") >>> p = Person.new(firstName="Pluto", lastName="Dog", isMember="False") >>> p = Person.new(firstName="Goofy", lastName="Dog", isMember="false") testdb=# select * from person; id | last_name | is_member | first_name ----+-----------+-----------+------------ 1 | Duck | t | Donald 2 | Mouse | t | Mickey 3 | Mouse | t | Minnie 4 | Dog | t | Pluto 5 | Dog | t | Goofy (5 rows) As you can see, I tried various ways of expressing "False" but none of them seemed to work. What am I missing? Also, why is the order of the columns not the same as the order that was specified in the class definition? Regards, Clifford Ilkay Dinamis Corporation 3266 Yonge Street, Suite 1419 Toronto, ON M4N 3P6 Canada Tel: 416-410-3326 |
From: Ian B. <ia...@co...> - 2004-03-09 17:47:29
|
Peter Gebauer wrote: > Hello. I'm looking to make a regular join, but with testing. > > I have two tables (simplified for the example): > > class Project(SQLObject): > permissions = MultipleJoin("Permission") > > class Permission(SQLObject): > person = ForeignKey("person") > project = ForeignKey("Project") > type = EnumCol(enumValues = ['A', 'B', 'C']) > > The SQL for the select would be something like: > > SELECT project.* FROM project, permission WHERE permission.project_id = > project.project_id AND permission.person_id = 666; > > I don't know in the beginning of the program which projects actualy contain > permissions, otherwise I'd just do a myproject.permissions, what I want to > do is actualy select all projects that have permissions for a certain user. Project.select(AND(Project.q.permissionsID == Permission.q.id, Permission.q.personID == aPerson.id)) or Project.select("project.project_id = permission.project_id AND permission.person_id = %i" % aPerson.id, clauseTables=['permission']) Cheers. Ian |
From: Peter G. <pe...@fs...> - 2004-03-09 17:30:26
|
Hello. I'm looking to make a regular join, but with testing. I have two tables (simplified for the example): class Project(SQLObject): permissions = MultipleJoin("Permission") class Permission(SQLObject): person = ForeignKey("person") project = ForeignKey("Project") type = EnumCol(enumValues = ['A', 'B', 'C']) The SQL for the select would be something like: SELECT project.* FROM project, permission WHERE permission.project_id = project.project_id AND permission.person_id = 666; I don't know in the beginning of the program which projects actualy contain permissions, otherwise I'd just do a myproject.permissions, what I want to do is actualy select all projects that have permissions for a certain user. How can this be done? /Peter Gebauer |
From: Ian B. <ia...@co...> - 2004-03-09 16:04:19
|
Brad Bollenbach wrote: > My talk at last year's EuroPython may be of some use to those just > starting out with it: > > http://www.europython.org/Talks/Slides/sqlobject_ep_talk.tar.gz Certainly, I'll put that up (I'm waiting to make the page when I've collected a few more things). > The company which I work for (until Friday, Mar 12, at which point I'm > making the move to independent consulting :), XSOLI, has done a credit > card payment processing system (that's processed about $500,000 USD > since last June/Julyish), and various telephony systems for a successful > Telco in Montreal. > > Unfortunately, these systems won't demonstrate much without first paying > money to access them, so they may be of less use in "showing off" > SQLObject, but if you were interested, I could talk to Sylvain (my boss) > and Daniel and at least, perhaps, see if we can write up a little case > study about how we used it in each of these cases, and how it helped > make our clients happy. Yes, a case study or even just a one-paragraph testimonial or description of the application would be great. Ian |
From: Brad B. <br...@bb...> - 2004-03-09 14:38:40
|
On Monday, March 8, 2004, at 04:35 PM, Ian Bicking wrote: > I'm revisiting the SQLObject homepage just a little for the 0.5.2 > release, and I'd like to include links to any applications using > SQLObject, examples, wrappers, documents, articles, etc. So if you > have or know of something, please email me. > > If you have some code on your disk that you're not sure how to > distribute, email me too and maybe we can find a place for it in the > repository somewhere (ala webware-sandbox.sf.net). My talk at last year's EuroPython may be of some use to those just starting out with it: http://www.europython.org/Talks/Slides/sqlobject_ep_talk.tar.gz The company which I work for (until Friday, Mar 12, at which point I'm making the move to independent consulting :), XSOLI, has done a credit card payment processing system (that's processed about $500,000 USD since last June/Julyish), and various telephony systems for a successful Telco in Montreal. Unfortunately, these systems won't demonstrate much without first paying money to access them, so they may be of less use in "showing off" SQLObject, but if you were interested, I could talk to Sylvain (my boss) and Daniel and at least, perhaps, see if we can write up a little case study about how we used it in each of these cases, and how it helped make our clients happy. -- Brad Bollenbach |
From: Ian B. <ia...@co...> - 2004-03-09 06:26:23
|
SQLObject 0.5.2 released ------------------------ Homepage: http://sqlobject.org Download: http://prdownloads.sourceforge.net/sqlobject/SQLObject-0.5.2.tar.gz? download News: http://sqlobject.org/docs/News.html#sqlobject-0-5-2 What's Changed? --------------- 0.5.2 is a bug fix release, particularly a thread-related bug when using extended selects. All users are recommended to upgrade. What is it? ----------- SQLObject is an object relational mapper. It allows you to easily create an object interface to your database -- tables are classes, rows are instances. Its goals are ease of use and low barrier to entry, while maintaining the ability to customize and extend your classes as your needs grow. -- Ian Bicking | ia...@co... | http://blog.ianbicking.org |