default value for datetime in mysql 5.0

Issue #483 resolved
Former user created an issue

CREATE TABLE quickt ( symbol VARCHAR(10) NOT NULL, pdatetime DATE DEFAULT 0000-00-00 NOT NULL, PRIMARY KEY (sym, pdatetime) ) TYPE=MyISAM DEFAULT CHARSET=latin1

is generated while creating date columns. The default value isnt liked by MySQL 5. Changing it to "pdatetime date default 0 not null," works fine.

Comments (2)

  1. Former user Account Deleted

    similarily this doesn't work:

    158: a.create() 2007-02-17 22:48:04,018 INFO sqlalchemy.engine.base.Engine.0x..f4 CREATE TABLE ab ( t DATETIME DEFAULT CURRENT_TIMESTAMP, id INTEGER(11) ) TYPE=MyISAM DEFAULT CHARSET=latin1

    SQLError: (OperationalError) (1067, "Invalid default value for 't'") '\nCREATE TABLE ab (\n\tt DATETIME DEFAULT CURRENT_TIMESTAMP, \n\tid INTEGER(11)\n) TYPE=MyISAM DEFAULT CHARSET=latin1\n\n' ()

  2. Mike Bayer repo owner

    ticket requires a working test program illustrating the problem. the generated SQL looks like nothing thats coded into SQLAlchemy. note that the "default" argument on Column takes any textual SQL you like and is not determined by SA at all.

  3. Log in to comment