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/            p...@phdru.name
           Programmers don't die, they just GOSUB without RETURN.

------------------------------------------------------------------------------
What You Don't Know About Data Connectivity CAN Hurt You
This paper provides an overview of data connectivity, details
its effect on application quality, and explores various alternative
solutions. http://p.sf.net/sfu/progress-d2d
_______________________________________________
sqlobject-discuss mailing list
sqlobject-discuss@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to