I'm having issues with Python, MySQL and creating a table with two timestamp columns.
Executing the following SQL through Python and using MySQLDB:
CREATE TABLE test_db.test_with_two_datetime_columns (
`first_datetime_field` TIMESTAMP(6) NOT NULL DEFAULT 0,
`second_datetime_field` TIMESTAMP(6) NOT NULL DEFAULT 0
) ENGINE=InnoDB
I get the error (1067, Invalid default value for 'first_datetime_field')
, whereas I can easily fire of the following equal command in the MySQL
CLI:
$ mysql -h localhost
> CREATE TABLE test_db.test_with_two_datetime_columns (
`first_datetime_field` TIMESTAMP(6) NOT NULL DEFAULT 0,
`second_datetime_field` TIMESTAMP(6) NOT NULL DEFAULT 0
) ENGINE=InnoDB;
Query OK, 0 rows affected (0.01 sec)
Similarly through Sequel Pro the above command executes fine.
So I'm guessing the problem is with MySQLDB
(akak. MySQL-Python
), but that seems very weird
I'm using MySQL 5.6.17
, MySQL-Python 1.2.5
and Python 2.7
.