[SQL-CVS] [ sqlobject-Bugs-1522366 ] No intermidiate table crated with one way RelatedJoin
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: SourceForge.net <no...@so...> - 2006-09-07 15:47:19
|
Bugs item #1522366, was opened at 2006-07-14 11:34 Message generated for change (Comment added) made by phd You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540672&aid=1522366&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: Wont Fix Priority: 5 Submitted By: Nobody/Anonymous (nobody) Assigned to: Nobody/Anonymous (nobody) Summary: No intermidiate table crated with one way RelatedJoin Initial Comment: I'm using SQLObject-0.7.1dev_r1675-py2.4.egg with Turbogears 0.9a6 When running tg-admin sql (sql|create) I get notice the following misfeature: RelatedJoin intermediate tables are only created when the table with the "lowest sorted" name is processed even if only the "highest sorted" name has a RelatedJoin. class File(SQLObject): filename = UnicodeCol() fileType = StringCol() sha1HexDigest = StringCol(length=40, alternateID=True) # NO related join here! class Project(SQLObject, HelperClassNotSqlObject): class sqlmeta: # Force SQLObject to create the intermediate # project_dumb_file table when looking at our project # files RelationalJoin instead of waiting to # create it until it finds the projects RelationalJoin # in DumbFile (which dows not exist). Our table must # be lexiographically smaller than DumbFile # a < d -> aproject < dumb_file table = "aproject" _defaultOrder = 'projectNumber' projectNumber = StringCol() files = RelatedJoin("File") description = UnicodeCol(default="") I do not want a relation from file to project because many classes has files and I do not want File to have relations to all these classes when looking at classes related to a file is not needed but looking at files related to a project is wery much needed. ---------------------------------------------------------------------- >Comment By: Oleg Broytmann (phd) Date: 2006-09-07 19:47 Message: Logged In: YES user_id=4799 Then don't do that. Create a proper RelatedJoin in the other direction. ---------------------------------------------------------------------- Comment By: Nobody/Anonymous (nobody) Date: 2006-07-14 11:44 Message: Logged In: NO Okay, it seems I was optimistic when renaming only the table. Actually the class has to be renamed, but this breaks with the following error: Traceback (most recent call last): File "c:\Python24\Scripts\tg-admin-script.py", line 7, in ? sys.exit( File "c:\python24\lib\site-packages\TurboGears-0.9a6-py2.4.egg\turbogears\command\base.py", line 275, in main command.run() File "c:\python24\lib\site-packages\TurboGears-0.9a6-py2.4.egg\turbogears\command\base.py", line 134, in run command.the_runner.run(sys.argv) File "c:\python24\lib\site-packages\SQLObject-0.7.1dev_r1675-py2.4.egg\sqlobject\manager\command.py", line 102, in run runner.run() File "c:\python24\lib\site-packages\SQLObject-0.7.1dev_r1675-py2.4.egg\sqlobject\manager\command.py", line 233, in run self.command() File "c:\python24\lib\site-packages\SQLObject-0.7.1dev_r1675-py2.4.egg\sqlobject\manager\command.py", line 508, in command print cls.createTableSQL().strip() + ';\n' File "c:\python24\lib\site-packages\SQLObject-0.7.1dev_r1675-py2.4.egg\sqlobject\main.py", line 1336, in createTableSQL sql += '\n' + cls.createJoinTablesSQL(connection=conn) File "c:\python24\lib\site-packages\SQLObject-0.7.1dev_r1675-py2.4.egg\sqlobject\main.py", line 1357, in createJoinTablesSQL for join in cls._getJoinsToCreate(): File "c:\python24\lib\site-packages\SQLObject-0.7.1dev_r1675-py2.4.egg\sqlobject\main.py", line 1390, in _getJoinsToCreate if join.soClass.__name__ > join.otherClass.__name__: AttributeError: 'SORelatedJoin' object has no attribute 'otherClass' And, I have no intention of renaming Project to aProject anyway ... ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=540672&aid=1522366&group_id=74338 |