Re: [SQLObject] cannot insert with Sybase
SQLObject is a Python ORM.
Brought to you by:
ianbicking,
phd
From: <wzi...@co...> - 2009-03-04 16:14:04
|
Hello Oleg and others, But if I use 'id' instead of 'title_id' I get: File "/diska/data/workspace/PyXtern/Bibliothek/eggs/SQLObject-0.10.4-py2.5.egg/sqlobject/main.py", line 1203, in __init__ File "/diska/data/workspace/PyXtern/Bibliothek/eggs/SQLObject-0.10.4-py2.5.egg/sqlobject/main.py", line 1237, in _create TypeError: titles() did not get expected keyword argument 'title_id' I hope it helps if I use dots to preserve the indentation: ======================================= from.sqlobject.import.* class.titles(.SQLObject.): ....title_id = IntCol() ....title = StringCol() ....class.sqlmeta: ........print.'class.sqlmeta' ........idName = 'title_id' ........lazyUpdate = False ======================================= second class to insert a row: ======================================= from sqlobject import * import titles class InsertNewTitle: ....def makeNewBook( self ): ........sybURI = "sybase://my_user_id:my_password@DBSERVER//library_info" ........konnection = connectionForURI(sybURI) ........konnection.debug = True ........konnection.autoCommit = True ........sqlhub.processConnection = konnection ........newKey = 1237 ........newTitle = "Mystery Book" ........book_b = titles.titles(id=newKey, title=newTitle) ........print 'for ID %d the title is %s' % (book_b.id, book_b.title) ........return None if __name__ == "__main__": ....instantiatedObject = InsertNewTitle() ....instantiatedObject.makeNewBook() ========================================= I also tried mixing various combinations of 'id' and 'title_id' in the two locations but an error always results, with no indication what it really wants. Thanks very much, ....WZ |