OK, I committed a small addition to assign_mapper that will create a default __init__ method, if one does not already exist on the given class. the below example works now.

On Jan 15, 2006, at 3:37 AM, Murat Özsöyler wrote:

Hi,

Back from the long holidays, I've just checked out svn revision 817.

Given the following module:
<code>
from sqlalchemy import *

engine = create_engine("sqlite://filename=trial2.sqlldb")

MASTER = Table("MASTER", engine
, Column("ID", Integer, Sequence("MASTER_ID_SEQ"), primary_key=True, nullable=False)
 , Column("NAME", String(50), nullable=False), default="")
 )


class Master(object):
 pass

assign_mapper(Master, MASTER)
</code>

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:

Traceback (most recent call last):
File "<input>", line 1, in ?
File "c:\documents and settings\murat ozsoyler\my documents\alınan dosyalarım\sqlalchemy\lib\sqlalchemy\mapping\objectstore.py", line 65, in commit
 uow().commit(*obj)
File "c:\documents and settings\murat ozsoyler\my documents\alınan dosyalarım\sqlalchemy\lib\sqlalchemy\mapping\objectstore.py", line 280, in commit
 commit_context.execute()
File "c:\documents and settings\murat ozsoyler\my documents\alınan dosyalarım\sqlalchemy\lib\sqlalchemy\mapping\objectstore.py", line 395, in execute
 head.execute(self)
File "c:\documents and settings\murat ozsoyler\my documents\alınan dosyalarım\sqlalchemy\lib\sqlalchemy\mapping\objectstore.py", line 544, in execute
 self.mapper.save_obj(self.tosave_objects(), trans)
File "c:\documents and settings\murat ozsoyler\my documents\alınan dosyalarım\sqlalchemy\lib\sqlalchemy\mapping\mapper.py", line 572, in save_obj
 statement.execute(**params)
File "c:\documents and settings\murat ozsoyler\my documents\alınan dosyalarım\sqlalchemy\lib\sqlalchemy\sql.py", line 374, in execute
 return c.execute(*multiparams, **params)
File "c:\documents and settings\murat ozsoyler\my documents\alınan dosyalarım\sqlalchemy\lib\sqlalchemy\sql.py", line 272, in execute
 return self.engine.execute_compiled(self, params)
File "c:\documents and settings\murat ozsoyler\my documents\alınan dosyalarım\sqlalchemy\lib\sqlalchemy\engine.py", line 520, in execute_compiled
 proxy(str(compiled), parameters)
File "c:\documents and settings\murat ozsoyler\my documents\alınan dosyalarım\sqlalchemy\lib\sqlalchemy\engine.py", line 515, in proxy self.execute(statement, parameters, connection=connection, cursor=cursor) File "c:\documents and settings\murat ozsoyler\my documents\alınan dosyalarım\sqlalchemy\lib\sqlalchemy\engine.py", line 569, in execute
 self._execute(cursor, statement, parameters)
File "c:\documents and settings\murat ozsoyler\my documents\alınan dosyalarım\sqlalchemy\lib\sqlalchemy\engine.py", line 579, in _execute
 c.execute(statement, parameters)
OperationalError: MASTER.NAME may not be NULL

My configuration is:
 Win XP SP2 with latest patches
 Sqlite3.2.8
 Sqlalchemy svn rev 817
 Python 2.4.2

I suspect it is an issue with unicode and sqlite but I'm not proficient to pinpoint it...

Have a nice day...

Regards,

Murat Ozsoyler









-------------------------------------------------------
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_idv37&alloc_id865&op=click
_______________________________________________
Sqlalchemy-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users



-------------------------------------------------------
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_idv37&alloc_id865&op=click
_______________________________________________
Sqlalchemy-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users

Reply via email to