jason kirtland wrote:
> Gloria W wrote:
>> Hi All,
>>
>> Looking back in these posts, I tried several older variants of MySQL
>> datetime column initialization discussed here, and they're not
>> working.
>>
>> This works in Postgresql:
>>
>> sqlalchemy.Column('date_created', sqlalchemy.DateTime,
>>     sqlalchemy.PassiveDefault(sqlalchemy.sql.func.now()),
>> nullable=False)
>>
>> But the MySQL equivalent fails:
>>
>> sqlalchemy.Column('date_created', sqlalchemy.DateTime,
>>     sqlalchemy.PassiveDefault(text("CURRENT_TIMESTAMP")),
>> nullable=False)
>>
>> What is the valid syntax? Is it failing for other reasons?
> 
> The MySQL TIMESTAMP type is required for that default:
> 
>   from sqlalchemy.databases import mysql
>   sqlalchemy.Column('date_created', mysql.MSDateTime,
>       sqlalchemy.PassiveDefault(text("CURRENT_TIMESTAMP")),
>       nullable=False)

err, mysql.MSTimeStamp                ^^^^^^^^^^^^^^^^


--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to