Murat Özsöyler wrote:
The following code inserts a row with the values: ID=1, NAME=u''.
<code>
m = trial2.Master(NAME="Deneme")
trial2.objectstore.commit()
</code>
If I comment out the default parameter for NAME column then I get this
exception:
Not sure where the 'trial2' comes from, but you need to set NAME to be something
outside of the constructor, i.e
m = trial2.Master()
m.NAME="Deneme"
trial2.objectstore.commit()
or add a constructor to your Master class that knows what to do with NAME, e.g.
class Master:
def __init__(self, name=None...)
self.NAME=name
...
assign_mapper() adds a mapper to your class (and a few functions, such as get(),
select_by(), etc but it doesn't add an __init__() that automatically assigns any
keyword args to properties. See an earlier email thread titled 'easy create
user-defined class' which has some code for this sort of auto-assignment.
HTH
Robert
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
Sqlalchemy-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users