sqlobject-discuss Mailing List for SQLObject (Page 41)
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: Jason H. <jas...@gm...> - 2010-03-31 00:37:39
|
On 30 March 2010 18:04, Oleg Broytman <ph...@ph...> wrote: > The error I can see is the second parameter to Select(). You don't need > to pass the table class - Select derives it from the item ContItem.q.dbStock. > The second parameter to Select is WHERE clause; if you don't need it just > omit it. Using: my_selection = dbase.Stock.select( sqlobject.sqlbuilder.AND( dbase.Stock.q.dbStockCode.startswith("XXX"), sqlobject.sqlbuilder.NOTIN( sqlobject.sqlbuilder.Outer(dbase.Stock).q.id, sqlobject.sqlbuilder.Select(dbase.ContItem.q.dbStock))) ... gives exactly the same error though. Cheers, Jason |
From: Oleg B. <ph...@ph...> - 2010-03-30 10:04:44
|
On Tue, Mar 30, 2010 at 11:58:36AM +0800, Jason Heeris wrote: > sqlobject.sqlbuilder.Select(dbase.ContItem.q.dbStock, dbase.ContItem) [skip] > TypeError: iteration over non-sequence The error I can see is the second parameter to Select(). You don't need to pass the table class - Select derives it from the item ContItem.q.dbStock. The second parameter to Select is WHERE clause; if you don't need it just omit it. Oleg. -- Oleg Broytman http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Jason H. <jas...@gm...> - 2010-03-30 03:58:42
|
Hi, This is on Python 2.5.5 with SQLObject 0.11.0 and MySQL 5.1.41-3 (on Debian Squeeze). I'm a little mystified about the SQLBuilder subselector NOTIN(). I have the following MySQL query: SELECT db_stock_code FROM stock WHERE (db_stock_code LIKE "XXX%") AND (id NOT IN (SELECT db_stock_id FROM cont_item)); ...which works for me. "stock" is a very simple table (no joins or anything), and "cont_item" is like: class ContItem (SQLObject) : dbCont = ForeignKey('Cont') dbStock = ForeignKey('Stock') dbQuantity = IntCol() (The actual table has "db_stock_id" and "db_cont_id" columns.) I tried to use this SQLBuilder expression: my_selection = dbase.Stock.select( sqlobject.sqlbuilder.AND( dbase.Stock.q.dbStockCode.startswith("XXX"), sqlobject.sqlbuilder.NOTIN( sqlobject.sqlbuilder.Outer(dbase.Stock).q.id, sqlobject.sqlbuilder.Select(dbase.ContItem.q.dbStock, dbase.ContItem))) ...but when it executes, I get: [coming from that last line of my expression above] File "/usr/lib/python2.5/site-packages/sqlobject/main.py", line 1365, in select join=join, forUpdate=forUpdate) File "/usr/lib/python2.5/site-packages/sqlobject/sresults.py", line 36, in __init__ for table in clauseTables: TypeError: iteration over non-sequence I'd like to point out that (a) the whole SELECT statement above returns a few hundred results, and (b) the second clause to AND does exclude some entries. Please CC me on replies :) Cheers, Jason |
From: Oleg B. <ph...@ph...> - 2010-03-23 16:41:12
|
On Tue, Mar 23, 2010 at 12:57:19AM -0300, Juan Manuel Santos wrote: > Are there any ideas on why would SQLO > be a bit slower When you declare a table class MyTable(SQLObject): ...columns... and do an INSERT by calling MyTable(columns) SQLObject immediately does a SELECT to get back autogenerated fields (timestamps and the like) This is slow. It's ok to create rows like this occasionally but it is certainly bad for mass-insertion. For mass-insertion use SQLBuilder. Alas, it's underdocumented. Go by example: record = {'column1': value1, 'column2': value2, ...} connection.query(connection.sqlrepr( sqlbuilder.Insert(MyTable.sqlmeta.table, values=record))) These are simple straightforward INSERTs without any additional high-level burden - no SELECT, no caching, nothing. Fire and forget. It is not as high-level as calling MyTable() but it is still high enough - sqlrepr() does value conversion and quoting, e.g. Oleg. -- Oleg Broytman http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Simon C. <hod...@gm...> - 2010-03-23 08:30:37
|
On Tue, Mar 23, 2010 at 7:50 AM, Juan Manuel Santos <vic...@gm...> wrote: > Sorry, missed that detail. In all cases I used SQLite, with pysqlite at > version 2.5.6. > Python is version 2.6.4 Without actual source snippets to look at it's hard to say anything for certain but: Inserting records one at a time into any of the SQL databases is very slow. SQLObject always creates objects immediately and so creating lots of objects can be relatively slow. In SQLAlchemy there are ways to batch create objects. Once can use SQLObject's query builder to create mass inserts [1]. It's not extensively well documented and you'll have to be careful with how manual inserts interact with SQLObject's object cache. If you set object attributes one by one, SQLObject sends an update query each time you update an attribute. You can gain more control over when updates happen using lazy updates [2]. SQLite is by default quite aggressive about syncing changes to disk. You can (temporarily) chose speed over data integrity using the synchronous SQLite pragma [3]. Finally, if you set a SQLObject connection to debug [4] it will print out all the SQL queries made allowing you to debug these sorts of performance issues. Generally speaking, fewer queries means better performance. :) [1] http://www.sqlobject.org/SQLBuilder.html [2] http://www.sqlobject.org/SQLObject.html#lazy-updates [3] http://www.sqlite.org/pragma.html [4] http://www.sqlobject.org/SQLObject.html#declaring-a-connection |
From: Juan M. S. <vic...@gm...> - 2010-03-23 05:51:10
|
Sorry, missed that detail. In all cases I used SQLite, with pysqlite at version 2.5.6. Python is version 2.6.4 Cheers Juan Manuel From: Simon Cross <hod...@gm...> To: sql...@li... Date: Tuesday 23 March 2010 > On Tue, Mar 23, 2010 at 5:57 AM, Juan Manuel Santos > > <vic...@gm...> wrote: > > SQLObject: > > Text files: > > real 0m25.704s > > user 0m3.240s > > sys 0m1.424s > > > > SQLAlchemy/Elixir: > > Text files: > > real 0m13.754s > > user 0m6.696s > > sys 0m0.504s > > Which database backend are you using? > > Schiavo > Simon > > --------------------------------------------------------------------------- > --- Download Intel® Parallel Studio Eval > Try the new software tools for yourself. Speed compiling, find bugs > proactively, and fine-tune applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev > _______________________________________________ > sqlobject-discuss mailing list > sql...@li... > https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss |
From: Juan M. S. <vic...@gm...> - 2010-03-23 05:50:16
|
Sorry, missed that detail. In all cases I used SQLite, with pysqlite at version 2.5.6. Python is version 2.6.4 Cheers Juan Manuel From: Simon Cross <hod...@gm...> To: sql...@li... Date: Tuesday 23 March 2010 > On Tue, Mar 23, 2010 at 5:57 AM, Juan Manuel Santos > > <vic...@gm...> wrote: > > SQLObject: > > Text files: > > real 0m25.704s > > user 0m3.240s > > sys 0m1.424s > > > > SQLAlchemy/Elixir: > > Text files: > > real 0m13.754s > > user 0m6.696s > > sys 0m0.504s > > Which database backend are you using? > > Schiavo > Simon > > --------------------------------------------------------------------------- > --- Download Intel® Parallel Studio Eval > Try the new software tools for yourself. Speed compiling, find bugs > proactively, and fine-tune applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev > _______________________________________________ > sqlobject-discuss mailing list > sql...@li... > https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss |
From: Simon C. <hod...@gm...> - 2010-03-23 05:44:16
|
On Tue, Mar 23, 2010 at 5:57 AM, Juan Manuel Santos <vic...@gm...> wrote: > SQLObject: > Text files: > real 0m25.704s > user 0m3.240s > sys 0m1.424s > SQLAlchemy/Elixir: > Text files: > real 0m13.754s > user 0m6.696s > sys 0m0.504s Which database backend are you using? Schiavo Simon |
From: Juan M. S. <vic...@gm...> - 2010-03-23 03:57:40
|
Hi everybody, First of all, before anybody attacks me, I do not intend to start a flamewar. I have simply been testing out SQLObject and SQLAlchemy/Elixir for a program I'm writing (I previously posted on some issues I had). If I am to be honest, I like SQLObject a lot more, because its syntax and way of doing things is, IMHO, simpler and more Python-like. And I wouldn't have tried out Alchemy in the first place if it wasn't for Elixir. After battling between tutorials and documentation, I finally managed to create another development branch, based on my SQLObject one, fully working with Alchemy/Elixir. I did this (keeping two copies of the program in the same repo, with different backends) so as to do a speed comparison between the two. Again, not that I don't like SQLO, but I just wanted to see which one was faster, since it benefits my application, and WHY it was faster. The app I am talking about is a filesystem indexer, like Gnomecatalog or Basenji. Basically it scans the filesystem recursively and for every entry (file or directory), it extracts some metadata about it and stores it in a DB, so it can be accessed later (perfect for those storage HDs you have full of stuff you don't want to index by hand :)). Originally I just kept the whole scan content in memory and pickled it when asked, but with huge directories it turned into a problem, so I started looking for an alternative in the DB field. I haven't thoroughly scanned it, neither is my scanning method the most scientific one, but the results I got so far seem to point out that Alchemy/Elixir is faster than SQLO. I did two scans, one with some small text files in just one directory, and another one with plenty (1GB+) of wallpapers split into two directories. Here are the results: SQLObject: Text files: real 0m25.704s user 0m3.240s sys 0m1.424s Wallpapers: real 5m25.644s user 3m6.760s sys 0m16.881s SQLAlchemy/Elixir: Text files: real 0m13.754s user 0m6.696s sys 0m0.504s Wallpapers: real 3m58.949s user 3m4.392s sys 0m7.244s Of course, numbers may not be that big, but there is a difference which I figure would increase on bigger scans. Are there any ideas on why would SQLO be a bit slower than Alchemy? Is there something that can be done to amend this? If anybody wants to check out the code, its at git://vicarious.com.ar/indexor.git, or at github on http://github.com/godlike64/indexor. The branches are dev/godlike/elixir for the Elixir one, and dev/godlike/bleeding for the SQLObject one. Any questions feel free to ask me :) Cheers Juan Manuel Santos PS: the program is of course in development, so some things may not quite work. Actually, I timed it by opening, ordering it to scan a directory, and closing the window. After the scan finishes (in complete background), the program exits and you get the time prompt). |
From: Oleg B. <ph...@ph...> - 2010-03-17 17:58:00
|
On Sun, Feb 28, 2010 at 05:13:39PM +0200, Imri Goldberg wrote: > In command.py, line 211 (sqlobject 0.12.1, in findReverseDependencies() ) > change from: > > if other not in depended: > > to: > > if other is not cls and other not in depended: Committed in the revision 4135 in the trunk. Thank you! Oleg. -- Oleg Broytman http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Oleg B. <ph...@ph...> - 2010-03-17 17:21:44
|
Hello! RdbhostConnection is added to the trunk in the revision 4132. Thank you! Oleg. -- Oleg Broytman http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Oleg B. <ph...@ph...> - 2010-03-16 14:44:59
|
ji...@ql..., please answer to the mailing list, not to me personally. Oleg. -- Oleg Broytman http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Oleg B. <ph...@ph...> - 2010-03-15 10:29:36
|
Hi. Please answer to the list, not to my personal address. On Fri, Mar 12, 2010 at 04:09:23PM -0600, ji...@ql... wrote: > My apologies for providing the superfluous info. I was just trying to be thorough. However, I've inserted the following code and again, am not getting to the second debug statement. > > def _set_dateRequested(self, value): > dateRequested = value.strftime('%Y/%m/%d') > log.debug('here') > requisitionPeriod = self.requisitionPeriod.id > log.debug(requisitionPeriod) With Python, a code is either executed, or raise an exception, or crash an interpreter. Did the code raise an exception or crash the interpreter? Perhaps, no. Hence the code was executed. How come requisitionPeriod was not in the log? I am not sure. It could be because it is None, though it's stranage for a ForeignKey. Try logging it with additional text: log.debug('requisitionPeriod=%s', requisitionPeriod) Even better log it with its type: log.debug('requisitionPeriod: %r %s', type(requisitionPeriod), requisitionPeriod) Oleg. -- Oleg Broytman http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Oleg B. <ph...@ph...> - 2010-03-12 21:56:53
|
Hi. It's too hard to read a message with a lot of boring and unnecessary details and too much of empty lines. Next time you want to ask a question please simplify it a bit. On Fri, Mar 12, 2010 at 02:37:27PM -0600, ji...@ql... wrote: > class Requisition(SQLObject): > requisitionPeriod = ForeignKey('RequisitionPeriod', > dbName='requisitionPeriodId') > > def _set_dateRequested(self, value): > dateRequested = value > > log.debug('here') > > requisitionPeriodId = self._SO_get_requisitionPeriod() You do want self.requisitionPeriod.id, don't you? requisitionPeriodId = self.requisitionPeriod.id > log.debug(requisitionPeriodId) > > When I try to add a Requistion, in my debug output I get to the first debug statement, but never to the second. I'm assuming it is because I'm specifying something wrong on - requisitionPeriodId = self._SO_get_requisitionPeriod() - but I don't know what I'm doing wrong. How do I specify this with a ForeignKey field? Oleg. -- Oleg Broytman http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: <ji...@ql...> - 2010-03-12 21:38:43
|
Hi I have a method inside my class definition that I want to use to validate a field before allowing the data to be saved. Here is the def: class Requisition(SQLObject): class sqlmeta: style = Style(longID=True) idName = 'requisitionId' plant = ForeignKey('Plant', dbName='plantId') requisitionPeriod = ForeignKey('RequisitionPeriod', dbName='requisitionPeriodId') requisitionStatus = ForeignKey('RequisitionStatus') itemNumber = UnicodeCol(length=15) itemName = UnicodeCol(length=50) requestedBy = ForeignKey('User', dbName='requestedById') dateRequested = DateCol() quantity = IntCol() uom = UnicodeCol(length=20) quantityReceived = DecimalCol(size=12, precision=4) dateReceived = DateCol() dateCanHold = DateCol() dateNeeded = DateCol() notes = UnicodeCol() dateOrdered = DateCol() poNumber = UnicodeCol(length=50) orderNumber = IntCol() ingCost = DecimalCol(size=12, precision=2) frtCost = DecimalCol(size=12, precision=2) supplier = ForeignKey('Vendor', dbName='supplierId', cascade=False) carrier = ForeignKey('Vendor', dbName='carrierId', cascade=False) driver = ForeignKey('Driver', dbName='driverId', cascade=False) bolNumber = UnicodeCol(length=50) ingInvoice = UnicodeCol(length=20) prepaid = BoolCol(default=False) requisitionGroup = IntCol(default=0) createdOn = DateTimeCol(default=datetime.now) def _set_dateRequested(self, value): dateRequested = value log.debug('here') requisitionPeriodId = self._SO_get_requisitionPeriod() log.debug(requisitionPeriodId) When I try to add a Requistion, in my debug output I get to the first debug statement, but never to the second. I'm assuming it is because I'm specifying something wrong on - requisitionPeriodId = self._SO_get_requisitionPeriod() - but I don't know what I'm doing wrong. How do I specify this with a ForeignKey field? -Jim |
From: Oleg B. <ph...@ph...> - 2010-03-04 13:41:36
|
Hello! I'm pleased to announce version 0.12.2, a bugfix release of branch 0.12 of SQLObject. What is SQLObject ================= SQLObject is an object-relational mapper. Your database tables are described as classes, and rows are instances of those classes. SQLObject is meant to be easy to use and quick to get started with. SQLObject supports a number of backends: MySQL, PostgreSQL, SQLite, Firebird, Sybase, MSSQL and MaxDB (also known as SAPDB). Where is SQLObject ================== Site: http://sqlobject.org Development: http://sqlobject.org/devel/ Mailing list: https://lists.sourceforge.net/mailman/listinfo/sqlobject-discuss Archives: http://news.gmane.org/gmane.comp.python.sqlobject Download: http://cheeseshop.python.org/pypi/SQLObject/0.12.2 News and changes: http://sqlobject.org/News.html What's New ========== News since 0.12.1 ----------------- * Fixed a bug in inheritance - if creation of the row failed and if the connection is not a transaction and is in autocommit mode - remove parent row(s). * Do not set _perConnection flag if get() or _init() is passed the same connection; this is often the case with select(). For a more complete list, please see the news: http://sqlobject.org/News.html Oleg. -- Oleg Broytman http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Oleg B. <ph...@ph...> - 2010-03-04 13:33:52
|
Hello! I'm pleased to announce version 0.11.4, a minor bugfix release of 0.11 branch of SQLObject. What is SQLObject ================= SQLObject is an object-relational mapper. Your database tables are described as classes, and rows are instances of those classes. SQLObject is meant to be easy to use and quick to get started with. SQLObject supports a number of backends: MySQL, PostgreSQL, SQLite, Firebird, Sybase, MSSQL and MaxDB (also known as SAPDB). Where is SQLObject ================== Site: http://sqlobject.org Development: http://sqlobject.org/devel/ Mailing list: https://lists.sourceforge.net/mailman/listinfo/sqlobject-discuss Archives: http://news.gmane.org/gmane.comp.python.sqlobject Download: http://cheeseshop.python.org/pypi/SQLObject/0.11.4 News and changes: http://sqlobject.org/News.html What's New ========== News since 0.11.3 ----------------- * Fixed a bug in inheritance - if creation of the row failed and if the connection is not a transaction and is in autocommit mode - remove parent row(s). * Do not set _perConnection flag if get() or _init() is passed the same connection; this is often the case with select(). For a more complete list, please see the news: http://sqlobject.org/News.html Oleg. -- Oleg Broytman http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Oleg B. <ph...@ph...> - 2010-03-04 08:59:07
|
On Thu, Mar 04, 2010 at 07:50:47AM +0200, Imri Goldberg wrote: > I've written a short how-to on how to use sqlobject-admin to do database > migration (schema upgrades). > I hope it helps: > simple-sqlobject-db-migration-how-to<http://www.algorithm.co.il/blogs/index.php/programming/python/simple-sqlobject-db-migration-how-to/> > > I'll be happy to receive corrections, answer more questions, etc. Thank you! I'll add it to the SQLObject links. Oleg. -- Oleg Broytman http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Imri G. <lor...@gm...> - 2010-03-04 05:50:55
|
Heya I've written a short how-to on how to use sqlobject-admin to do database migration (schema upgrades). I hope it helps: simple-sqlobject-db-migration-how-to<http://www.algorithm.co.il/blogs/index.php/programming/python/simple-sqlobject-db-migration-how-to/> I'll be happy to receive corrections, answer more questions, etc. Cheers, Imri -- Imri Goldberg -------------------------------------- http://plnnr.com/ - automatic trip planning http://www.algorithm.co.il/blogs/ -------------------------------------- -- insert signature here ---- |
From: Oleg B. <ph...@ph...> - 2010-03-03 18:26:19
|
Hello! On Mon, Feb 08, 2010 at 02:11:00PM +0200, Tom Coetser wrote: > 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. Well, that required some thinking. I always wanted to make validators stricter, much stricter. I don't want to allow StringCol to accept any value and convert it to a string by calling str(), I don't want BoolCol to accept any value and convert it by calling bool(), IntCol by calling int() and so on. And finally I did it - commit 4117. Validators became stricter though not yet as strict as I want. Similarly, I don't want date/time columns to accept strings. On the other hand date/time validators are bigger and more complex than other validators. So I decided to make an exception to allow date/time columns to accept strings and convert them to their proper date/time types. I committed your patch in the revision 4118. Thank you! Oleg. -- Oleg Broytman http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Oleg B. <ph...@ph...> - 2010-03-01 11:52:23
|
On Sun, Feb 28, 2010 at 05:13:39PM +0200, Imri Goldberg wrote: > In command.py, line 211 (sqlobject 0.12.1, in findReverseDependencies() ) > change from: > > if other not in depended: > > to: > > if other is not cls and other not in depended: > > In the case of only self-referring classes, the ordering still makes sense > this way. Thank you, I'll add it. Oleg. -- Oleg Broytman http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Imri G. <lor...@gm...> - 2010-02-28 15:13:47
|
Heya When creating classes with circular dependencies (via sqlobject-admin), there's a warning. This has been discussed before. While I don't propose a general solution to the problem, a simple workaround for self referring classes may be used. In command.py, line 211 (sqlobject 0.12.1, in findReverseDependencies() ) change from: if other not in depended: to: if other is not cls and other not in depended: In the case of only self-referring classes, the ordering still makes sense this way. Cheers, Imri -- Imri Goldberg -------------------------------------- http://plnnr.com/ - automatic trip planning http://www.algorithm.co.il/blogs/ -------------------------------------- -- insert signature here ---- |
From: Markos K. <mk...@gm...> - 2010-02-27 17:16:34
|
It pickles, on trying to unpickle, It gives an unpickling error on unpickling, though. /Users/mkapes/Downloads/infoshopkeeper/AmazonAuthorTitle.py in <module>() 40 ourTitles=[] 41 try: ---> 42 ourTitles=shelf['ourTitles'] 43 print "Pull From Shelf" 44 except KeyError: /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/shelve.pyc in __getitem__(self, key) 120 except KeyError: 121 f = StringIO(self.dict[key]) --> 122 value = Unpickler(f).load() 123 if self.writeback: 124 self.cache[key] = value AttributeError: 'FakeModule' object has no attribute 'Title' > /opt/local/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/shelve.py(122)__getitem__() 121 f = StringIO(self.dict[key]) --> 122 value = Unpickler(f).load() 123 if self.writeback: On Fri, Feb 27, 2010 at 12:33PM +0300, Oleg Broytman wrote: > On Fri, Feb 26, 2010 at 11:42:28PM +0300, Oleg Broytman wrote: > > > but I'm still getting the same PicklingError. > > > > I'll look into it. > > Ok, found it. .select() always passes a connection to .get() thus > setting _perConnection flag. I added a test if get() or _init() is passed > the same connection - do not set _perConnection flag. > I added the test to all branches - 0.11, 0.12 and the trunk. Committed > in the revisions 4107-4110. Will be in the next round of releases. > Please report if it helps. > > Oleg. > -- > Oleg Broytman ph...@ph..." target="_blank">http://phd.pp.ru/ ph...@ph...> > Programmers don't die, they just GOSUB without RETURN. |
From: Oleg B. <ph...@ph...> - 2010-02-26 21:33:35
|
On Fri, Feb 26, 2010 at 11:42:28PM +0300, Oleg Broytman wrote: > > but I'm still getting the same PicklingError. > > I'll look into it. Ok, found it. .select() always passes a connection to .get() thus setting _perConnection flag. I added a test if get() or _init() is passed the same connection - do not set _perConnection flag. I added the test to all branches - 0.11, 0.12 and the trunk. Committed in the revisions 4107-4110. Will be in the next round of releases. Please report if it helps. 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-26 20:42:38
|
On Fri, Feb 26, 2010 at 03:13:50PM -0500, Markos Kapes wrote: > 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: I haven't released the instance pickling code, it is still in the trunk. You are brave to use it! > 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. I'll look into it. > What can I be missing? I've seen a few recent posts about fixing this Fixing what? I cannot unpickle the exact per-instance connection, so I refuse to pickle it (and the SQLObject instance with it). Oleg. -- Oleg Broytman http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |