sqlobject-cvs Mailing List for SQLObject (Page 146)
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
You can subscribe to this list here.
| 2003 |
Jan
|
Feb
|
Mar
(9) |
Apr
(74) |
May
(29) |
Jun
(16) |
Jul
(28) |
Aug
(10) |
Sep
(57) |
Oct
(9) |
Nov
(29) |
Dec
(12) |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 2004 |
Jan
(7) |
Feb
(14) |
Mar
(6) |
Apr
(3) |
May
(12) |
Jun
(34) |
Jul
(9) |
Aug
(29) |
Sep
(22) |
Oct
(2) |
Nov
(15) |
Dec
(52) |
| 2005 |
Jan
(47) |
Feb
(78) |
Mar
(14) |
Apr
(35) |
May
(33) |
Jun
(16) |
Jul
(26) |
Aug
(63) |
Sep
(40) |
Oct
(96) |
Nov
(96) |
Dec
(123) |
| 2006 |
Jan
(159) |
Feb
(144) |
Mar
(64) |
Apr
(31) |
May
(88) |
Jun
(48) |
Jul
(16) |
Aug
(64) |
Sep
(87) |
Oct
(92) |
Nov
(56) |
Dec
(76) |
| 2007 |
Jan
(94) |
Feb
(103) |
Mar
(126) |
Apr
(123) |
May
(85) |
Jun
(11) |
Jul
(130) |
Aug
(47) |
Sep
(65) |
Oct
(70) |
Nov
(12) |
Dec
(11) |
| 2008 |
Jan
(30) |
Feb
(55) |
Mar
(88) |
Apr
(20) |
May
(50) |
Jun
|
Jul
(38) |
Aug
(1) |
Sep
(9) |
Oct
(5) |
Nov
(6) |
Dec
(39) |
| 2009 |
Jan
(8) |
Feb
(16) |
Mar
(3) |
Apr
(33) |
May
(44) |
Jun
(1) |
Jul
(10) |
Aug
(33) |
Sep
(74) |
Oct
(22) |
Nov
|
Dec
(15) |
| 2010 |
Jan
(28) |
Feb
(22) |
Mar
(46) |
Apr
(29) |
May
(1) |
Jun
(1) |
Jul
(27) |
Aug
(8) |
Sep
(5) |
Oct
(33) |
Nov
(24) |
Dec
(41) |
| 2011 |
Jan
(4) |
Feb
(12) |
Mar
(35) |
Apr
(29) |
May
(19) |
Jun
(16) |
Jul
(32) |
Aug
(25) |
Sep
(5) |
Oct
(11) |
Nov
(21) |
Dec
(12) |
| 2012 |
Jan
(3) |
Feb
(4) |
Mar
(20) |
Apr
(4) |
May
(25) |
Jun
(13) |
Jul
|
Aug
|
Sep
(2) |
Oct
(25) |
Nov
(9) |
Dec
(1) |
| 2013 |
Jan
(6) |
Feb
(8) |
Mar
|
Apr
(10) |
May
(31) |
Jun
(7) |
Jul
(18) |
Aug
(33) |
Sep
(4) |
Oct
(16) |
Nov
|
Dec
(27) |
| 2014 |
Jan
(2) |
Feb
|
Mar
|
Apr
(11) |
May
(39) |
Jun
(8) |
Jul
(11) |
Aug
(4) |
Sep
|
Oct
(27) |
Nov
|
Dec
(71) |
| 2015 |
Jan
(17) |
Feb
(47) |
Mar
(33) |
Apr
|
May
|
Jun
(9) |
Jul
(7) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
(8) |
| 2016 |
Jan
(4) |
Feb
(4) |
Mar
|
Apr
|
May
(12) |
Jun
(7) |
Jul
(9) |
Aug
(31) |
Sep
(8) |
Oct
(3) |
Nov
(15) |
Dec
(1) |
| 2017 |
Jan
(13) |
Feb
(7) |
Mar
(14) |
Apr
(8) |
May
(10) |
Jun
(4) |
Jul
(2) |
Aug
(1) |
Sep
|
Oct
(8) |
Nov
(4) |
Dec
(5) |
| 2018 |
Jan
(2) |
Feb
(8) |
Mar
|
Apr
(4) |
May
|
Jun
(6) |
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
(1) |
Dec
|
| 2019 |
Jan
(1) |
Feb
(16) |
Mar
(1) |
Apr
(3) |
May
(5) |
Jun
(1) |
Jul
|
Aug
|
Sep
(2) |
Oct
|
Nov
(1) |
Dec
(3) |
| 2020 |
Jan
|
Feb
|
Mar
|
Apr
(1) |
May
(1) |
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
(2) |
Nov
|
Dec
(2) |
| 2021 |
Jan
|
Feb
(2) |
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
(1) |
Nov
(1) |
Dec
|
| 2022 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
(6) |
Oct
(1) |
Nov
(1) |
Dec
(4) |
| 2023 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
(3) |
Sep
(2) |
Oct
(2) |
Nov
(4) |
Dec
|
| 2024 |
Jan
|
Feb
(2) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(1) |
Aug
|
Sep
(1) |
Oct
|
Nov
|
Dec
(9) |
| 2025 |
Jan
|
Feb
(4) |
Mar
(2) |
Apr
|
May
|
Jun
|
Jul
|
Aug
(1) |
Sep
|
Oct
|
Nov
(2) |
Dec
(2) |
|
From: SourceForge.net <no...@so...> - 2006-01-03 12:56:26
|
Bugs item #1369871, was opened at 2005-11-30 12:20 Message generated for change (Comment added) made by phd You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540672&aid=1369871&group_id=74338 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: General Group: SQLObject release (specify) >Status: Closed >Resolution: Out of Date Priority: 5 Submitted By: Nobody/Anonymous (nobody) Assigned to: Nobody/Anonymous (nobody) Summary: v0.6: dropTable can not drop CASCADEing Initial Comment: Traceback (most recent call last): File "./cdb.py", line 1403, in ? main() File "./cdb.py", line 1399, in main m = mutateDb() File "./cdb.py", line 523, in __init__ self.cdb = clusterDb() File "/home/ramon/src/lisa/rc_db_utils/so_redesign/cluster_database.py", line 93, in __init__ table.dropTable( ifExists = True, dropJoinTables = True ) File "/usr/lib/python2.3/site-packages/sqlobject/main.py", line 967, in dropTable cls._connection.dropTable(cls._table, cascade) File "/usr/lib/python2.3/site-packages/sqlobject/postgres/pgconnection.py", line 93, in dropTable self.query("DROP TABLE %s %s" % (tableName, File "/usr/lib/python2.3/site-packages/sqlobject/dbconnection.py", line 196, in query return self._runWithConnection(self._query, s) File "/usr/lib/python2.3/site-packages/sqlobject/dbconnection.py", line 117, in _runWithConnection val = meth(conn, *args) File "/usr/lib/python2.3/site-packages/sqlobject/dbconnection.py", line 193, in _query self._executeRetry(conn, conn.cursor(), s) File "/usr/lib/python2.3/site-packages/sqlobject/dbconnection.py", line 188, in _executeRetry return cursor.execute(query) psycopg.ProgrammingError: ERROR: cannot drop table network because other objects depend on it HINT: Use DROP ... CASCADE to drop the dependent objects too. ---------------------------------------------------------------------- >Comment By: Oleg Broytmann (phd) Date: 2006-01-03 15:56 Message: Logged In: YES user_id=4799 Try this with 0.7 and SQLObject from the trunk. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540672&aid=1369871&group_id=74338 |
|
From: SourceForge.net <no...@so...> - 2006-01-03 12:54:47
|
Bugs item #1367868, was opened at 2005-11-28 04:18 Message generated for change (Comment added) made by phd You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540672&aid=1367868&group_id=74338 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: General >Group: SQLObject from repository >Status: Closed >Resolution: Works For Me Priority: 5 Submitted By: Nobody/Anonymous (nobody) >Assigned to: Oleg Broytmann (phd) Summary: Newlines escaped in PickleCol Initial Comment: Looks like the PickleCol is having its newlines escaped, which seems to ruin the pickle. Using version 0.7b1dev. Here's some example code: """ class Session(SQLObject): data = PickleCol() try: s = Session(data={'one': 1, 'two': range(10)}) except Exception, msg: print msg print msg.state print msg.value """ ---------------------------------------------------------------------- >Comment By: Oleg Broytmann (phd) Date: 2006-01-03 15:54 Message: Logged In: YES user_id=4799 Works for me in Postgres and SQLite. I haven't got any exception. The output is: 1/QueryOne: SELECT COUNT(relname) FROM pg_class WHERE relname = 'session' 1/QueryR : SELECT COUNT(relname) FROM pg_class WHERE relname = 'session' 1/COMMIT : auto 1/Query : CREATE TABLE session ( id SERIAL PRIMARY KEY, data BYTEA ) 1/QueryR : CREATE TABLE session ( id SERIAL PRIMARY KEY, data BYTEA ) 1/COMMIT : auto 1/QueryIns: INSERT INTO session (id, data) VALUES (1, '(dp1\\012S\'two\'\\012p2\\012(lp3\\012I0\\012aI1\\012aI2\\012aI3\\012aI4\\012aI5\\012aI6\\012aI7\\012aI8\\012aI9\\012asS\'one\'\\012p4\\012I1\\012s.') 1/COMMIT : auto 1/QueryOne: SELECT data FROM session WHERE id = 1 1/QueryR : SELECT data FROM session WHERE id = 1 1/COMMIT : auto ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540672&aid=1367868&group_id=74338 |
|
From: SourceForge.net <no...@so...> - 2006-01-03 12:32:49
|
Bugs item #1344338, was opened at 2005-11-01 01:28 Message generated for change (Comment added) made by phd You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540672&aid=1344338&group_id=74338 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: MySQL Group: SQLObject release (specify) Status: Open Resolution: None Priority: 5 Submitted By: Andy Dustman (adustman) Assigned to: Nobody/Anonymous (nobody) Summary: 0.7.0: autoCommit from URI wrong type Initial Comment: In dbconnection.py, when the URI is parsed, there is no special treatment or type conversion of the autoCommit parameter, so it is always stored as a string. In the MySQL case (mysql.mysqlconnection), this causes the call to conn.autocommit() to always, since that API function requires an integer (booleans work too). A workaround for this is to change conn.autocommit(self.autoCommit) to conn.autocommit(int(self.autoCommit)), though only works if an integer is used as a parameter; it fails if True or False is used. Note that sybase support has this sequence in SybaseConnection.__init__(): autoCommit = kw.get('autoCommit') if autoCommit: autoCommmit = int(autoCommit) else: autoCommit = None kw['autoCommit'] = autoCommit DBAPI.__init__(self, **kw) A similar block of code would also work for MySQLdb. ---------------------------------------------------------------------- >Comment By: Oleg Broytmann (phd) Date: 2006-01-03 15:32 Message: Logged In: YES user_id=4799 Documentation for MySQLdb says "Set the autocommit mode. True values enable; False value disable." What are those True and False - bools or ints? Should I write conn.autocommit(int(self.autoCommit)) or conn.autocommit(bool(self.autoCommit)) ? ---------------------------------------------------------------------- Comment By: Mike Kent (mrmakent) Date: 2005-12-09 20:11 Message: Logged In: YES user_id=1401261 I just ran into this same problem using SQLObject with TurboGears. Passing autoCommit as an empty string: mysql://server:port/db?autoCommit=&debug= as the previous commenter suggested did NOT work; I got the same TypeError exception. ---------------------------------------------------------------------- Comment By: Andy Dustman (adustman) Date: 2005-11-03 00:05 Message: Logged In: YES user_id=71372 That doesn't work; I tried it previously. It results in SQLObject trying to do conn.autocommit(''), which still results in a TypeError. Even though '' == False, it is not an integer, and thismethod requires an integer (or boolean). ---------------------------------------------------------------------- Comment By: Oleg Broytmann (phd) Date: 2005-11-02 23:42 Message: Logged In: YES user_id=4799 Pass autoCommit as an empty string: mysql://server:port/db?autoCommit=&debug= ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540672&aid=1344338&group_id=74338 |
|
From: <sub...@co...> - 2006-01-03 12:23:25
|
Author: phd
Date: 2006-01-03 12:23:20 +0000 (Tue, 03 Jan 2006)
New Revision: 1455
Modified:
home/phd/SQLObject/paramstyles/sqlobject/mssql/mssqlconnection.py
Log:
Merged patches from the revisions 1452:1454 from the trunk
Modified: home/phd/SQLObject/paramstyles/sqlobject/mssql/mssqlconnection.py
===================================================================
--- home/phd/SQLObject/paramstyles/sqlobject/mssql/mssqlconnection.py 2006-01-03 12:20:29 UTC (rev 1454)
+++ home/phd/SQLObject/paramstyles/sqlobject/mssql/mssqlconnection.py 2006-01-03 12:23:20 UTC (rev 1455)
@@ -19,17 +19,26 @@
self.dbconnection = sqlmodule.connect
# ADO uses unicode only (AFAIK)
self.usingUnicodeStrings = True
+
+ # Need to use SQLNCLI provider for SQL Server Express Edition
+ if kw.get("ncli"):
+ conn_str = "Provider=SQLNCLI;"
+ else:
+ conn_str = "Provider=SQLOLEDB;"
+
+ conn_str += "Data Source=%s;Initial Catalog=%s;"
+
# MSDE does not allow SQL server login
- if "sspi" in kw and kw["sspi"]:
- self.make_conn_str = lambda keys: \
- ["Provider=SQLOLEDB;Data Source=%s;Initial Catalog=%s;Integrated Security=SSPI;Persist Security Info=False" % (
- keys.host, keys.db)]
+ if kw.get("sspi"):
+ conn_str += "Integrated Security=SSPI;Persist Security Info=False"
+ self.make_conn_str = lambda keys: [conn_str % (keys.host, keys.db)]
else:
- self.make_conn_str = lambda keys: \
- ["Provider=SQLOLEDB;Data Source=%s;User Id=%s;Password=%s;Initial Catalog=%s" % (
- keys.host, keys.user, keys.password, keys.db)]
- if "sspi" in kw:
- del kw["sspi"]
+ conn_str += "User Id=%s;Password=%s"
+ self.make_conn_str = lambda keys: [conn_str % (keys.host, keys.db, keys.user, keys.password)]
+
+ col.popKey(kw, "sspi")
+ col.popKey(kw, "ncli")
+
except ImportError: # raise the exceptions other than ImportError for adodbapi absence
import pymssql as sqlmodule
self.dbconnection = sqlmodule.connect
|
|
From: <sub...@co...> - 2006-01-03 12:21:28
|
Author: phd
Date: 2006-01-03 12:20:29 +0000 (Tue, 03 Jan 2006)
New Revision: 1454
Modified:
SQLObject/branches/0.7-bugfix/sqlobject/mssql/mssqlconnection.py
Log:
Merged a patch from rev. 1453.
Modified: SQLObject/branches/0.7-bugfix/sqlobject/mssql/mssqlconnection.py
===================================================================
--- SQLObject/branches/0.7-bugfix/sqlobject/mssql/mssqlconnection.py 2006-01-03 12:02:24 UTC (rev 1453)
+++ SQLObject/branches/0.7-bugfix/sqlobject/mssql/mssqlconnection.py 2006-01-03 12:20:29 UTC (rev 1454)
@@ -19,16 +19,26 @@
self.dbconnection = sqlmodule.connect
# ADO uses unicode only (AFAIK)
self.usingUnicodeStrings = True
+
+ # Need to use SQLNCLI provider for SQL Server Express Edition
+ if kw.get("ncli"):
+ conn_str = "Provider=SQLNCLI;"
+ else:
+ conn_str = "Provider=SQLOLEDB;"
+
+ conn_str += "Data Source=%s;Initial Catalog=%s;"
+
# MSDE does not allow SQL server login
- if "sspi" in kw and kw["sspi"]:
- self.make_conn_str = lambda keys: \
- ["Provider=SQLOLEDB;Data Source=%s;Initial Catalog=%s;Integrated Security=SSPI;Persist Security Info=False" % (
- keys.host, keys.db)]
- del kw["sspi"]
+ if kw.get("sspi"):
+ conn_str += "Integrated Security=SSPI;Persist Security Info=False"
+ self.make_conn_str = lambda keys: [conn_str % (keys.host, keys.db)]
else:
- self.make_conn_str = lambda keys: \
- ["Provider=SQLOLEDB;Data Source=%s;User Id=%s;Password=%s;Initial Catalog=%s" % (
- keys.host, keys.user, keys.password, keys.db)]
+ conn_str += "User Id=%s;Password=%s"
+ self.make_conn_str = lambda keys: [conn_str % (keys.host, keys.db, keys.user, keys.password)]
+
+ col.popKey(kw, "sspi")
+ col.popKey(kw, "ncli")
+
except ImportError: # raise the exceptions other than ImportError for adodbapi absence
import pymssql as sqlmodule
self.dbconnection = sqlmodule.connect
|
|
From: SourceForge.net <no...@so...> - 2006-01-03 12:18:29
|
Patches item #1353728, was opened at 2005-11-11 08:20 Message generated for change (Comment added) made by linux4u You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=1353728&group_id=74338 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open Resolution: Invalid Priority: 5 Submitted By: Pau Aliagas (linux4u) Assigned to: Oleg Broytmann (phd) Summary: define foreign keys in Style Initial Comment: I don't like to use attrID all along the code to access related tables, I want to be able use the nomeclature I like taking advantage of the nice Style idea. This is especially true when you create RelatedJoins when you use a nomeclature like I do (table.id_table), but it's the same for all the nomeclatures you can imagine. In styles.py it warns: def instanceAttrToIDAttr(self, attr): # @@: Right now, because of how names are created for foreign # keys, you can't really change this style. return attr + "ID" With this patch you can define how you want the foreign keys generated, they won't be mandatorily generated as attrID. Example: class LongStyle(Style): """ This style is derived from Style, that does not do any translation, but constructs the table ids like id_table. """ def instanceAttrToIDAttr(self, attr): return "id_" + attr def tableReference(self, table): # str.rsplit is python 2.4+ only if version_info >= (2, 4): return "id_" + table.rsplit(".", 1)[-1] else: return "id_" + rsplit(table, ".", 1)[-1] class mm_server(SQLObject): class sqlmeta: table = "smsarena.mm_server" style = LongStyle(longID = True) _connection = conn_smsarena server = StringCol(alternateID = True, varchar = True, length = 255, alternateMethodName = "by_server") tz = StringCol(length = 20, default = 'CET', notNone = True) conutry_code = StringCol(length = 2, varchar = False, default = '', notNone = True) # until now I had to do this # mm_server_aliases = SQLMultipleJoin("mm_server_alias", joinColumn = "mm_serverID", orderBy = "server") # now it's perfect! mm_server_aliases = SQLMultipleJoin("mm_server_alias", orderBy = "server") class mm_server_alias(SQLObject): class sqlmeta: table = "smsarena.mm_server_alias" style = LongStyle(longID = True) _connection = conn_smsarena # until now I had to do this # mm_server = ForeignKey("mm_server", dbName = "id_mm_server") mm_server = ForeignKey("mm_server") server = StringCol(alternateID = True, varchar = True, length = 255, alternateMethodName = "by_server") I hope it's clear :) Pau ---------------------------------------------------------------------- >Comment By: Pau Aliagas (linux4u) Date: 2006-01-03 13:18 Message: Logged In: YES user_id=140558 It fails because the test is not right, it still has the ID postfix hardcoded. My fault, I did no send a patch for tests. This is the piece that fails: # Select by usual way s = TestWorkKey.selectBy(composerID=c.id, title='Symphony No. 9') I have not looked at tests until now, but it looks like there should be tests for the different provides styles, in this case, if you accept the patch, at least a test for the LongStyle provided and for the current naming styles. I'll try to cook up something, but it can take a little time. Any guidelines will be appreciated (I've just read the docs ;) ---------------------------------------------------------------------- Comment By: Oleg Broytmann (phd) Date: 2006-01-03 12:23 Message: Logged In: YES user_id=4799 test_selectBy_foreignKey.py fails: def test1(): setupClass([TestComposerKey, TestWorkKey]) c = TestComposerKey(name='Mahler, Gustav') > w1 = TestWorkKey(composer=c, title='Symphony No. 9') [/home/phd/work/SQLObject/SQLObject-patches/sqlobject/tests/test_selectBy_foreignKey.py:19] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ def __init__(self, **kw): # The get() classmethod/constructor uses a magic keyword # argument when it wants an empty object, fetched from the # database. So we have nothing more to do in that case: if kw.has_key('_SO_fetch_no_create'): return post_funcs = [] self.sqlmeta.send(events.RowCreateSignal, kw, post_funcs) # Pass the connection object along if we were given one. if kw.has_key('connection'): self._connection = kw['connection'] self.sqlmeta._perConnection = True del kw['connection'] self._SO_writeLock = threading.Lock() if kw.has_key('id'): id = self.sqlmeta.idType(kw['id']) del kw['id'] else: id = None > self._create(id, **kw) [/home/phd/work/SQLObject/SQLObject-patches/sqlobject/main.py:1210] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ def _create(self, id, **kw): self.sqlmeta._creating = True self._SO_createValues = {} self._SO_validatorState = SQLObjectState(self) # First we do a little fix-up on the keywords we were # passed: for column in self.sqlmeta.columnList: # Then we check if the column wasn't passed in, and # if not we try to get the default. if not kw.has_key(column.name) and not kw.has_key(column.foreignName): default = column.default # If we don't get it, it's an error: if default is NoDefault: E raise TypeError, "%s() did not get expected keyword argument %s" % (self.__class__.__name__, column.name) > TypeError: TestWorkKey() did not get expected keyword argument composerID [/home/phd/work/SQLObject/SQLObject-patches/sqlobject/main.py:1231] - - - - - - - - - - - - - test1: recorded stdout - - - - - - - - - - - - - - 1/QueryOne: SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_work_key' 1/QueryR : SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_work_key' 1/COMMIT : auto 1/QueryOne: SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_composer_key' 1/QueryR : SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_composer_key' 1/COMMIT : auto 1/QueryOne: SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_work_key' 1/QueryR : SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_work_key' 1/COMMIT : auto 1/QueryOne: SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_composer_key' 1/QueryR : SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_composer_key' 1/COMMIT : auto 1/QueryOne: SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_composer_key' 1/QueryR : SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_composer_key' 1/COMMIT : auto 1/Query : CREATE TABLE test_composer_key ( id SERIAL PRIMARY KEY, name TEXT ) 1/QueryR : CREATE TABLE test_composer_key ( id SERIAL PRIMARY KEY, name TEXT ) 1/COMMIT : auto 1/QueryOne: SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_work_key' 1/QueryR : SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_work_key' 1/COMMIT : auto 1/Query : CREATE TABLE test_work_key ( work_id SERIAL PRIMARY KEY, composer_id INT, title TEXT ) 1/QueryR : CREATE TABLE test_work_key ( work_id SERIAL PRIMARY KEY, composer_id INT, title TEXT ) 1/COMMIT : auto 1/Query : ALTER TABLE test_work_key ADD CONSTRAINT composer_id_exists FOREIGN KEY (composer_id) REFERENCES test_composer_key (id) 1/QueryR : ALTER TABLE test_work_key ADD CONSTRAINT composer_id_exists FOREIGN KEY (composer_id) REFERENCES test_composer_key (id) 1/COMMIT : auto 1/QueryIns: INSERT INTO test_composer_key (id, name) VALUES (1, 'Mahler, Gustav') 1/COMMIT : auto 1/QueryOne: SELECT name FROM test_composer_key WHERE id = 1 1/QueryR : SELECT name FROM test_composer_key WHERE id = 1 1/COMMIT : auto ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=1353728&group_id=74338 |
|
From: SourceForge.net <no...@so...> - 2006-01-03 12:14:49
|
Patches item #1354113, was opened at 2005-11-11 19:15 Message generated for change (Settings changed) made by phd You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=1354113&group_id=74338 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None >Status: Closed >Resolution: Accepted Priority: 5 Submitted By: Sidnei da Silva (dreamcatcher) Assigned to: Nobody/Anonymous (nobody) Summary: Patch to backport mssql support to 0.7-bugfix branch Initial Comment: This patch applies cleanly to 0.7-bugfix branch. Contains all the changes, including tests, to add mssql support. ---------------------------------------------------------------------- >Comment By: Oleg Broytmann (phd) Date: 2006-01-03 15:14 Message: Logged In: YES user_id=4799 It seems it's been applied already... ---------------------------------------------------------------------- Comment By: Oleg Broytmann (phd) Date: 2005-11-19 00:02 Message: Logged In: YES user_id=4799 You have forgotten to add the mssql directory to the patch. I'll try to copy it from the trunc... ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=1354113&group_id=74338 |
|
From: SourceForge.net <no...@so...> - 2006-01-03 12:03:17
|
Patches item #1364165, was opened at 2005-11-23 00:48 Message generated for change (Comment added) made by phd You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=1364165&group_id=74338 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None >Status: Closed >Resolution: Accepted Priority: 5 Submitted By: Matthew Good (magnum3065) Assigned to: Nobody/Anonymous (nobody) Summary: mssql SQL Native Client support Initial Comment: In order to use SQLObject with the new free Express Edition of SQL Server 2005 I needed to use the SQLNCLI provider for oledb instead of SQLOLEDB that was used before. This patch supports using the SQLNCLI provider by adding an optional query parameter to the URI such as: mssql://MYHOST\\SQLEXPRESS/my_db?sspi=true&ncli=true ---------------------------------------------------------------------- >Comment By: Oleg Broytmann (phd) Date: 2006-01-03 15:03 Message: Logged In: YES user_id=4799 Applied to the rev. 1453. Thank you! ---------------------------------------------------------------------- Comment By: Matthew Good (magnum3065) Date: 2005-11-23 00:49 Message: Logged In: YES user_id=716848 Oops, the box needs checked for the attachment to be uploaded. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=1364165&group_id=74338 |
|
From: <sub...@co...> - 2006-01-03 12:02:42
|
Author: phd
Date: 2006-01-03 12:02:24 +0000 (Tue, 03 Jan 2006)
New Revision: 1453
Modified:
SQLObject/trunk/sqlobject/mssql/mssqlconnection.py
Log:
Patch N 1364165.
Modified: SQLObject/trunk/sqlobject/mssql/mssqlconnection.py
===================================================================
--- SQLObject/trunk/sqlobject/mssql/mssqlconnection.py 2006-01-03 11:57:07 UTC (rev 1452)
+++ SQLObject/trunk/sqlobject/mssql/mssqlconnection.py 2006-01-03 12:02:24 UTC (rev 1453)
@@ -19,17 +19,26 @@
self.dbconnection = sqlmodule.connect
# ADO uses unicode only (AFAIK)
self.usingUnicodeStrings = True
+
+ # Need to use SQLNCLI provider for SQL Server Express Edition
+ if kw.get("ncli"):
+ conn_str = "Provider=SQLNCLI;"
+ else:
+ conn_str = "Provider=SQLOLEDB;"
+
+ conn_str += "Data Source=%s;Initial Catalog=%s;"
+
# MSDE does not allow SQL server login
- if "sspi" in kw and kw["sspi"]:
- self.make_conn_str = lambda keys: \
- ["Provider=SQLOLEDB;Data Source=%s;Initial Catalog=%s;Integrated Security=SSPI;Persist Security Info=False" % (
- keys.host, keys.db)]
+ if kw.get("sspi"):
+ conn_str += "Integrated Security=SSPI;Persist Security Info=False"
+ self.make_conn_str = lambda keys: [conn_str % (keys.host, keys.db)]
else:
- self.make_conn_str = lambda keys: \
- ["Provider=SQLOLEDB;Data Source=%s;User Id=%s;Password=%s;Initial Catalog=%s" % (
- keys.host, keys.user, keys.password, keys.db)]
- if "sspi" in kw:
- del kw["sspi"]
+ conn_str += "User Id=%s;Password=%s"
+ self.make_conn_str = lambda keys: [conn_str % (keys.host, keys.db, keys.user, keys.password)]
+
+ col.popKey(kw, "sspi")
+ col.popKey(kw, "ncli")
+
except ImportError: # raise the exceptions other than ImportError for adodbapi absence
import pymssql as sqlmodule
self.dbconnection = sqlmodule.connect
|
|
From: <sub...@co...> - 2006-01-03 11:57:26
|
Author: phd
Date: 2006-01-03 11:57:07 +0000 (Tue, 03 Jan 2006)
New Revision: 1452
Modified:
home/phd/SQLObject/paramstyles/sqlobject/main.py
Log:
Merged patches from the revisions 1449:1451 from the trunk
Modified: home/phd/SQLObject/paramstyles/sqlobject/main.py
===================================================================
--- home/phd/SQLObject/paramstyles/sqlobject/main.py 2006-01-03 11:42:17 UTC (rev 1451)
+++ home/phd/SQLObject/paramstyles/sqlobject/main.py 2006-01-03 11:57:07 UTC (rev 1452)
@@ -546,6 +546,10 @@
def delJoin(sqlmeta, joinDef):
soClass = sqlmeta.soClass
for join in sqlmeta.joins:
+ # previously deleted joins will be None, so it must
+ # be skipped or it'll error out on the next line.
+ if join is None:
+ continue
if joinDef is join.joinDef:
break
else:
|
|
From: <sub...@co...> - 2006-01-03 11:42:38
|
Author: phd
Date: 2006-01-03 11:42:17 +0000 (Tue, 03 Jan 2006)
New Revision: 1451
Modified:
SQLObject/branches/0.7-bugfix/sqlobject/main.py
Log:
Merged a patch from the rev 1450: patch N 1356651 from the SF tracker.
Modified: SQLObject/branches/0.7-bugfix/sqlobject/main.py
===================================================================
--- SQLObject/branches/0.7-bugfix/sqlobject/main.py 2006-01-03 11:35:21 UTC (rev 1450)
+++ SQLObject/branches/0.7-bugfix/sqlobject/main.py 2006-01-03 11:42:17 UTC (rev 1451)
@@ -522,6 +522,10 @@
def delJoin(sqlmeta, joinDef):
soClass = sqlmeta.soClass
for join in sqlmeta.joins:
+ # previously deleted joins will be None, so it must
+ # be skipped or it'll error out on the next line.
+ if join is None:
+ continue
if joinDef is join.joinDef:
break
else:
|
|
From: SourceForge.net <no...@so...> - 2006-01-03 11:42:25
|
Patches item #1356651, was opened at 2005-11-14 19:02 Message generated for change (Comment added) made by phd You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=1356651&group_id=74338 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None >Status: Closed >Resolution: Accepted Priority: 5 Submitted By: darkmyst (darkmyst) >Assigned to: Oleg Broytmann (phd) Summary: Fix for bug #1356639 Initial Comment: fixed the problem as described in the bug report by adding a check for None before the error gets a chance to be triggered. ---------------------------------------------------------------------- >Comment By: Oleg Broytmann (phd) Date: 2006-01-03 14:42 Message: Logged In: YES user_id=4799 Aplied to the revision 1450 to the trunk and backported to the 0.7-branch. Thank you! ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=1356651&group_id=74338 |
|
From: SourceForge.net <no...@so...> - 2006-01-03 11:37:19
|
Bugs item #1356639, was opened at 2005-11-14 18:52 Message generated for change (Comment added) made by phd You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540672&aid=1356639&group_id=74338 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: General Group: SQLObject from repository >Status: Closed >Resolution: Fixed Priority: 5 Submitted By: darkmyst (darkmyst) >Assigned to: Oleg Broytmann (phd) Summary: delJoin errors when adding and deleting multiple joins Initial Comment: I'm using SQLObject 0.7.0 but I looked at what's in the repository and the situation is the same there. I've encountered a situation, in testing my code, where I add a few joins to a table using sqlmeta.addJoin and then immediately remove them using sqlmeta.delJoin. In running the code I got the following error: File "/usr/lib/python2.4/site-packages/SQLObject-0.7.0-py2.4.egg/sqlobject/main.py", line 525, in delJoin if joinDef is join.joinDef: AttributeError: 'NoneType' object has no attribute 'joinDef' Both my addJoins went off without a hitch and the first delJoin as well. The second dellJoin is what tripped the error. Looking into it, I found that sqlmeta.addJoin uses a list to maintain joins (main.py, line 481) and then uses the index on the list as the reference point for a specific join (main.py, line 489). Therefore, as noted in delJoin (main.py, line 537), one can't just del the join from the list or it'll screw up the indexing. The problem seems to be in the for loop that checks to see if the join we want removed is present (main.py, line 525): 524: for join in sqlmeta.joins: 525: if joinDef is join.joinDef: 526: break If a join has previously been removed, it's set to None. However, in the if statement we see it's assumed that join will have an attribute joinDef. NoneType doesn't have an attribute joinDef, hence the error. Perhaps it should look more like: 524: for join in sqlmeta.joins: 525: if join is None: 526: continue 527: if joinDef is join.joinDef: 528: break ---------------------------------------------------------------------- >Comment By: Oleg Broytmann (phd) Date: 2006-01-03 14:37 Message: Logged In: YES user_id=4799 Fixed by the patch 1356651. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540672&aid=1356639&group_id=74338 |
|
From: <sub...@co...> - 2006-01-03 11:36:20
|
Author: phd
Date: 2006-01-03 11:35:21 +0000 (Tue, 03 Jan 2006)
New Revision: 1450
Modified:
SQLObject/trunk/sqlobject/main.py
Log:
A patch N 1356651 from the SF tracker.
Modified: SQLObject/trunk/sqlobject/main.py
===================================================================
--- SQLObject/trunk/sqlobject/main.py 2006-01-03 10:53:48 UTC (rev 1449)
+++ SQLObject/trunk/sqlobject/main.py 2006-01-03 11:35:21 UTC (rev 1450)
@@ -546,6 +546,10 @@
def delJoin(sqlmeta, joinDef):
soClass = sqlmeta.soClass
for join in sqlmeta.joins:
+ # previously deleted joins will be None, so it must
+ # be skipped or it'll error out on the next line.
+ if join is None:
+ continue
if joinDef is join.joinDef:
break
else:
|
|
From: SourceForge.net <no...@so...> - 2006-01-03 11:25:45
|
Patches item #1354113, was opened at 2005-11-11 19:15 Message generated for change (Settings changed) made by phd You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=1354113&group_id=74338 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open >Resolution: Invalid Priority: 5 Submitted By: Sidnei da Silva (dreamcatcher) Assigned to: Nobody/Anonymous (nobody) Summary: Patch to backport mssql support to 0.7-bugfix branch Initial Comment: This patch applies cleanly to 0.7-bugfix branch. Contains all the changes, including tests, to add mssql support. ---------------------------------------------------------------------- Comment By: Oleg Broytmann (phd) Date: 2005-11-19 00:02 Message: Logged In: YES user_id=4799 You have forgotten to add the mssql directory to the patch. I'll try to copy it from the trunc... ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=1354113&group_id=74338 |
|
From: SourceForge.net <no...@so...> - 2006-01-03 11:23:36
|
Patches item #1353728, was opened at 2005-11-11 10:20 Message generated for change (Comment added) made by phd You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=1353728&group_id=74338 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open >Resolution: Invalid Priority: 5 Submitted By: Pau Aliagas (linux4u) >Assigned to: Oleg Broytmann (phd) Summary: define foreign keys in Style Initial Comment: I don't like to use attrID all along the code to access related tables, I want to be able use the nomeclature I like taking advantage of the nice Style idea. This is especially true when you create RelatedJoins when you use a nomeclature like I do (table.id_table), but it's the same for all the nomeclatures you can imagine. In styles.py it warns: def instanceAttrToIDAttr(self, attr): # @@: Right now, because of how names are created for foreign # keys, you can't really change this style. return attr + "ID" With this patch you can define how you want the foreign keys generated, they won't be mandatorily generated as attrID. Example: class LongStyle(Style): """ This style is derived from Style, that does not do any translation, but constructs the table ids like id_table. """ def instanceAttrToIDAttr(self, attr): return "id_" + attr def tableReference(self, table): # str.rsplit is python 2.4+ only if version_info >= (2, 4): return "id_" + table.rsplit(".", 1)[-1] else: return "id_" + rsplit(table, ".", 1)[-1] class mm_server(SQLObject): class sqlmeta: table = "smsarena.mm_server" style = LongStyle(longID = True) _connection = conn_smsarena server = StringCol(alternateID = True, varchar = True, length = 255, alternateMethodName = "by_server") tz = StringCol(length = 20, default = 'CET', notNone = True) conutry_code = StringCol(length = 2, varchar = False, default = '', notNone = True) # until now I had to do this # mm_server_aliases = SQLMultipleJoin("mm_server_alias", joinColumn = "mm_serverID", orderBy = "server") # now it's perfect! mm_server_aliases = SQLMultipleJoin("mm_server_alias", orderBy = "server") class mm_server_alias(SQLObject): class sqlmeta: table = "smsarena.mm_server_alias" style = LongStyle(longID = True) _connection = conn_smsarena # until now I had to do this # mm_server = ForeignKey("mm_server", dbName = "id_mm_server") mm_server = ForeignKey("mm_server") server = StringCol(alternateID = True, varchar = True, length = 255, alternateMethodName = "by_server") I hope it's clear :) Pau ---------------------------------------------------------------------- >Comment By: Oleg Broytmann (phd) Date: 2006-01-03 14:23 Message: Logged In: YES user_id=4799 test_selectBy_foreignKey.py fails: def test1(): setupClass([TestComposerKey, TestWorkKey]) c = TestComposerKey(name='Mahler, Gustav') > w1 = TestWorkKey(composer=c, title='Symphony No. 9') [/home/phd/work/SQLObject/SQLObject-patches/sqlobject/tests/test_selectBy_foreignKey.py:19] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ def __init__(self, **kw): # The get() classmethod/constructor uses a magic keyword # argument when it wants an empty object, fetched from the # database. So we have nothing more to do in that case: if kw.has_key('_SO_fetch_no_create'): return post_funcs = [] self.sqlmeta.send(events.RowCreateSignal, kw, post_funcs) # Pass the connection object along if we were given one. if kw.has_key('connection'): self._connection = kw['connection'] self.sqlmeta._perConnection = True del kw['connection'] self._SO_writeLock = threading.Lock() if kw.has_key('id'): id = self.sqlmeta.idType(kw['id']) del kw['id'] else: id = None > self._create(id, **kw) [/home/phd/work/SQLObject/SQLObject-patches/sqlobject/main.py:1210] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ def _create(self, id, **kw): self.sqlmeta._creating = True self._SO_createValues = {} self._SO_validatorState = SQLObjectState(self) # First we do a little fix-up on the keywords we were # passed: for column in self.sqlmeta.columnList: # Then we check if the column wasn't passed in, and # if not we try to get the default. if not kw.has_key(column.name) and not kw.has_key(column.foreignName): default = column.default # If we don't get it, it's an error: if default is NoDefault: E raise TypeError, "%s() did not get expected keyword argument %s" % (self.__class__.__name__, column.name) > TypeError: TestWorkKey() did not get expected keyword argument composerID [/home/phd/work/SQLObject/SQLObject-patches/sqlobject/main.py:1231] - - - - - - - - - - - - - test1: recorded stdout - - - - - - - - - - - - - - 1/QueryOne: SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_work_key' 1/QueryR : SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_work_key' 1/COMMIT : auto 1/QueryOne: SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_composer_key' 1/QueryR : SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_composer_key' 1/COMMIT : auto 1/QueryOne: SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_work_key' 1/QueryR : SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_work_key' 1/COMMIT : auto 1/QueryOne: SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_composer_key' 1/QueryR : SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_composer_key' 1/COMMIT : auto 1/QueryOne: SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_composer_key' 1/QueryR : SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_composer_key' 1/COMMIT : auto 1/Query : CREATE TABLE test_composer_key ( id SERIAL PRIMARY KEY, name TEXT ) 1/QueryR : CREATE TABLE test_composer_key ( id SERIAL PRIMARY KEY, name TEXT ) 1/COMMIT : auto 1/QueryOne: SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_work_key' 1/QueryR : SELECT COUNT(relname) FROM pg_class WHERE relname = 'test_work_key' 1/COMMIT : auto 1/Query : CREATE TABLE test_work_key ( work_id SERIAL PRIMARY KEY, composer_id INT, title TEXT ) 1/QueryR : CREATE TABLE test_work_key ( work_id SERIAL PRIMARY KEY, composer_id INT, title TEXT ) 1/COMMIT : auto 1/Query : ALTER TABLE test_work_key ADD CONSTRAINT composer_id_exists FOREIGN KEY (composer_id) REFERENCES test_composer_key (id) 1/QueryR : ALTER TABLE test_work_key ADD CONSTRAINT composer_id_exists FOREIGN KEY (composer_id) REFERENCES test_composer_key (id) 1/COMMIT : auto 1/QueryIns: INSERT INTO test_composer_key (id, name) VALUES (1, 'Mahler, Gustav') 1/COMMIT : auto 1/QueryOne: SELECT name FROM test_composer_key WHERE id = 1 1/QueryR : SELECT name FROM test_composer_key WHERE id = 1 1/COMMIT : auto ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=1353728&group_id=74338 |
|
From: SourceForge.net <no...@so...> - 2006-01-03 11:17:54
|
Patches item #1370278, was opened at 2005-11-30 21:32 Message generated for change (Comment added) made by phd You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=1370278&group_id=74338 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: None Group: None Status: Open >Resolution: Invalid Priority: 5 Submitted By: Luke Opperman (luke_opperman) >Assigned to: Oleg Broytmann (phd) Summary: Synchronize main connection cache during transaction commit Initial Comment: See this thread: http://pythonpaste.org/archives/message/20051129.172427.0ec7941f.en.html And this earlier one: http://sourceforge.net/mailarchive/message.php?msg_id=11354123 This fix deals with something not mentioned in the latter message, objects deleted as part of the transaction. ---------------------------------------------------------------------- >Comment By: Oleg Broytmann (phd) Date: 2006-01-03 14:17 Message: Logged In: YES user_id=4799 Error with PySQLite 1 and 2 in test_transactions.py: Exception _sqlite.ProgrammingError: <_sqlite.ProgrammingError instance at 0xb7729d0c> in <bound method Transaction.__del__ of <sqlobject.dbconnection.Transaction object at 0xb7731b4c>> ignored Exception pysqlite2.dbapi2.ProgrammingError: 'Cannot operate on a closed database.' in <bound method Transaction.__del__ of <sqlobject.dbconnection.Transaction object at 0xb771944c>> ignored With Postgres the test passed ok. ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540674&aid=1370278&group_id=74338 |
|
From: <sub...@co...> - 2006-01-03 10:54:15
|
Author: phd
Date: 2006-01-03 10:53:48 +0000 (Tue, 03 Jan 2006)
New Revision: 1449
Modified:
SQLObject/docs/FAQ.txt
Log:
Removed low-importance warning.
Modified: SQLObject/docs/FAQ.txt
===================================================================
--- SQLObject/docs/FAQ.txt 2005-12-30 22:28:35 UTC (rev 1448)
+++ SQLObject/docs/FAQ.txt 2006-01-03 10:53:48 UTC (rev 1449)
@@ -421,5 +421,3 @@
for constraint in constraints:
connection.query(constraint)
-
-Please be warned the delay can cause a race condition.
|
|
From: <sub...@co...> - 2005-12-30 22:28:41
|
Author: phd
Date: 2005-12-30 22:28:35 +0000 (Fri, 30 Dec 2005)
New Revision: 1448
Modified:
home/phd/SQLObject/paramstyles/sqlobject/dbconnection.py
Log:
Merged a patch by Aaditya Sood and Kevin Dangoor from rev. 1446 for the case
where self._obsolete is accessed during __init__() - it must be already there.
Modified: home/phd/SQLObject/paramstyles/sqlobject/dbconnection.py
===================================================================
--- home/phd/SQLObject/paramstyles/sqlobject/dbconnection.py 2005-12-30 22:28:18 UTC (rev 1447)
+++ home/phd/SQLObject/paramstyles/sqlobject/dbconnection.py 2005-12-30 22:28:35 UTC (rev 1448)
@@ -791,11 +791,11 @@
class Transaction(object):
def __init__(self, dbConnection):
+ self._obsolete = False
self._dbConnection = dbConnection
self._connection = dbConnection.getConnection()
self._dbConnection._setAutoCommit(self._connection, 0)
self.cache = CacheSet(cache=dbConnection.doCache)
- self._obsolete = False
def assertActive(self):
assert not self._obsolete, "This transaction has already gone through ROLLBACK; begin another transaction"
|
|
From: <sub...@co...> - 2005-12-30 22:28:22
|
Author: phd
Date: 2005-12-30 22:28:18 +0000 (Fri, 30 Dec 2005)
New Revision: 1447
Modified:
SQLObject/branches/0.7-bugfix/sqlobject/dbconnection.py
Log:
Merged a patch by Aaditya Sood and Kevin Dangoor from rev. 1446 for the case
where self._obsolete is accessed during __init__() - it must be already there.
Modified: SQLObject/branches/0.7-bugfix/sqlobject/dbconnection.py
===================================================================
--- SQLObject/branches/0.7-bugfix/sqlobject/dbconnection.py 2005-12-30 22:27:41 UTC (rev 1446)
+++ SQLObject/branches/0.7-bugfix/sqlobject/dbconnection.py 2005-12-30 22:28:18 UTC (rev 1447)
@@ -726,11 +726,11 @@
class Transaction(object):
def __init__(self, dbConnection):
+ self._obsolete = False
self._dbConnection = dbConnection
self._connection = dbConnection.getConnection()
self._dbConnection._setAutoCommit(self._connection, 0)
self.cache = CacheSet(cache=dbConnection.doCache)
- self._obsolete = False
def assertActive(self):
assert not self._obsolete, "This transaction has already gone through ROLLBACK; begin another transaction"
|
|
From: <sub...@co...> - 2005-12-30 22:27:50
|
Author: phd
Date: 2005-12-30 22:27:41 +0000 (Fri, 30 Dec 2005)
New Revision: 1446
Modified:
SQLObject/trunk/sqlobject/dbconnection.py
Log:
A patch by Aaditya Sood and Kevin Dangoor for the case
where self._obsolete is accessed during __init__() - it must be already there.
Modified: SQLObject/trunk/sqlobject/dbconnection.py
===================================================================
--- SQLObject/trunk/sqlobject/dbconnection.py 2005-12-30 20:36:19 UTC (rev 1445)
+++ SQLObject/trunk/sqlobject/dbconnection.py 2005-12-30 22:27:41 UTC (rev 1446)
@@ -778,11 +778,11 @@
class Transaction(object):
def __init__(self, dbConnection):
+ self._obsolete = False
self._dbConnection = dbConnection
self._connection = dbConnection.getConnection()
self._dbConnection._setAutoCommit(self._connection, 0)
self.cache = CacheSet(cache=dbConnection.doCache)
- self._obsolete = False
def assertActive(self):
assert not self._obsolete, "This transaction has already gone through ROLLBACK; begin another transaction"
|
|
From: <sub...@co...> - 2005-12-30 20:36:31
|
Author: phd
Date: 2005-12-30 20:36:19 +0000 (Fri, 30 Dec 2005)
New Revision: 1445
Modified:
SQLObject/docs/FAQ.txt
Log:
Documented using applyConstraints for mutually referencing tables.
Modified: SQLObject/docs/FAQ.txt
===================================================================
--- SQLObject/docs/FAQ.txt 2005-12-30 20:18:32 UTC (rev 1444)
+++ SQLObject/docs/FAQ.txt 2005-12-30 20:36:19 UTC (rev 1445)
@@ -391,3 +391,35 @@
The reason for this limit is that each object needs a database ID, and
in many databases you cannot attain an ID until you create a row.
+Mutually referencing tables
+---------------------------
+
+How can I create mutually referencing tables? For the code::
+
+ class Person(SQLObject):
+ role = ForeignKey("Role")
+
+ class Role(SQLObject):
+ person = ForeignKey("Person")
+
+ Person.createTable()
+ Role.createTable()
+
+Postgres raises ProgrammingError: ERROR: relation "role" does not exist.
+
+The correct way is to delay constraints creation until all tables are
+created::
+
+ class Person(SQLObject):
+ role = ForeignKey("Role")
+
+ class Role(SQLObject):
+ person = ForeignKey("Person")
+
+ constraints = Person.createTable(applyConstraints=False)
+ constraints += Role.createTable(applyConstraints=False)
+
+ for constraint in constraints:
+ connection.query(constraint)
+
+Please be warned the delay can cause a race condition.
|
|
From: <sub...@co...> - 2005-12-30 20:18:37
|
Author: phd
Date: 2005-12-30 20:18:32 +0000 (Fri, 30 Dec 2005)
New Revision: 1444
Modified:
home/phd/SQLObject/paramstyles/sqlobject/main.py
home/phd/SQLObject/paramstyles/sqlobject/tests/dbtest.py
home/phd/SQLObject/paramstyles/sqlobject/tests/test_cyclic_reference.py
Log:
Merged patches from the revisions 1440:1442 from the trunk: applyConstraints.
Modified: home/phd/SQLObject/paramstyles/sqlobject/main.py
===================================================================
--- home/phd/SQLObject/paramstyles/sqlobject/main.py 2005-12-30 20:17:27 UTC (rev 1443)
+++ home/phd/SQLObject/paramstyles/sqlobject/main.py 2005-12-30 20:18:32 UTC (rev 1444)
@@ -1349,7 +1349,7 @@
dropTable = classmethod(dropTable)
def createTable(cls, ifNotExists=False, createJoinTables=True,
- createIndexes=True,
+ createIndexes=True, applyConstraints=True,
connection=None):
conn = connection or cls._connection
if ifNotExists and conn.tableExists(cls.sqlmeta.table):
@@ -1359,7 +1359,11 @@
cls.sqlmeta.send(events.CreateTableSignal, cls, connection,
extra_sql, post_funcs)
constraints = conn.createTable(cls)
- extra_sql.extend(constraints)
+ if applyConstraints:
+ for constraint in constraints:
+ conn.query(constraint)
+ else:
+ extra_sql.extend(constraints)
if createJoinTables:
cls.createJoinTables(ifNotExists=ifNotExists,
connection=conn)
@@ -1371,8 +1375,8 @@
return extra_sql
createTable = classmethod(createTable)
- def createTableSQL(cls, createJoinTables=True, connection=None,
- createIndexes=True):
+ def createTableSQL(cls, createJoinTables=True, createIndexes=True,
+ connection=None):
conn = connection or cls._connection
sql, constraints = conn.createTableSQL(cls)
if createJoinTables:
Modified: home/phd/SQLObject/paramstyles/sqlobject/tests/dbtest.py
===================================================================
--- home/phd/SQLObject/paramstyles/sqlobject/tests/dbtest.py 2005-12-30 20:17:27 UTC (rev 1443)
+++ home/phd/SQLObject/paramstyles/sqlobject/tests/dbtest.py 2005-12-30 20:18:32 UTC (rev 1444)
@@ -166,7 +166,7 @@
soClass._connection.query(sql)
else:
sql, extra_sql = soClass.createTableSQL()
- soClass.createTable()
+ soClass.createTable(applyConstraints=False)
all_extra.extend(extra_sql)
cls(tableName=soClass.sqlmeta.table,
createSQL=sql,
Modified: home/phd/SQLObject/paramstyles/sqlobject/tests/test_cyclic_reference.py
===================================================================
--- home/phd/SQLObject/paramstyles/sqlobject/tests/test_cyclic_reference.py 2005-12-30 20:17:27 UTC (rev 1443)
+++ home/phd/SQLObject/paramstyles/sqlobject/tests/test_cyclic_reference.py 2005-12-30 20:18:32 UTC (rev 1444)
@@ -32,11 +32,11 @@
TestCyclicReferenceB.dropTable(ifExists=True, cascade=True)
assert not conn.tableExists(TestCyclicReferenceB.sqlmeta.table)
- constraints = TestCyclicReferenceA.createTable(ifNotExists=True)
- print constraints
+ constraints = TestCyclicReferenceA.createTable(ifNotExists=True,
+ applyConstraints=False)
assert conn.tableExists(TestCyclicReferenceA.sqlmeta.table)
- constraints += TestCyclicReferenceB.createTable(ifNotExists=True)
- print constraints
+ constraints += TestCyclicReferenceB.createTable(ifNotExists=True,
+ applyConstraints=False)
assert conn.tableExists(TestCyclicReferenceB.sqlmeta.table)
for constraint in constraints:
|
|
From: <sub...@co...> - 2005-12-30 20:17:34
|
Author: phd
Date: 2005-12-30 20:17:27 +0000 (Fri, 30 Dec 2005)
New Revision: 1443
Modified:
SQLObject/trunk/sqlobject/main.py
SQLObject/trunk/sqlobject/tests/dbtest.py
SQLObject/trunk/sqlobject/tests/test_cyclic_reference.py
Log:
applyConstraints
Modified: SQLObject/trunk/sqlobject/main.py
===================================================================
--- SQLObject/trunk/sqlobject/main.py 2005-12-28 12:15:26 UTC (rev 1442)
+++ SQLObject/trunk/sqlobject/main.py 2005-12-30 20:17:27 UTC (rev 1443)
@@ -1349,7 +1349,7 @@
dropTable = classmethod(dropTable)
def createTable(cls, ifNotExists=False, createJoinTables=True,
- createIndexes=True,
+ createIndexes=True, applyConstraints=True,
connection=None):
conn = connection or cls._connection
if ifNotExists and conn.tableExists(cls.sqlmeta.table):
@@ -1359,7 +1359,11 @@
cls.sqlmeta.send(events.CreateTableSignal, cls, connection,
extra_sql, post_funcs)
constraints = conn.createTable(cls)
- extra_sql.extend(constraints)
+ if applyConstraints:
+ for constraint in constraints:
+ conn.query(constraint)
+ else:
+ extra_sql.extend(constraints)
if createJoinTables:
cls.createJoinTables(ifNotExists=ifNotExists,
connection=conn)
@@ -1371,8 +1375,8 @@
return extra_sql
createTable = classmethod(createTable)
- def createTableSQL(cls, createJoinTables=True, connection=None,
- createIndexes=True):
+ def createTableSQL(cls, createJoinTables=True, createIndexes=True,
+ connection=None):
conn = connection or cls._connection
sql, constraints = conn.createTableSQL(cls)
if createJoinTables:
Modified: SQLObject/trunk/sqlobject/tests/dbtest.py
===================================================================
--- SQLObject/trunk/sqlobject/tests/dbtest.py 2005-12-28 12:15:26 UTC (rev 1442)
+++ SQLObject/trunk/sqlobject/tests/dbtest.py 2005-12-30 20:17:27 UTC (rev 1443)
@@ -166,7 +166,7 @@
soClass._connection.query(sql)
else:
sql, extra_sql = soClass.createTableSQL()
- soClass.createTable()
+ soClass.createTable(applyConstraints=False)
all_extra.extend(extra_sql)
cls(tableName=soClass.sqlmeta.table,
createSQL=sql,
Modified: SQLObject/trunk/sqlobject/tests/test_cyclic_reference.py
===================================================================
--- SQLObject/trunk/sqlobject/tests/test_cyclic_reference.py 2005-12-28 12:15:26 UTC (rev 1442)
+++ SQLObject/trunk/sqlobject/tests/test_cyclic_reference.py 2005-12-30 20:17:27 UTC (rev 1443)
@@ -32,11 +32,11 @@
TestCyclicReferenceB.dropTable(ifExists=True, cascade=True)
assert not conn.tableExists(TestCyclicReferenceB.sqlmeta.table)
- constraints = TestCyclicReferenceA.createTable(ifNotExists=True)
- print constraints
+ constraints = TestCyclicReferenceA.createTable(ifNotExists=True,
+ applyConstraints=False)
assert conn.tableExists(TestCyclicReferenceA.sqlmeta.table)
- constraints += TestCyclicReferenceB.createTable(ifNotExists=True)
- print constraints
+ constraints += TestCyclicReferenceB.createTable(ifNotExists=True,
+ applyConstraints=False)
assert conn.tableExists(TestCyclicReferenceB.sqlmeta.table)
for constraint in constraints:
|
|
From: SourceForge.net <no...@so...> - 2005-12-29 14:11:11
|
Bugs item #1392862, was opened at 2005-12-29 06:09 Message generated for change (Comment added) made by nobody You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540672&aid=1392862&group_id=74338 Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: General Group: SQLObject release (specify) Status: Open Resolution: None Priority: 5 Submitted By: Nobody/Anonymous (nobody) Assigned to: Nobody/Anonymous (nobody) Summary: An SQLObject class can't natively refer to another class in Initial Comment: Submitted by: michele.cella AT gmail DOT com SQLObject 0.8 This was (is) needed by the TurboGears identity system. The only (ugly) solution is to use names like TG_User. Related links: http://groups.google.com/group/turbogears/browse_frm/thread/a9aa7fe3f4e346ef/a782f8a010bcdbde?q=jeff+registry&rnum=1#a782f8a010bcdbde http://nerd.newburyportion.com/2005/11/updated-identity-framework ---------------------------------------------------------------------- Comment By: Nobody/Anonymous (nobody) Date: 2005-12-29 06:11 Message: Logged In: NO Right subject was: An SQLObject class can't natively refer to another class in a separate registry ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540672&aid=1392862&group_id=74338 |