Also, you might want default=uuid.uuid4 instead of default=uuid.uuid4(). I 
believe the former will call the uuid4 function separately for every record 
inserted (probably what you want), whereas the latter will generate a single 
unique uuid only once per call to db.define_table (which presumably may 
endure for more than one record insert, depending on what your code does).
 
Anthony
 
On Wednesday, May 4, 2011 11:49:42 PM UTC-4, mart wrote:

> Hi, 
>
> I think I may have been looking at this too long... its giving the 
> following error, and I can't see why... 
> (using DAL in script) 
>
> Thanks in advance, 
> Mart :) 
>
>
>         db.define_table('mail', 
>             Field('uuid',length=64,default=uuid.uuid4()), 
>             Field('recipients','list:string'),Field('From'), 
>             Field('password'),Field('smtp_server'),Field('smtp_port')) 
>         db.commit() 
>
>
> Traceback (most recent call last): 
>   File "/Users/mart/Applications/Aptana Studio 2.0/plugins/ 
> org.python.pydev.debug_1.6.5.2011020317/pysrc/pydevd.py", line 1133, 
> in <module> 
>     debugger.run(setup['file'], None, None) 
>   File "/Users/mart/Applications/Aptana Studio 2.0/plugins/ 
> org.python.pydev.debug_1.6.5.2011020317/pysrc/pydevd.py", line 918, in 
> run 
>     execfile(file, globals, locals) #execute the script 
>   File "/Users/mart/aptanaApps/src/_purple.py", line 524, in <module> 
>     dbBlueObj.defineTables() 
>   File "/Users/mart/aptanaApps/src/blueLite/db_storage/db_blue.py", 
> line 278, in defineTables 
>     Field('password'),Field('smtp_server'),Field('smtp_port')) 
>   File "/Users/mart/aptanaApps/src/blueLite/pyUtils/sql/web2py/ 
> dal.py", line 4028, in define_table 
>     polymodel=polymodel) 
>   File "/Users/mart/aptanaApps/src/blueLite/pyUtils/sql/web2py/ 
> dal.py", line 590, in create_table 
>     self.create_sequence_and_triggers(query,table) 
>   File "/Users/mart/aptanaApps/src/blueLite/pyUtils/sql/web2py/ 
> dal.py", line 1142, in create_sequence_and_triggers 
>     self.execute(query) 
>   File "/Users/mart/aptanaApps/src/blueLite/pyUtils/sql/web2py/ 
> dal.py", line 1152, in execute 
>     return self.log_execute(*a, **b) 
>   File "/Users/mart/aptanaApps/src/blueLite/pyUtils/sql/web2py/ 
> dal.py", line 1147, in log_execute 
>     ret = self.cursor.execute(*a,**b) 
> sqlite3.OperationalError: near "From": syntax error 
>

Reply via email to