I try to create the table with column:

Column('ends_at', TIMESTAMP, nullable=True, server_default="")

That results to SQL:

CREATE TABLE news (
       ....
        ends_at TIMESTAMP DEFAULT '',
      ....
)

But mysql TIMESTAMP columns are NOT NULL by default, so I get this
exception:

(1067, "Invalid default value for 'ends_at'")

However, a TIMESTAMP column can be allowed to contain NULL by
declaring it with the NULL attribute.
How to add NULL attribute explicitly? so the generated code would be:

CREATE TABLE news (
       ....
        ends_at TIMESTAMP NULL DEFAULT '',
      ....
)



--~--~---------~--~----~------------~-------~--~----~
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 
sqlalchemy+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to