sqlobject-discuss Mailing List for SQLObject (Page 42)
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: Markos K. <mk...@gm...> - 2010-02-26 20:14:08
|
So, I had a class that had an internal _connection. When I tried to pickle it, I got errors, which from the looks of main were related to whether I had a per instance connection or went through sqlhub. So I rewrote the class & code as follows: connection = connectionForURI('mysql://%s:%s@%s:3306/%s?debug=1&use_unicode=1&charset=utf8' % (dbuser,dbpass,dbhost,dbname)) sqlhub.processConnection = connection class Title(SQLObject): class sqlmeta: fromDatabase = True books = MultipleJoin('Book') author = RelatedJoin('Author', intermediateTable='author_title',createRelatedTable=True) categorys = MultipleJoin('Category') kind = ForeignKey('Kind') listTheseKeys=('kind') but I'm still getting the same PicklingError. What can I be missing? I've seen a few recent posts about fixing this, but is there a workaround? Thank much --Marko /Users/mkapes/Downloads/infoshopkeeper/AmazonAuthorTitle.py in <module>() 40 except KeyError: 41 ourTitles=list(Title.select(RLIKE(Title.q.isbn, '^[0-9]{9}[0-9xX]{1}$') & (Title.q.kindID==1))) ---> 42 shelf['ourTitles']=ourTitles 43 44 /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/shelve.pyc in __setitem__(self, key, value) 130 f = StringIO() 131 p = Pickler(f, self._protocol) --> 132 p.dump(value) 133 self.dict[key] = f.getvalue() 134 /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/SQLObject-0.13dev_r4106-py2.6.egg/sqlobject/main.pyc in __getstate__(self) 1679 if self.sqlmeta._perConnection: 1680 from pickle import PicklingError -> 1681 raise PicklingError('Cannot pickle an SQLObject instance that has a per-instance connection') 1682 d = self.__dict__.copy() 1683 del d['sqlmeta'] PicklingError: Cannot pickle an SQLObject instance that has a per-instance connection > /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/site-packages/SQLObject-0.13dev_r4106-py2.6.egg/sqlobject/main.py(1681)__getstate__() 1680 from pickle import PicklingError -> 1681 raise PicklingError('Cannot pickle an SQLObject instance that has a per-instance connection') 1682 d = self.__dict__.copy() |
From: Oleg B. <ph...@ph...> - 2010-02-20 12:08:00
|
On Sat, Feb 20, 2010 at 12:03:03PM +0200, Neil Muller wrote: > On 19 February 2010 17:14, Oleg Broytman <ph...@ph...> wrote: > > I haven't started to move to Py3k myself. The biggest problem is that I > > don't see DB AP drivers for Py3k > > I have no idea about the status of MySQLdb, but psycopg did have > several patches for python3 support applied a while ago. I believe > it's current state is "mostly works with python 3". Thank you. "Mostly works" is a good state to start experimenting, but not as good to start using it in real programs; seems I will not port my programs to Python3 in the nearest future. Oleg. -- Oleg Broytman http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Neil M. <drn...@gm...> - 2010-02-20 10:03:11
|
On 19 February 2010 17:14, Oleg Broytman <ph...@ph...> wrote: > I haven't started to move to Py3k myself. The biggest problem is that I > don't see DB AP drivers for Py3k (SQLObject uses DB API drivers to connect > to backends and to pass SQL queries). I think sqlite3 driver is ok, but > where can I download psycopg or MySQLdb for Python3 (these are the three > major supported backend)? Are current versions of these drivers support > Python3 out of the box? with some patches? I have no idea about the status of MySQLdb, but psycopg did have several patches for python3 support applied a while ago. I believe it's current state is "mostly works with python 3". -- Neil Muller drn...@gm... I've got a gmail account. Why haven't I become cool? |
From: Oleg B. <ph...@ph...> - 2010-02-19 15:14:33
|
Hello. On Fri, Feb 19, 2010 at 03:00:18PM +0000, Alan Harris-Reid wrote: > Can anyone tell me if a Python 3 version of SQLObject is available yet? > If not, does anyone know of any plans to port it? It seems I'm the only active developer left though there are many users; among them there are people who send bug reports and even patches. I haven't started to move to Py3k myself. The biggest problem is that I don't see DB AP drivers for Py3k (SQLObject uses DB API drivers to connect to backends and to pass SQL queries). I think sqlite3 driver is ok, but where can I download psycopg or MySQLdb for Python3 (these are the three major supported backend)? Are current versions of these drivers support Python3 out of the box? with some patches? If there were Python3-compatible drivers (sqlite3, at least) you can test if SQLObject works with Py3k and report problems or even better send patches. If the patches are compatible with Python 2 I can just include them in the code. If they are not I will create a separate branch for Python3 (and install Python3 myself to run tests). Oleg. -- Oleg Broytman http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Alan Harris-R. <aha...@go...> - 2010-02-19 15:00:26
|
Hi, Can anyone tell me if a Python 3 version of SQLObject is available yet? If not, does anyone know of any plans to port it? Thanks, Alan |
From: Oleg B. <ph...@ph...> - 2010-02-15 21:16:42
|
Hello! I started to look at the patch. Almost everything is ok. Just one question: why 'utf8' is added to kw? are you sure you always want it there? in this spelling - 'utf8'? looks more like mysql... If you really want it there you don't need to test for it in kw at the end of __init__. Oleg. -- Oleg Broytman http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Oleg B. <ph...@ph...> - 2010-02-12 19:17:58
|
On Fri, Feb 12, 2010 at 08:57:06AM -1000, John Bresnahan wrote: > I would like to disable autocommit on my underlying database connection. What method do I use to > force a commit on the connection? I realize that a transaction object has a commit() method, but > how do I do a similar thing with the connection i acquired via: > > sqlhub.processConnection = connectionForURI(config.dburl) The object created by connectionForURI() is not a DB API connection but an instance of SQLObject's class DBConnection; it's a high-level object that remembers connection parameters; it opens and closes real DB connections when they are needed, it maintains a pool of opened connections (for multithreaded applications, e.g.). But it cannot be committed because it's not a real connection (what low-level connection from the pool are to be committed?) Use transactions. Oleg. -- Oleg Broytman http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: John B. <bre...@mc...> - 2010-02-12 18:57:22
|
Hello, I would like to disable autocommit on my underlying database connection. What method do I use to force a commit on the connection? I realize that a transaction object has a commit() method, but how do I do a similar thing with the connection i acquired via: sqlhub.processConnection = connectionForURI(config.dburl) Thanks, John |
From: Oleg B. <ph...@ph...> - 2010-02-08 18:17:59
|
Hi! I applied the patch with an additional test - that the connection is not a transaction and is in autocommit mode. A transaction or non-autocommit connection must be rolled back after a exception but the place for the rollback is application-dependent so I didn't include a rollback in the code. Inside a transaction it's also usually impossible to remove the parent row(s) after an error - the only thing that's allowed is a rollback. Committed in the revisions 4101-4103 (branches 0.11, 0.12 ad the trunk). Thank you! On Mon, Dec 07, 2009 at 06:41:54PM +0200, Tom Coetser wrote: > I am doing some tests with InheritableSQLobject and have run into a problem > which I hope to get some feedback on. > > The problem is that when creating a new object based on an > InheritableSQLObject class, and the creation of the child object fails after > a new parent was created, the parent record will remain in the database > without the relevant child. > > Here is a short example: > > ~~~~~~~~~~ file: inheritTest3.py ~~~~~~~~~~~~ > from sqlobject import * > from sqlobject.inheritance import InheritableSQLObject > > __connection__ = "sqlite:/:memory:" > > class Vehicle(InheritableSQLObject): > vid = StringCol(notNone=True, default=None, unique=True) > wheels = IntCol() > > class Bicycle(Vehicle): > seats = IntCol(notNone=True, default=None) > > class Car(Vehicle): > doors = IntCol(notNone=True, default=None) > > def createTables(): > Vehicle.createTable() > Bicycle.createTable() > Car.createTable() > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > Here is a sample session showing the problem when trying to create a bicycle > but only supplying the args required for the Vehicle part of the object: > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > In [1]: from inheritTest3 import * > > In [2]: createTables(True) > > In [3]: b = Bicycle(vid="id1", wheels=4) > ERROR: An unexpected error occurred while tokenizing input > The following traceback may be corrupted or invalid > The error message is: ('EOF in multi-line statement', (22, 0)) > > --------------------------------------------------------------------------- > IntegrityError Traceback (most recent call last) > > /home/tomc/mobilereporter.repo/main/app/<ipython console> in <module>() > > /usr/lib/python2.5/site-packages/sqlobject/main.pyc in __init__(self, **kw) > 1221 id = None > 1222 > -> 1223 self._create(id, **kw) > 1224 > > .... snipping lots of traceback parts ............ > > /usr/lib/python2.5/site-packages/sqlobject/sqlite/sqliteconnection.pyc in > _executeRetry(self, conn, cursor, query) > 187 raise DuplicateEntryError(msg) > 188 else: > --> 189 raise IntegrityError(msg) > 190 except self.module.InternalError, e: > 191 raise InternalError(ErrorMessage(e)) > > IntegrityError: bicycle.seats may not be NULL > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > If you now supply all required args for the bicycle, using the same field > values for the vid and wheels as before, a duplicate entry error is raised: > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > In [4]: b = Bicycle(vid="id1", wheels=4, seats=2) > ERROR: An unexpected error occurred while tokenizing input > The following traceback may be corrupted or invalid > The error message is: ('EOF in multi-line statement', (22, 0)) > > --------------------------------------------------------------------------- > DuplicateEntryError Traceback (most recent call last) > > /home/tomc/mobilereporter.repo/main/app/<ipython console> in <module>() > > /usr/lib/python2.5/site-packages/sqlobject/main.pyc in __init__(self, **kw) > 1221 id = None > 1222 > -> 1223 self._create(id, **kw) > 1224 > 1225 for func in post_funcs: > > .... snipping lots of traceback parts ............ > > /usr/lib/python2.5/site-packages/sqlobject/sqlite/sqliteconnection.pyc in > _executeRetry(self, conn, cursor, query) > 185 msg = ErrorMessage(e) > 186 if msg.startswith('column') and msg.endswith('not > unique'): > --> 187 raise DuplicateEntryError(msg) > 188 else: > 189 raise IntegrityError(msg) > > DuplicateEntryError: column vid is not unique > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > The duplicate entry is because of the parent vehicle record was created when > the first bicycle creation failed: > > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > In [5]: q = "SELECT * from vehicle" > > In [6]: Vehicle._connection.queryAll(q) > Out[6]: [(1, 'id1', 4, 'Bicycle')] > ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ > > So, the problem is that if a new child object is created, but fails after the > parent has been created, the parent is left in tact in the database. > > I'm attaching a patch as a possible fix for this, but I am not sure under > which other circumstances this patch will cause other problems. Maybe a flag > is needed inside the block that creates the child (parentCreatedHere=True), > and only if this flag is set, should the parent be deleted in exception if > the child creation failed? > > I would appreciate if someone with more insight into this can look at the > patch an modify where neccessary. > > BTW: This patch is against SQLObject 0.11.0. > > > > Cheers, > Tom > --- inheritance/__init__.py.orig 2009-12-07 14:47:31.000000000 +0000 > +++ inheritance/__init__.py 2009-12-07 16:35:39.000000000 +0000 > @@ -384,7 +384,19 @@ > > id = self._parent.id > > - super(InheritableSQLObject, self)._create(id, **kw) > + # TC: Create this record and catch all exceptions in order to destroy > + # TC: the parent if the child can not be created. > + try: > + super(InheritableSQLObject, self)._create(id, **kw) > + except: > + # TC: If we are the child, destroy the parent > + if self.sqlmeta.parentClass: > + self._parent.destroySelf() > + #TC: Do we need to do this?? > + self._parent = None > + # TC: Reraise the original exception > + raise > + > > def _findAlternateID(cls, name, dbName, value, connection=None): > result = list(cls.selectBy(connection, **{name: value})) Oleg. -- Oleg Broytman http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Oleg B. <ph...@ph...> - 2010-02-08 14:54:05
|
On Mon, Feb 08, 2010 at 02:11:00PM +0200, Tom Coetser wrote: > + from_python = to_python > + Thank you. I will test it. Oleg. -- Oleg Broytman http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Tom C. <su...@ic...> - 2010-02-08 14:05:46
|
Hi Oleg, I'm just wondering if there is a reason why the TimeValidator class in Col.py does not also have the from_python method defined to be: from_python = to_python as is done for in the DateValidator class? With this method defined in the DateValidator for example, one can set the date for a DateCol field using a string like "2010-01-31", without having to first instantiate a datetime.date() instance. The column validators chain would take care of converting the string to the correct type for the DateCol, depending on the column's dateFormat specification, of course. But, the TimeValidator does not have the from_python method set like for the DateValidator, which means that one can not conveniently use string of the format "17:59:20" to set the value for a TimeCol(), and must first create and instance of datetime.time() in order to set the TimeCol() value. Since SOTimeCol already have a timeFormat attribute which seems to be used in exactly the same way as the dateFormat attr for a DateCol, it seems that setting the from_python method on TimeValidator may just have been an oversight, or else there is another reason I am not aware of. If it is an oversight, the small patch attached would allow strings to be used to set TimeCol values just as they are now conveniently usable for setting DateCol values. IWBN if you can have a quick look and see if this can be added to future releases. Cheers, Tom |
From: Petr J. <pet...@tp...> - 2010-02-08 08:06:16
|
> > There is the way: .select() (and sqlbuilder.Select) accept a boolean > parameters lazyColumns that does what you want! With lazyColumns=True > .select() only SELECTs IDs, and then attributes will be loaded one by one > or all at once depending on the cacheValues. > Thank a lot for reply. I have made a view in the database and I do not care about number of columns (data cells) returned in one select request any more. The number of returned columns is "regulated" by the view SQL machinery. |
From: Petr J. <pet...@tp...> - 2010-02-07 22:08:47
|
> You can execute the query but you cannot get the results as a list of > SQLObject instances because there are no declarations of columns with sum() > and other expressions. The result will be a list of tuples. > Yes, I know, but sometimes it is OK to get not-object data (some nasty complicated SQL queries for example) Thanks Oleg, thanks Sean |
From: Oleg B. <ph...@ph...> - 2010-02-07 20:46:56
|
On Sun, Feb 07, 2010 at 09:06:42PM +0100, Petr Jake?? wrote: > I would like to query the database something like this: > > select sum(quantity) as qty, product_name, sum(quantity) * price * > (1+tax_rate/100) > FROM `prestashop`.`ps_view_new_order_detail` > where id_order = 1 > group by product_name > > Is there a way to drop this "handcrafted" query to the SQLObject and > get the result? You can execute the query but you cannot get the results as a list of SQLObject instances because there are no declarations of columns with sum() and other expressions. The result will be a list of tuples. Oleg. -- Oleg Broytman http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Sean D. <hal...@gm...> - 2010-02-07 20:25:44
|
> Is there a way to drop this "handcrafted" query to the SQLObject and > get the result? > I think you can use Prestashop._connection.queryAll("SELECT ...") ~Sean |
From: Petr J. <pet...@tp...> - 2010-02-07 20:06:50
|
Hi, I have feeling it has been discussed already in the past, but I can not find the answer in the list archive. I would like to query the database something like this: select sum(quantity) as qty, product_name, sum(quantity) * price * (1+tax_rate/100) FROM `prestashop`.`ps_view_new_order_detail` where id_order = 1 group by product_name I think it is not possible to create similar kind of queries through the SQLObject. (http://www.sqlobject.org/FAQ.html#what-about-group-by-union-etc) Is there a way to drop this "handcrafted" query to the SQLObject and get the result? Regards Petr |
From: Petr J. <pet...@tp...> - 2010-02-07 15:20:42
|
> > fromDatabase machinery for MySQL takes into account parameters from DB > URI - 'use_unicode' and 'charset'. If use_unicode is set to True (1) > columnsFromSchema() replaces all StringCol by UnicodeCol with charset as > its dbEncoding. > Thanks. This works great. |
From: Oleg B. <ph...@ph...> - 2010-02-07 14:46:53
|
On Thu, Feb 04, 2010 at 10:15:27PM +0100, Petr Jake?? wrote: > > There is no currently. What do you want? To define an encoding for all > > UnicodeCol'umns at once? > > > Yes, that was the main idea. When I am working with existing database, I do > not declare columns manually (I am using fromDatabase = True). fromDatabase machinery for MySQL takes into account parameters from DB URI - 'use_unicode' and 'charset'. If use_unicode is set to True (1) columnsFromSchema() replaces all StringCol by UnicodeCol with charset as its dbEncoding. Oleg. -- Oleg Broytman http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Oleg B. <ph...@ph...> - 2010-02-06 17:31:22
|
On Sat, Feb 06, 2010 at 04:54:07PM +0100, Petr Jake?? wrote: > MyTable.select() method results to the > SELECT my_table.* FROM my_table (or ALL column names are named explicitly) > > Is there a way to retrieve just some *columns*, not all of them. There is the way: .select() (and sqlbuilder.Select) accept a boolean parameters lazyColumns that does what you want! With lazyColumns=True .select() only SELECTs IDs, and then attributes will be loaded one by one or all at once depending on the cacheValues. Oleg. -- Oleg Broytman http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Oleg B. <ph...@ph...> - 2010-02-06 17:23:43
|
On Sat, Feb 06, 2010 at 12:20:10AM +0100, Petr Jake?? wrote: > > Yes, and idMessage/id_message must not be there. It is there because of > > a bug. So help me to chase the bug. > > > > SHOW COLUMNS FROM ps_message_readed > > > > (just run the query) > > I see, I was trying to get it from within the Python. > > Result attached. Thank you. The results look good. Method columnsFromSchema() should recognize the id column 'id_message'... but it doesn't. Strange. Oleg. -- Oleg Broytman http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Oleg B. <ph...@ph...> - 2010-02-06 17:18:05
|
On Sat, Feb 06, 2010 at 04:54:07PM +0100, Petr Jake?? wrote: > MyTable.select() method results to the > SELECT my_table.* FROM my_table (or ALL column names are named explicitly) > > Is there a way to retrieve just some rows, not all of them. Some columns, you mean? No, SQLObject instance can only select all of the column or none of them. Perhaps "none of them" is what you whant. Set class sqlmeta: cacheValues = False Now every attribute access executes a separate SELECT query just to select this column from the table. If you read only a few attributes there will be only a few SELECTs. But I doubt it is faster or takes less memory than one wide SELECT. I'd very much like to recommend to experiment and find out what way is really faster. Oleg. -- Oleg Broytman http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Oleg B. <ph...@ph...> - 2010-02-06 17:07:15
|
On Sat, Feb 06, 2010 at 10:43:43AM -0300, Juan Manuel wrote: > Can the .select() or .selectBy() methods take the connection to use as a > parameter (even if I pass it a normal connection object, and not one > obtained from a transaction? If that's true then all is well :) Yes. I have already said this - all SQLObject methods accept 'connection' parameter that must be a connection or a transaction object. Default for the parameter is None meaning "obtain the connection from the corresponding SQLObject class". Oleg. -- Oleg Broytman http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Petr J. <pet...@tp...> - 2010-02-06 15:54:18
|
MyTable.select() method results to the SELECT my_table.* FROM my_table (or ALL column names are named explicitly) Is there a way to retrieve just some rows, not all of them. something what results to to the query like this: SELECT my_table.columnA, my_table.columnB FROM my_table (suppose there are also columns my_table.columnC, my_table.columnD ... in the table). Sometimes the tables I am working with are very wide (more than 100 columns) an I am connected them over the internet, so forcing the select method to retrieve only requested rows will be great. Best Regards Petr |
From: Juan M. <vic...@gm...> - 2010-02-06 14:10:04
|
On Sat, Feb 6, 2010 at 9:49 AM, Petr Jakeš <pet...@tp...> wrote: > > > hmm... what about: > > http://www.sqlobject.org/SQLObject.html#sqlobject-class > http://www.sqlobject.org/SQLObject.html#transactions > http://www.sqlobject.org/SQLObject.html#dynamic-classes > > To be honest, I do not have experiences with this, but it looks the > way to go ... > Can the .select() or .selectBy() methods take the connection to use as a parameter (even if I pass it a normal connection object, and not one obtained from a transaction? If that's true then all is well :) Thanks! |
From: Petr J. <pet...@tp...> - 2010-02-06 12:50:23
|
> > As an example: currently when you scan a directory, there are two treeviews > which are populated: the left one with the entire directory structure (only > dirs), and the right one with the contents of the currently selected dir > (much like windows explorer). If you scan another dir, the treeviews are > wiped and all references to the previous scan are wiped too. My aim is to, > instead of wiping all that, keep it and open a new tab (with another two > treeviews), show the new catalog in that new tab, and be able to switch > between tabs and vieweing both catalogs at the same time.T > hmm... what about: http://www.sqlobject.org/SQLObject.html#sqlobject-class http://www.sqlobject.org/SQLObject.html#transactions http://www.sqlobject.org/SQLObject.html#dynamic-classes To be honest, I do not have experiences with this, but it looks the way to go ... |