sqlobject-discuss Mailing List for SQLObject (Page 38)
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...@ph...> - 2010-05-14 14:25:07
|
On Fri, May 14, 2010 at 06:22:05PM +0400, Oleg Broytman wrote: > On Fri, May 14, 2010 at 03:37:46PM +0200, Imre Horvath wrote: > > select * from pricegroups > > left join (select * from products_pricegroups > > where products_pricegroups.product_id=1) as a > > on (pricegroups.id=a.pricegroup_id) Does the query work at all in MySQL? Oleg. -- Oleg Broytman http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Oleg B. <ph...@ph...> - 2010-05-14 14:22:17
|
On Fri, May 14, 2010 at 03:37:46PM +0200, Imre Horvath wrote: > select * from pricegroups > left join (select * from products_pricegroups > where products_pricegroups.product_id=1) as a > on (pricegroups.id=a.pricegroup_id) Currently it's impossible to do with SQLObject as it assumes both sides of a JOIN are table names, not a subselect. That could be fixed. Oleg. -- Oleg Broytman http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Imre H. <ble...@gm...> - 2010-05-14 13:37:57
|
Hi! I wrote a small program to test this problem. I have 3 tables: CREATE TABLE pricegroups (id integer primary key); CREATE TABLE products (id integer primary key, name text); CREATE TABLE products_pricegroups (id integer primary key, product_id integer, pricegroup_id integer, percent integer); I would like to perform the following query: select * from pricegroups left join (select * from products_pricegroups where products_pricegroups.product_id=1) as a on (pricegroups.id=a.pricegroup_id) How can I accomplish it in mysql? This is where i am now: #!/usr/bin/env python import os import sqlobject class Product(sqlobject.SQLObject): class sqlmeta: table = 'products' name = sqlobject.StringCol() class PriceGroup(sqlobject.SQLObject): class sqlmeta: table = 'pricegroups' percents = sqlobject.MultipleJoin('ProductPriceGroup', joinColumn = 'pricegroup_id') class ProductPriceGroup(sqlobject.SQLObject): class sqlmeta: table = 'products_pricegroups' productId = sqlobject.ForeignKey('Product', dbName = 'product_id') pricegroupId = sqlobject.ForeignKey('PriceGroup', dbName = 'pricegroup_id') percent = sqlobject.IntCol() if __name__ == '__main__': builder = sqlobject.sqlite.builder() connection = builder('join.db') connection.debug = 1 sqlobject.sqlhub.processConnection = connection pgl = list(PriceGroup.select( join = sqlobject.sqlbuilder.LEFTJOINOn( PriceGroup, ProductPriceGroup, PriceGroup.q.id == ProductPriceGroup.q.pricegroupId, ), )) for pg in pgl: print pg The next step is to apply the WHERE clause, but I have no idea how to do it... Thanks for any help: Imre Horvath |
From: <ma...@si...> - 2010-04-30 09:56:02
|
This sounds quite useful and is something I haven't thought of yet. I was rather thinking of problems with connection pooling and similar things. Some time ago I have seen some posts concerning issues with mod_python+sqlobject but this seems to be solved. As mod_wsgi is similar to mod_python I didn't know if there may be issues. Is your middleware tied to pylons or could it be used on any wsgi-compliant framework? > > I've successfully built a few Pylons apps with sqlobject. One slightly > unusual thing I did was to create a middleware that would catch run each > entire request in a transaction. On error, it would roll back the > transaction and, if the error was possibly recoverable, retry it. This > allowed me to transparently handle things like checking to see if a > username was available, then creating the user if so without worrying > about race conditions. > > > ------------------------------------------------------------------------------ > _______________________________________________ > sqlobject-discuss mailing list > sql...@li... > https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss > |
From: David T. <no...@op...> - 2010-04-29 20:13:25
|
On Thu, 2010-04-29 at 21:16 +0200, Markus W. Barth wrote: > I'll be shortly starting a new project and I am thinking of using a rather > light-weight framework like the werkzeug-based flask. Could anybody on the list > with wsgi+sqlobject tell me about his/her (positive/negative) experience with > this combination. As pylons and turbogears2 are wsgi compliant and both are > supposed to support sqlobject, there shouldn't be any issues, or am I wrong? I've successfully built a few Pylons apps with sqlobject. One slightly unusual thing I did was to create a middleware that would catch run each entire request in a transaction. On error, it would roll back the transaction and, if the error was possibly recoverable, retry it. This allowed me to transparently handle things like checking to see if a username was available, then creating the user if so without worrying about race conditions. |
From: Markus W. B. <ma...@si...> - 2010-04-29 19:32:35
|
I'll be shortly starting a new project and I am thinking of using a rather light-weight framework like the werkzeug-based flask. Could anybody on the list with wsgi+sqlobject tell me about his/her (positive/negative) experience with this combination. As pylons and turbogears2 are wsgi compliant and both are supposed to support sqlobject, there shouldn't be any issues, or am I wrong? |
From: Oleg B. <ph...@ph...> - 2010-04-26 19:00:59
|
Hi! On Mon, Apr 26, 2010 at 09:13:01PM +0300, Imri Goldberg wrote: > I am considering switching to your way of doing schema changes. > I would very much appreciate more information regarding the process you use > to do these things. > > For instance, given that I have a working MyThing class, to which I'd like > to add a field my_field - would you write the upgrade script first, and then > copy the field definitions to the MyThing class? Would you do it the other > way around? > Once both are updated, do you have a special order of doing things when > moving it to production? I use SQLObject in commercial programs that my company sells to customers. So I have to distribute new class descriptions; so new tables and columns are added to the code before upgrade scripts. Also I write upgrade scripts in such a way they can be run safely many times. When I announce new build in the internal mailing list and at the corporation's wiki I notify support department there is a new upgrade script. I don't expect support persons remember what upgrade scripts had been run for a particular customer; so when installing a new version a support person can run all upgrade scripts in order. Because of this an upgrade script always looks into the real database to see if it needs to do its job. For a new tables it's quite simple: from Database.Requests import RequestIDs if not RequestIDs.tableExists(): RequestIDs.createTable() I.e., the script imports the class declaration from the Database modules, tests if the table exists and creates the table. For a new column it's a bit harder - I have to investigate the DB deeper. Sometimes I simply create a second class declaration and connect it to the same table: class OldRequestIDs(Base): class sqlmeta: table = 'request_i_ds' # connect the table to the real table status = StringCol(length=255, default=None) OldRequestIDs.sqlmeta.delColumn("status", changeSchema=True) Sometimes I draw the table declaration from the DB: class Plate(SQLObject): class sqlmeta: fromDatabase = True if 'idPl' not in Plate.sqlmeta.columns: Plate.sqlmeta.addColumn(IntCol("IDpl", default=None, dbName="id_pl"), changeSchema=True) (Wow, three different ways of naming 'id_pl' column, damn!) Oleg. -- Oleg Broytman http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Imri G. <lor...@gm...> - 2010-04-26 18:13:09
|
Hi Oleg! I am considering switching to your way of doing schema changes. I would very much appreciate more information regarding the process you use to do these things. For instance, given that I have a working MyThing class, to which I'd like to add a field my_field - would you write the upgrade script first, and then copy the field definitions to the MyThing class? Would you do it the other way around? Once both are updated, do you have a special order of doing things when moving it to production? Thanks ahead, Imri On Tue, Apr 20, 2010 at 2:45 PM, Oleg Broytman <ph...@ph...> wrote: > On Mon, Apr 19, 2010 at 04:11:09PM +0300, Imri Goldberg wrote: > > Re using sqlobject-admin: I'm curious - what is your preferred way of > > managing db migrations (i.e. versioning schema changes)? > > I seldom do a simple ADD/DELETE COLUMN. Usually when I change the schema > it's more like "collect some info, ADD COLUMN, put info into the new > column". > Something like this (code from a real script upgradedb5.py): > > log.open("upgradedb5.log") > > if db_conn.dbName == 'sqlite': > db_conn.use_table_info = True > > if 'userID' not in ExportResult.sqlmeta.columns: > ExportResult.sqlmeta.addColumn(ForeignKey('User', name="user", > default=None), > changeSchema=True) > > for result in ExportResult.select(ExportResult.q.plate <> None): > result.user = result.plate.user > > commit() > > log.close() > > This is a rather simple example. Sometime there is a lot of code to > collect information before schema changing and even more code that puts the > collected information into the new columns. > > Oleg. > -- > Oleg Broytman http://phd.pp.ru/ ph...@ph... > Programmers don't die, they just GOSUB without RETURN. > > > ------------------------------------------------------------------------------ > 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 > -- Imri Goldberg -------------------------------------- http://plnnr.com/ - automatic trip planning http://www.algorithm.co.il/blogs/ -------------------------------------- -- insert signature here ---- |
From: Oleg B. <ph...@ph...> - 2010-04-20 19:13:01
|
On Tue, Apr 20, 2010 at 09:35:12PM +0300, Imri Goldberg wrote: > On Tue, Apr 20, 2010 at 9:12 PM, Oleg Broytman <ph...@ph...> wrote: > > BTW, DecimalCol is only recognized by SQLiteConnection. > > That's strange, as I currently use mysql. I haven't given it much thought, > but it seems to work well. If columnsFromSchema() couldn't recognize column it simply returns an instance of the generic Col class. Oleg. -- Oleg Broytman http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Imri G. <lor...@gm...> - 2010-04-20 18:42:21
|
On Tue, Apr 20, 2010 at 9:12 PM, Oleg Broytman <ph...@ph...> wrote: > > BTW, DecimalCol is only recognized by SQLiteConnection. > > Oleg. > -- > Oleg Broytman http://phd.pp.ru/ ph...@ph... > Programmers don't die, they just GOSUB without RETURN. > That's strange, as I currently use mysql. I haven't given it much thought, but it seems to work well. -- Imri Goldberg -------------------------------------- http://plnnr.com/ - automatic trip planning http://www.algorithm.co.il/blogs/ -------------------------------------- -- insert signature here ---- |
From: Imri G. <lor...@gm...> - 2010-04-20 18:15:48
|
Excellent, thanks a bunch! Cheers, Imri PS, if there is some work to be done on sqlobject, I'll be happy to help :) On Tue, Apr 20, 2010 at 9:00 PM, Oleg Broytman <ph...@ph...> wrote: > On Tue, Apr 20, 2010 at 08:23:39PM +0400, Oleg Broytman wrote: > > In this particular case it would be enough, I think, to extend > > columnsFromScheme to pass None's as size/precision. I will do some > > experiments before committing the hack. > > Fixed and committed in the revisions 4175-4177 (branches 0.11, 0.12 and > the trunk). Will be in the next release. > > Oleg. > -- > Oleg Broytman http://phd.pp.ru/ ph...@ph... > Programmers don't die, they just GOSUB without RETURN. > -- Imri Goldberg -------------------------------------- http://plnnr.com/ - automatic trip planning http://www.algorithm.co.il/blogs/ -------------------------------------- -- insert signature here ---- |
From: Oleg B. <ph...@ph...> - 2010-04-20 18:12:59
|
On Tue, Apr 20, 2010 at 09:00:11PM +0300, Imri Goldberg wrote: > When I checked it, it seemed to me to happen because the 'size' and > 'precision' were pop()-ed from the original **kw dict passed to DecimalCol. The problem was that the dictionary was simply empty. SQLiteConnection.guessClass() did at line 364: elif t.find('DECIMAL') >= 0: return col.DecimalCol, {} I changed that to return col.DecimalCol, {'size': None, 'precision': None} With the change your test works for me. BTW, DecimalCol is only recognized by SQLiteConnection. Oleg. -- Oleg Broytman http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Imri G. <lor...@gm...> - 2010-04-20 18:00:21
|
Heya When I checked it, it seemed to me to happen because the 'size' and 'precision' were pop()-ed from the original **kw dict passed to DecimalCol. Since the this dict is later kept as a member, when used again by CommandStatus, 'size' and 'precision' are no longer there. Hope that helps, Imri On Tue, Apr 20, 2010 at 7:23 PM, Oleg Broytman <ph...@ph...> wrote: > On Sat, Apr 17, 2010 at 01:25:59PM +0300, Imri Goldberg wrote: > > 1. Create a simple table with a decimal column, for example: > > > > class MyThing(sqlobject.SQLObject): > > bla1 = sqlobject.DecimalCol(size = 10, precision = 2) > > > > 2. Use sqlobject-admin create --egg=... -c sqlite://.... > > 3. Use sqlobject-admin status --egg=... -c sqlite://... > [skip] > > File > > "D:\applic\program\python25\lib\site-packages\sqlobject-0.12.1-py2.5.egg\ > > sqlobject\manager\command.py", line 765, in command > > col = col.withClass(soClass) > > File > > "D:\applic\program\python25\lib\site-packages\sqlobject-0.12.1-py2.5.egg\ > > sqlobject\col.py", line 408, in withClass > > **self._kw) > > File > > "D:\applic\program\python25\lib\site-packages\sqlobject-0.12.1-py2.5.egg\ > > sqlobject\col.py", line 1329, in __init__ > > "You must give a size argument" > > AssertionError: You must give a size argument > > > > After researching this issue a bit, I still haven't figured out whether > this > > is the result of a bug in the command implementation, or the way that > > keyword arguments are handled in the column class hierarchy. > > Ok, found the cause. CommandStatus in sqlobject/manager/command.py list > columns using columnsFromScheme(), a kind of forced fromDatabase=True. And > most connection classes don't recognize size/precision in DecimalCol'umns. > In this particular case it would be enough, I think, to extend > columnsFromScheme to pass None's as size/precision. I will do some > experiments before committing the hack. > > Oleg. > -- > Oleg Broytman http://phd.pp.ru/ ph...@ph... > Programmers don't die, they just GOSUB without RETURN. > -- Imri Goldberg -------------------------------------- http://plnnr.com/ - automatic trip planning http://www.algorithm.co.il/blogs/ -------------------------------------- -- insert signature here ---- |
From: Oleg B. <ph...@ph...> - 2010-04-20 18:00:15
|
On Tue, Apr 20, 2010 at 08:23:39PM +0400, Oleg Broytman wrote: > In this particular case it would be enough, I think, to extend > columnsFromScheme to pass None's as size/precision. I will do some > experiments before committing the hack. Fixed and committed in the revisions 4175-4177 (branches 0.11, 0.12 and the trunk). Will be in the next release. Oleg. -- Oleg Broytman http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Oleg B. <ph...@ph...> - 2010-04-20 16:23:50
|
On Sat, Apr 17, 2010 at 01:25:59PM +0300, Imri Goldberg wrote: > 1. Create a simple table with a decimal column, for example: > > class MyThing(sqlobject.SQLObject): > bla1 = sqlobject.DecimalCol(size = 10, precision = 2) > > 2. Use sqlobject-admin create --egg=... -c sqlite://.... > 3. Use sqlobject-admin status --egg=... -c sqlite://... [skip] > File > "D:\applic\program\python25\lib\site-packages\sqlobject-0.12.1-py2.5.egg\ > sqlobject\manager\command.py", line 765, in command > col = col.withClass(soClass) > File > "D:\applic\program\python25\lib\site-packages\sqlobject-0.12.1-py2.5.egg\ > sqlobject\col.py", line 408, in withClass > **self._kw) > File > "D:\applic\program\python25\lib\site-packages\sqlobject-0.12.1-py2.5.egg\ > sqlobject\col.py", line 1329, in __init__ > "You must give a size argument" > AssertionError: You must give a size argument > > After researching this issue a bit, I still haven't figured out whether this > is the result of a bug in the command implementation, or the way that > keyword arguments are handled in the column class hierarchy. Ok, found the cause. CommandStatus in sqlobject/manager/command.py list columns using columnsFromScheme(), a kind of forced fromDatabase=True. And most connection classes don't recognize size/precision in DecimalCol'umns. In this particular case it would be enough, I think, to extend columnsFromScheme to pass None's as size/precision. I will do some experiments before committing the hack. Oleg. -- Oleg Broytman http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Oleg B. <ph...@ph...> - 2010-04-20 11:45:42
|
On Mon, Apr 19, 2010 at 04:11:09PM +0300, Imri Goldberg wrote: > Re using sqlobject-admin: I'm curious - what is your preferred way of > managing db migrations (i.e. versioning schema changes)? I seldom do a simple ADD/DELETE COLUMN. Usually when I change the schema it's more like "collect some info, ADD COLUMN, put info into the new column". Something like this (code from a real script upgradedb5.py): log.open("upgradedb5.log") if db_conn.dbName == 'sqlite': db_conn.use_table_info = True if 'userID' not in ExportResult.sqlmeta.columns: ExportResult.sqlmeta.addColumn(ForeignKey('User', name="user", default=None), changeSchema=True) for result in ExportResult.select(ExportResult.q.plate <> None): result.user = result.plate.user commit() log.close() This is a rather simple example. Sometime there is a lot of code to collect information before schema changing and even more code that puts the collected information into the new columns. Oleg. -- Oleg Broytman http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Imri G. <lor...@gm...> - 2010-04-19 13:11:10
|
Heya I'll be happy to help you work it, and also to solve the bug. Re using sqlobject-admin: I'm curious - what is your preferred way of managing db migrations (i.e. versioning schema changes)? Cheers, Imri On Mon, Apr 19, 2010 at 12:58 PM, Oleg Broytman <ph...@ph...> wrote: > On Sat, Apr 17, 2010 at 01:25:59PM +0300, Imri Goldberg wrote: > > I've worked a bit with sqlobject-admin, and there's a bug in the > > implementation of the status command. > > Thank you for reporting. I have never used sqlobject-admin so I have to > learn how to use it to reproduce the bug. > > Oleg. > -- > Oleg Broytman http://phd.pp.ru/ ph...@ph... > Programmers don't die, they just GOSUB without RETURN. > > > ------------------------------------------------------------------------------ > 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 > -- Imri Goldberg -------------------------------------- http://plnnr.com/ - automatic trip planning http://www.algorithm.co.il/blogs/ -------------------------------------- -- insert signature here ---- |
From: Oleg B. <ph...@ph...> - 2010-04-19 12:57:55
|
On Mon, Apr 19, 2010 at 01:52:31PM +0200, Petr Jake?? wrote: > > OMG, you did mean FB generator, not Python! You need to be more specific. > > (-: > > Sorry about that, my feeling was all SQL engines are using ID generators to > store in it. They use, but some of them are internal and don't have any SQL-based access. For example, SQLite internally use MAX(id); this means if you delete some rows, id could be reused. MySQL has an internal monotonous generator that can only be queried with SELECT LAST_INSERT_ID(). Postgres has generators (called "sequences") with full SQL-based access; one can query and set them at will. Oleg. -- Oleg Broytman http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Petr J. <pet...@tp...> - 2010-04-19 11:52:33
|
> OMG, you did mean FB generator, not Python! You need to be more specific. > (-: > > Sorry about that, my feeling was all SQL engines are using ID generators to store in it. > You need to run your own SQL queries. Something like this: > > self.query("DROP GENERATOR GEN_%s" % soClass.sqlmeta.table) > self.query("CREATE GENERATOR GEN_%s" % soClass.sqlmeta.table) > > And there is perhaps SQL commands to reset the generator. I know nothing > about FB so I cannot help. Look it up in the FB docs. > This is not a problem, I was just wondering if I am not overlooking something more Pythonic. Thanks for your comments anyway. Regards Petr Jakes |
From: Oleg B. <ph...@ph...> - 2010-04-19 11:38:05
|
On Mon, Apr 19, 2010 at 01:27:25PM +0200, Petr Jake?? wrote: > As I am on the Firebird, I can see only dropTable, createTable methods in > the: > > http://www.sqlobject.org/sqlobject/firebird/firebirdconnection.py.html > > There is not particular method to create new generator. OMG, you did mean FB generator, not Python! You need to be more specific. (-: You need to run your own SQL queries. Something like this: self.query("DROP GENERATOR GEN_%s" % soClass.sqlmeta.table) self.query("CREATE GENERATOR GEN_%s" % soClass.sqlmeta.table) And there is perhaps SQL commands to reset the generator. I know nothing about FB so I cannot help. Look it up in the FB docs. Oleg. -- Oleg Broytman http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Petr J. <pet...@tp...> - 2010-04-19 11:27:34
|
> At what level do you want to forbid to run SELECT COUNT(*)? if a user > can connect to the DB and run queries on the table [s]he can run the query > directly, right? > If records are deleted say daily (or on some regular basis), then SELECT COUNT(*) is nearly useless. Of course the secured backup (csv) before processing row.destroySelf is necessary. Try to imagine government is offending you for example... :( > > > *I just wonder if there is a way to (re)set generators to the initial > value > > (1). > > In general, there is no way. The only way to reset a generator is to > create a new generator. > > As I am on the Firebird, I can see only dropTable, createTable methods in the: http://www.sqlobject.org/sqlobject/firebird/firebirdconnection.py.html There is not particular method to create new generator. Regards Petr |
From: Oleg B. <ph...@ph...> - 2010-04-19 09:58:48
|
On Sat, Apr 17, 2010 at 01:25:59PM +0300, Imri Goldberg wrote: > I've worked a bit with sqlobject-admin, and there's a bug in the > implementation of the status command. Thank you for reporting. I have never used sqlobject-admin so I have to learn how to use it to reproduce the bug. Oleg. -- Oleg Broytman http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Oleg B. <ph...@ph...> - 2010-04-19 09:50:23
|
On Mon, Apr 19, 2010 at 06:34:37AM +0200, Petr Jake?? wrote: > I do not want anybody to find, how many rows were > inserted in the past in to the table.* At what level do you want to forbid to run SELECT COUNT(*)? if a user can connect to the DB and run queries on the table [s]he can run the query directly, right? > *I just wonder if there is a way to (re)set generators to the initial value > (1). In general, there is no way. The only way to reset a generator is to create a new generator. Oleg. -- Oleg Broytman http://phd.pp.ru/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Petr J. <pet...@tp...> - 2010-04-19 04:34:45
|
Hi, because of the security issues, I am deleting rows in some tables (* destroySelf *method) and I do not want anybody to find, how many rows were inserted in the past in to the table.* *I just wonder if there is a way to (re)set generators to the initial value (1). Best Regards Petr Jakes * * |
From: Imri G. <lor...@gm...> - 2010-04-17 11:28:26
|
Heya I've worked a bit with sqlobject-admin, and there's a bug in the implementation of the status command. Steps to reproduce: 1. Create a simple table with a decimal column, for example: class MyThing(sqlobject.SQLObject): bla1 = sqlobject.DecimalCol(size = 10, precision = 2) 2. Use sqlobject-admin create --egg=... -c sqlite://.... 3. Use sqlobject-admin status --egg=... -c sqlite://... You should get the following exception: [snip] File "D:\applic\program\python25\lib\site-packages\sqlobject-0.12.1-py2.5.egg\ sqlobject\manager\command.py", line 765, in command col = col.withClass(soClass) File "D:\applic\program\python25\lib\site-packages\sqlobject-0.12.1-py2.5.egg\ sqlobject\col.py", line 408, in withClass **self._kw) File "D:\applic\program\python25\lib\site-packages\sqlobject-0.12.1-py2.5.egg\ sqlobject\col.py", line 1329, in __init__ "You must give a size argument" AssertionError: You must give a size argument After researching this issue a bit, I still haven't figured out whether this is the result of a bug in the command implementation, or the way that keyword arguments are handled in the column class hierarchy. Cheers, Imri -- Imri Goldberg -------------------------------------- http://plnnr.com/ - automatic trip planning http://www.algorithm.co.il/blogs/ -------------------------------------- -- insert signature here ---- |