Found the stuff in the FAQ on sqlobject.org about how to do compound keys....my issue is close to this:
I have a table with two keys, and it is a many to many relationship. The keys are both have forein key constraints with other tables in the schema.
The primary key of this table is defined as a compound key made up of both fields...
After looking through the faq, and thinking a bit, I cobbled some code together which does not seem to work. Help?
This is my current sqlobject:
class FileIndex(SQLObject):
class sqlmeta:
table = 'file_index'
idName = 'file_name'
idType = str
fromDatabase = True
#cacheValues = False
def _init(self):
SQLObject._init(self)
self._SFIR=SOFileIndexRecord(self)
def _get_SFIR(self):
return self._SFIR
class SOFileIndexRecord(object):
def __init__(self, so):
self._so=so
def _get_code(self):
return self._so.code
def _set_code(self, value):
self._so.code=value
testCode=property(_get_code, _set_code)
def _get_fileName(self):
return self._so.fileName
def _set_fileName(self, value):
self._so.fileName=value
fileName=property(_get_fileName, _set_fileName)
This is the table as it stands according to my schema:
create table file_index (
code varchar REFERENCES metainfo (code),
file_name varchar REFERENCES files (file_name),
PRIMARY KEY (code, file_name) );
- [SQLObject] Question about a component using sqlmeta, that ... Mark True
- Re: [SQLObject] Question about a component using sqlme... Oleg Broytmann
- Re: [SQLObject] Question about a component using s... Mark True
- Re: [SQLObject] Question about a component usi... Oleg Broytmann
- Re: [SQLObject] Question about a component... Mark True
- Re: [SQLObject] Question about a comp... Oleg Broytmann
- Re: [SQLObject] Question about a ... Mark True
- Re: [SQLObject] Question abou... Oleg Broytmann
