sqlobject-discuss Mailing List for SQLObject (Page 29)
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: Mark M. <mar...@me...> - 2011-03-09 17:34:33
|
What about the connection argument? Do I have to just add that to the dict? On Mar 9, 2011, at 2:43 AM, Oleg Broytman wrote: > On Tue, Mar 08, 2011 at 03:56:35PM -0800, Mark McWiggins wrote: >> Is there a way to do this without specifying all the field names? Right now I am just using two fields: >> >> zips = zipcode.select() >> >> for z in zips: >> newz = zipcode(id = z.id, city = z.city, connection = peconnection) >> >> This works, but where there are 14 fields in other tables it's going to be a pain. I couldn't find anything about >> object copy or assignment in the documents, but isn't there a way to do this? > > You can convert a row to a dict: z.sqlmeta.asDict() - and pass the > dict back: newz = zipcode(**z.sqlmeta.asDict()) > > Oleg. > -- > Oleg Broytman http://phdru.name/ ph...@ph... > Programmers don't die, they just GOSUB without RETURN. > > ------------------------------------------------------------------------------ > Colocation vs. Managed Hosting > A question and answer guide to determining the best fit > for your organization - today and in the future. > http://p.sf.net/sfu/internap-sfd2d > _______________________________________________ > sqlobject-discuss mailing list > sql...@li... > https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss Mark McWiggins Principal Solutions Engineer mar...@me... 443-656-3311 ext 344 |
From: Oleg B. <ph...@ph...> - 2011-03-09 14:56:37
|
On Wed, Mar 09, 2011 at 05:47:26PM +0300, Oleg Broytman wrote: > * Major API change: DB URI parser was changed to use urllib.split*() and > unquote(). This means any username/password/path are allowed in DB > URIs if they are properly %-encoded, and DB URIs are automatically > unquoted. I have been trying to preserve backward compatibility as much as possible. Most URIs are not affected at all. Dirty trick with w32 paths (C|/path instead of C:/path) is still supported, though C:/path is now the recommended syntax. Old API is preserved: connectionForURI(uri, oldUri=True), DBConnection.connectionFromOldURI(), DBConnection.oldURI(). There is a script sqlobject-convertOldURI that accepts old-style URI at the command line and prints to stdout the URI in the new format. Anyway - a prolonged beta period. Oleg. -- Oleg Broytman http://phdru.name/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Oleg B. <ph...@ph...> - 2011-03-09 14:47:40
|
Hello! I'm pleased to announce version 1.0.0b1, the first beta of the upcoming release of branch 1.0 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/1.0.0b1dev-r4354 News and changes: http://sqlobject.org/News.html What's New ========== Features & Interface -------------------- * Major API change: DB URI parser was changed to use urllib.split*() and unquote(). This means any username/password/path are allowed in DB URIs if they are properly %-encoded, and DB URIs are automatically unquoted. * In SQLite, id columns are made AUTOINCREMENT. * Parameter ``backend`` in DB URI is no longer supported, use parameter ``driver``. For a more complete list, please see the news: http://sqlobject.org/News.html Oleg. -- Oleg Broytman http://phdru.name/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Oleg B. <ph...@ph...> - 2011-03-09 10:43:54
|
On Tue, Mar 08, 2011 at 03:56:35PM -0800, Mark McWiggins wrote: > Is there a way to do this without specifying all the field names? Right now I am just using two fields: > > zips = zipcode.select() > > for z in zips: > newz = zipcode(id = z.id, city = z.city, connection = peconnection) > > This works, but where there are 14 fields in other tables it's going to be a pain. I couldn't find anything about > object copy or assignment in the documents, but isn't there a way to do this? You can convert a row to a dict: z.sqlmeta.asDict() - and pass the dict back: newz = zipcode(**z.sqlmeta.asDict()) Oleg. -- Oleg Broytman http://phdru.name/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Mark M. <mar...@me...> - 2011-03-08 23:56:45
|
Hi All, I have the program I'm working on doing basically what I want now, copying a table's data from one DB to another. But! Is there a way to do this without specifying all the field names? Right now I am just using two fields: zips = zipcode.select() for z in zips: newz = zipcode(id = z.id, city = z.city, connection = peconnection) This works, but where there are 14 fields in other tables it's going to be a pain. I couldn't find anything about object copy or assignment in the documents, but isn't there a way to do this? Thanks for any suggestions. -- Mark McWiggins Principal Solutions Engineer mar...@me... 443-656-3311 ext 344 |
From: Oleg B. <ph...@ph...> - 2011-03-08 20:13:15
|
On Tue, Mar 08, 2011 at 11:26:19AM -0800, Mark McWiggins wrote: > I'm a new SQLObject user ... Welcome! > I have this table: > > CREATE TABLE zipcode ( > zip integer PRIMARY KEY, > city text, > -- and so forth ... > > with Python representing it: > > class zipcode(SQLObject): > class sqlmeta: > fromDatabase = True > idName = 'zip' > > But when I try to create rows with: > > for myzip in range(1,99999): > z = zipcode(zip = myzip, city = 'zipcity' + str(myzip)) > > I get an error > > File "/usr/local/lib/python2.4/site-packages/SQLObject-1.1dev_r4347-py2.4.egg\ > /sqlobject/main.py", line 1099, in set > raise TypeError, "%s.set() got an unexpected keyword argument %s" % (self._\ > _class__.__name__, name) > TypeError: zipcode.set() got an unexpected keyword argument zip In SQLObject the primary key is always called 'id'. for myzip in range(1, 99999): z = zipcode(id=myzip, city='zipcity' + str(myzip)) Oleg. -- Oleg Broytman http://phdru.name/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Mark M. <mar...@me...> - 2011-03-08 19:26:30
|
Hi All, I'm a new SQLObject user ... I have this table: CREATE TABLE zipcode ( zip integer PRIMARY KEY, city text, -- and so forth ... with Python representing it: class zipcode(SQLObject): class sqlmeta: fromDatabase = True idName = 'zip' But when I try to create rows with: for myzip in range(1,99999): z = zipcode(zip = myzip, city = 'zipcity' + str(myzip)) I get an error File "/usr/local/lib/python2.4/site-packages/SQLObject-1.1dev_r4347-py2.4.egg\ /sqlobject/main.py", line 1099, in set raise TypeError, "%s.set() got an unexpected keyword argument %s" % (self._\ _class__.__name__, name) TypeError: zipcode.set() got an unexpected keyword argument zip What am I missing? -- Mark McWiggins Principal Solutions Engineer mar...@me... 443-656-3311 ext 344 |
From: Oleg B. <ph...@ph...> - 2011-03-05 08:50:05
|
On Sat, Mar 05, 2011 at 08:29:54AM +0000, Timothy W. Grove wrote: > Thanks for the advice, Oleg. I found a solution which may not be > elegant, but it works for me! Instead of trying to work with two > different class definitions I've just kept one which declares the column > I wish to add to the database and run an update function which deletes > the column from the class before adding it again to both the class and > the database. My example follows. Sometimes I do the same. > Best regards, > Tim > > class SignEntry(SQLObject): > explanatory_map = PickleCol() > > def SignEntryUpdate(): > cols = [i.name for i in > sqlhub.processConnection.columnsFromSchema("sign_entry", SignEntry)] > if 'explanatoryMap' not in cols: > SignEntry.sqlmeta.delColumn('explanatory_map') # I know > this exists in the class definition > SignEntry.sqlmeta.addColumn(PickleCol("explanatory_map"), > changeSchema=True) Minor optimization in case you are going to test many columns - a set is perhaps faster for repeated 'in' testing: cols = set([i.name for i in sqlhub.processConnection.columnsFromSchema("sign_entry", SignEntry)]) Oleg. -- Oleg Broytman http://phdru.name/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Timothy W. G. <tim...@si...> - 2011-03-05 08:30:13
|
On 04/03/2011 2:00 PM, Oleg Broytman wrote: > On Fri, Mar 04, 2011 at 12:49:50PM +0000, Timothy W. Grove wrote: >> It seems to me that there should be a simple way to add the attribute to >> the class if the column has been added already, or not if it has been >> added through updating > There is no a simple way. You have to create the table class without > the column, and then look into the database to determine if the column > is there. You can use the same mechanism SQLObject uses to implement > fromDatabase: connection.columnsFromSchema(tableName, soClass); the > result is a list of SOCol instances. Thanks for the advice, Oleg. I found a solution which may not be elegant, but it works for me! Instead of trying to work with two different class definitions I've just kept one which declares the column I wish to add to the database and run an update function which deletes the column from the class before adding it again to both the class and the database. My example follows. Best regards, Tim class SignEntry(SQLObject): explanatory_map = PickleCol() def SignEntryUpdate(): cols = [i.name for i in sqlhub.processConnection.columnsFromSchema("sign_entry", SignEntry)] if 'explanatoryMap' not in cols: SignEntry.sqlmeta.delColumn('explanatory_map') # I know this exists in the class definition SignEntry.sqlmeta.addColumn(PickleCol("explanatory_map"), changeSchema=True) |
From: Oleg B. <ph...@ph...> - 2011-03-04 14:00:47
|
On Fri, Mar 04, 2011 at 12:49:50PM +0000, Timothy W. Grove wrote: > It seems to me that there should be a simple way to add the attribute to > the class if the column has been added already, or not if it has been > added through updating There is no a simple way. You have to create the table class without the column, and then look into the database to determine if the column is there. You can use the same mechanism SQLObject uses to implement fromDatabase: connection.columnsFromSchema(tableName, soClass); the result is a list of SOCol instances. > I've also experimented with reading the class description from the > database using "class sqlmeta: fromDatabase = True" but I don't think > this works with the sqlite backend. Well, database introspection can't be precise; for example, SQLObject cannot determine on per-column basis if you want StringCol or UnicodeCol. SQLObject's implementation is also quite simple, it cannot determine ForeignKeys, e.g. But it can get the list of columns with their types. Do you have problems with that? Oleg. -- Oleg Broytman http://phdru.name/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Timothy W. G. <tim...@si...> - 2011-03-04 12:50:17
|
On 13/01/2011 10:12 PM, Oleg Broytman wrote: > On Thu, Jan 13, 2011 at 09:36:03PM +0000, Timothy W. Grove wrote: >> I want to update an existing database by adding a new column >> (UnicodeCol) to an existing table. Can anyone suggest a way to >> automatically accomplish this through sqlobject ? > It could be as simple as > > Table.sqlmeta.addColumn(UnicodeCol('name'), changeSchema=True) > > Oleg. This has been working for me, but I've come across a problem in my approach to using it; perhaps someone can suggest an alternative? When I first start my application and connect (sqlhub.processConnection) to a database (SQLite) I run the following function to update it: def SignEntryUpdate(): try: SignEntry.sqlmeta.addColumn(PickleCol("explanatory_map"), changeSchema=True) except: pass #database already has this column The first time I connect to a database which requires updating all is fine; the column is added and I can access it through the class with the SignEntry instance attribute 'explanatory_map'. But after the application is closed and I open it again connecting to the updated database, trying to access the column through the class just leads to the AttributeError: 'SignEntry' object has no attribute 'explanatory_map'. But of course this would happen as it was through the updating process that the attribute was added, it would not be added if the database didn't need updating. If I kept the attribute as part of the class definition as in the following code, then the update process fails and the new column is not added: class SignEntry(SQLObject): explanatory_map = PickleCol() It seems to me that there should be a simple way to add the attribute to the class if the column has been added already, or not if it has been added through updating; the "how to" do that is escaping me at the moment. Any and all suggestions welcomed. I've also experimented with reading the class description from the database using "class sqlmeta: fromDatabase = True" but I don't think this works with the sqlite backend. The "sqlobject-admin" tool also looks promising as a way to update databases, but I'm not too sure how far this has been developed after reading the documentation at http://sqlobject.org/sqlobject-admin.html ? Thanks for any help you can give. Best regards, Tim p.s. by the way, I had been using version 0.13 of sqlobject as I couldn't find an installer for 0.15 under python 2.7, but I have since downloaded and manually installed the version for 2.6 from http://pypi.python.org/pypi/SQLObject/0.15.0 and it seems to be working fine for me, under Windows 7. |
From: Oleg B. <ph...@ph...> - 2011-02-24 13:21:21
|
On Thu, Feb 24, 2011 at 04:04:20PM +0300, Oleg Broytman wrote: > > ImportError: DLL load failed: The specified procedure could not be > > found. > > The DLL is broken Well, it's not broken, it just isn't a Python module. _sqlite3.dll is not and SQLite's DLL - it's a Python module statically linking SQLite's code. Oleg. -- Oleg Broytman http://phdru.name/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Oleg B. <ph...@ph...> - 2011-02-24 13:04:29
|
Please answer to the list. On Thu, Feb 24, 2011 at 12:52:05PM +0000, Timothy W. Grove wrote: > On 24/02/2011 12:24 PM, Oleg Broytman wrote: >> First thing to try - test the module without SQLObject. Start with >> "import sqlite3". > Well, that is the first problem: > > import sqlite3 > Traceback (most recent call last): > File "<input>", line 1, in <module> > File "C:\Python27\lib\sqlite3\__init__.py", line 24, in <module> > from dbapi2 import * > File "C:\Python27\lib\sqlite3\dbapi2.py", line 27, in <module> > from _sqlite3 import * > ImportError: DLL load failed: The specified procedure could not be > found. The DLL is broken, forget about it (until you are going to fix and recompile it). Oleg. -- Oleg Broytman http://phdru.name/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Oleg B. <ph...@ph...> - 2011-02-24 12:24:36
|
On Wed, Feb 23, 2011 at 05:43:52PM +0000, Timothy W. Grove wrote: > File > "C:\Python27\lib\site-packages\sqlobject-0.13.0-py2.7.egg\sqlobject\sqlite\sqliteconnection.py", > line 48, in __init__ > raise ImportError('Cannot find an SQLite driver, tried %s' % drivers) > ImportError: Cannot find an SQLite driver, tried > pysqlite2,sqlite3,sqlite First thing to try - test the module without SQLObject. Start with "import sqlite3". Also look at sqlobject/include/hashcol.py. You can use it as a model to try to implement an encrypting column or an encrypting validator that could be applied to all columns. Oleg. -- Oleg Broytman http://phdru.name/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Timothy W. G. <tim...@si...> - 2011-02-23 17:44:19
|
Has anyone had success using SQLCipher (http://sqlcipher.net/) with SQLite through SQLObject? If you have, then I'd love to hear your solution. If you haven't but think it could work, I'd like to here your suggestions. If you think that I haven't got a chance, then please tell me that too! The real question is how to work with encryption through sqlobject; SQLCipher "might" be one way... I've found the following thread http://groups.google.com/group/sqlcipher/browse_thread/thread/b85f42dc9921df46 and downloaded the attached file at the bottom of the page. After unpacking "sqlcipher.7z", on my system I replaced "C:\Python27\DLLs\sqlite3.dll" with "C:\Downloads\sqlcipher\1.1.1\sqlite-3.6.22\MSVC\StaticLib\Release\sqlite3.dll" but haven't gotten any further. I'm not sure if there is any way to pass an encryption key through the current sqlobject sqlite connector. Without making any other changes to my program or databases I now get the message when attempting to connect: File "C:\Python27\lib\site-packages\sqlobject-0.13.0-py2.7.egg\sqlobject\sqlite\sqliteconnection.py", line 48, in __init__ raise ImportError('Cannot find an SQLite driver, tried %s' % drivers) ImportError: Cannot find an SQLite driver, tried pysqlite2,sqlite3,sqlite Thanks for any help, Tim |
From: Jason H. <jas...@gm...> - 2011-02-18 08:31:40
|
On 18 February 2011 16:12, Oleg Broytman <ph...@ph...> wrote: > Does SQLite support anything other than UTF-8? I think it's always > UTF-8 so you don't need (and actually, cannot) change anything. I thought it supported UTF-16 too, but uses UTF-8 by default. Presumably then, if I just leave it alone, it'll use UTF-8 (I just like to be explicit). Cheers, Jason |
From: Oleg B. <ph...@ph...> - 2011-02-18 08:16:17
|
On Fri, Feb 18, 2011 at 11:12:29AM +0300, Oleg Broytman wrote: > On Fri, Feb 18, 2011 at 03:50:41PM +0800, Jason Heeris wrote: > > When using MySQL with SQLObject, I can use a URI like: > > "mysql://.../db?charset=utf8" to indicate the encoding. What's the > > equivalent for SQLite? What if I create the tables using the > > .createTable() class method ??? how do I specify it there? > > Does SQLite support anything other than UTF-8? I think it's always > UTF-8 so you don't need (and actually, cannot) change anything. Aha, it does, to some extent: http://www.sqlite.org/pragma.html#pragma_encoding "It is not possible to change the text encoding of a database after it has been created and any attempt to do so will be silently ignored." So you only need this PRAGMA once - before you create you database. Oleg. -- Oleg Broytman http://phdru.name/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Oleg B. <ph...@ph...> - 2011-02-18 08:12:39
|
On Fri, Feb 18, 2011 at 03:50:41PM +0800, Jason Heeris wrote: > When using MySQL with SQLObject, I can use a URI like: > "mysql://.../db?charset=utf8" to indicate the encoding. What's the > equivalent for SQLite? What if I create the tables using the > .createTable() class method ??? how do I specify it there? Does SQLite support anything other than UTF-8? I think it's always UTF-8 so you don't need (and actually, cannot) change anything. Oleg. -- Oleg Broytman http://phdru.name/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Jason H. <jas...@gm...> - 2011-02-18 07:50:47
|
When using MySQL with SQLObject, I can use a URI like: "mysql://.../db?charset=utf8" to indicate the encoding. What's the equivalent for SQLite? What if I create the tables using the .createTable() class method — how do I specify it there? Thanks, Jason |
From: Sam's L. <sam...@gm...> - 2011-02-17 11:01:21
|
Cool. Well if it gets done I'll definitely use it. :) I'll try and take a look myself at the parts you mentioned when I have some free time in the next few weeks. Thanks Sam On Wed, Feb 16, 2011 at 2:38 AM, Oleg Broytman <ph...@ph...> wrote: > On Wed, Feb 16, 2011 at 02:10:41AM -0800, Sam's Lists wrote: > > Are there any plans to change that? > > There is no just because this is the first time the question is > raised. I've added it to the TODO list: > > http://sourceforge.net/mailarchive/forum.php?thread_name=E1PnpY6-00009p-IX%40webwareforpython.org&forum_name=sqlobject-cvs > > > I assume it's a pretty complicated change, right? > > At the first glance it seems one needs to change SOForeignKey (and > perhaps SOCol), sqlmeta.add/delColumn(); SQLObject._SO_foreignKey() must > take into account the id could be any column, not only an id; the > current code could be preserved as a shortcut in case otherColumn is id. > > Oleg. > -- > Oleg Broytman http://phdru.name/ ph...@ph... > Programmers don't die, they just GOSUB without RETURN. > > > ------------------------------------------------------------------------------ > The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE: > Pinpoint memory and threading errors before they happen. > Find and fix more than 250 security defects in the development cycle. > Locate bottlenecks in serial and parallel code that limit performance. > http://p.sf.net/sfu/intel-dev2devfeb > _______________________________________________ > sqlobject-discuss mailing list > sql...@li... > https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss > |
From: Oleg B. <ph...@ph...> - 2011-02-17 07:11:57
|
On Thu, Feb 17, 2011 at 09:49:46AM +0800, Jason Heeris wrote: > On 17 February 2011 09:23, Jason Heeris <jas...@gm...> wrote: > > Any other suggestions? > > Oooooh I'm a bit of an idiot. I failed to realise that ".filter" > RETURNS a filtered result set, it doesn't mutate the existing one! > > Your initial suggestion works fine :) Nice! Oleg. -- Oleg Broytman http://phdru.name/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Jason H. <jas...@gm...> - 2011-02-17 01:49:53
|
On 17 February 2011 09:23, Jason Heeris <jas...@gm...> wrote: > Any other suggestions? Oooooh I'm a bit of an idiot. I failed to realise that ".filter" RETURNS a filtered result set, it doesn't mutate the existing one! Your initial suggestion works fine :) Thanks, Jason |
From: Jason H. <jas...@gm...> - 2011-02-17 01:23:44
|
On 16 February 2011 17:05, Oleg Broytman <ph...@ph...> wrote: > If SVNDocument is actually Document in this example, and type to > filter must be compared equal to DocumentType.dbType Ah yes, sorry about those errors. > docs.filter( > (Document.q.dbDocumentTypeID==DocumentType.q.id) & > (DocumentType.q.dbType==type) > ) I still can't get this to work — even if I set "type" to something that doesn't match anything in the table, the filter has no effect — the count of results is the same before and after, when I'd expect it to be zero for a type not in the table. (I've checked that it goes through that "if", too.) I also changed the dbDocumentTypeID to dbDocumentType with no luck (what's the difference between the two? I notice the same naming change in the j-magic section of the docs). One of the other things I tried is to use a j-magic expression: Document.j.dbDocumentType & (DocumentType.q.dbType==type) ... but still nothing happens to the select result. I've been trying to construct an "IN" query, but haven't really gotten anywhere with that yet either. Any other suggestions? Cheers, Jason |
From: Oleg B. <ph...@ph...> - 2011-02-16 10:38:57
|
On Wed, Feb 16, 2011 at 02:10:41AM -0800, Sam's Lists wrote: > Are there any plans to change that? There is no just because this is the first time the question is raised. I've added it to the TODO list: http://sourceforge.net/mailarchive/forum.php?thread_name=E1PnpY6-00009p-IX%40webwareforpython.org&forum_name=sqlobject-cvs > I assume it's a pretty complicated change, right? At the first glance it seems one needs to change SOForeignKey (and perhaps SOCol), sqlmeta.add/delColumn(); SQLObject._SO_foreignKey() must take into account the id could be any column, not only an id; the current code could be preserved as a shortcut in case otherColumn is id. Oleg. -- Oleg Broytman http://phdru.name/ ph...@ph... Programmers don't die, they just GOSUB without RETURN. |
From: Sam's L. <sam...@gm...> - 2011-02-16 10:10:48
|
I see. Are there any plans to change that? I assume it's a pretty complicated change, right? -Sam On Fri, Feb 11, 2011 at 1:05 AM, Oleg Broytman <ph...@ph...> wrote: > On Thu, Feb 10, 2011 at 10:24:43PM -0800, Sam's Lists wrote: > > I'd like to have a foreign key use a unique column in another table which > is > > not the primary key. This works fine in Postgres, but I can't figure out > > how to do it in SQLObject. Any idea? > > SQLObject can only references an 'id' column. That's, probably, a > deficiency. > > Oleg. > -- > Oleg Broytman http://phdru.name/ ph...@ph... > Programmers don't die, they just GOSUB without RETURN. > > > ------------------------------------------------------------------------------ > The ultimate all-in-one performance toolkit: Intel(R) Parallel Studio XE: > Pinpoint memory and threading errors before they happen. > Find and fix more than 250 security defects in the development cycle. > Locate bottlenecks in serial and parallel code that limit performance. > http://p.sf.net/sfu/intel-dev2devfeb > _______________________________________________ > sqlobject-discuss mailing list > sql...@li... > https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss > |