I'm using SQLalchemy 0.3.4 with MySQL 5.0 and MySQLdb 1.2.2  and try
to insert this table:

tas = Table(
   'ta', metadata,
   Column('idta',Integer,primary_key=True,autoincrement=False),
   Column('ts',TIMESTAMP,PassiveDefault(text("CURRENT_TIMESTAMP"))),

I get the next error (did some formatting on it):
sqlalchemy.exceptions.SQLError: (OperationalError) (1067, "Invalid
default value for 'ts'")
   '\nCREATE TABLE ta (
   \n\t    idta INTEGER NOT NULL,
   \n\t    ts DATETIME DEFAULT CURRENT_TIMESTAMP,
   \n\t    PRIMARY KEY (idta)\n
   ) ENGINE=InnoDB\n\n' ()

MySQL does not accept this.
When using SQL-directly this SQL is accepted:
'''CREATE TABLE ta (
                       idta        INTEGER           NOT NULL,
                       ts          TIMESTAMP       DEFAULT
CURRENT_TIMESTAMP,
                       PRIMARY KEY (idta)
                       )

Then I realised that SQLAlchemy passes a TIMESTAMP as DATETIME.
I fixed this in databases\mysql.py  so SQLAlchemy now passes
TIMESTAMP;
and all goes OK.

Is this a 'bug',  a feature or is there a better way?

Best regards,

eppye


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