[sqlalchemy] Re: default=0.0 on Float Column produces `col` float default NULL

2008-11-10 Thread jason kirtland

Simon wrote:
 Hi all,
 
 I'm using SA 0.5.0rc3 and MySQL 5.0.51a on Mac OS X 10.4.11. I have a
 table with a float column and would like to have a default value of 0:
 
 Column('col', Float(), default=0.0)
 
 However, executing metadata.create_all(engine) yields
 
 CREATE TABLE `Table` (
   ...
   `col` float default NULL,
   ...
 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
 
 Is that a bug, or am I erring somewhere?

default= is purely a client-side default executed in Python.  For a 
server-side (DDL) default, you want Column(, server_default='0.0')



--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---



[sqlalchemy] Re: default=0.0 on Float Column produces `col` float default NULL

2008-11-10 Thread jason kirtland

With 0.4 it's a positional argument to Column: Column('col', Float(), 
PassiveDefault('0.0'))

Simon wrote:
 Thanks Jason! Is there any way of doing this in SA 0.4 as well?
 
 On 10 Nov., 16:42, jason kirtland [EMAIL PROTECTED] wrote:
 Simon wrote:
 Hi all,
 I'm using SA 0.5.0rc3 and MySQL 5.0.51a on Mac OS X 10.4.11. I have a
 table with a float column and would like to have a default value of 0:
 Column('col', Float(), default=0.0)
 However, executing metadata.create_all(engine) yields
 CREATE TABLE `Table` (
   ...
   `col` float default NULL,
   ...
 ) ENGINE=InnoDB DEFAULT CHARSET=latin1
 Is that a bug, or am I erring somewhere?
 default= is purely a client-side default executed in Python.  For a
 server-side (DDL) default, you want Column(, server_default='0.0')
  


--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---