reflection of column defaults needed to be PassiveDefault so they
dont fire off on the SA side, fixed in changeset 1762.
On Jul 31, 2006, at 4:25 AM, Khaled Daham wrote:
> mysql> explain tftp_hosts;
> +------------+--------------+------+-----+-------------------
> +----------------+
> | Field | Type | Null | Key | Default | Extra |
> +------------+--------------+------+-----+-------------------
> +----------------+
> | id | int(7) | NO | PRI | NULL |
> auto_increment |
> | ip | varchar(255) | YES | UNI | NULL
> | |
> | tftp_file | varchar(255) | YES | | NULL
> | |
> | updated_ts | timestamp | YES | | CURRENT_TIMESTAMP
> | |
> +------------+--------------+------+-----+-------------------
> +----------------+
>
> This table is autoloaded, and when doing an insert with only ip and
> tftp_file set, sqlalchemy also tries to update updated_ts with the
> default value 'CURRENT_TIMESTAMP', problem is that it looks like
> its quoted so you end up with '0000-00-00 00:00:00' since the
> string obviously is not a valid timestamp. CURRENT_TIMESTAMP should
> not be quoted here.
>
> On Wed, 26 Jul 2006, Michael Bayer wrote:
>
>> its not really clear what youre doing here, can you send a clearer
>> example ? what is the table you are autoloading ? who/what/where
>> is CURRENT_TIMESTAMP being called ?
>>
>>
>> On Jul 26, 2006, at 4:12 AM, Khaled Daham wrote:
>>
>>> I do an autoload of a table and current_timestamp doesnt really work
>>> [2006-07-26 10:04:21,117] [engine]: describe tftp_hosts
>>> [2006-07-26 10:04:21,117] [engine]: {}
>>> [2006-07-26 10:04:21,122] [engine]: SHOW CREATE TABLE tftp_hosts
>>> [2006-07-26 10:04:21,122] [engine]: {}
>>>>>> TablesTftp.tftp_host.insert().execute(ip = "1.1.1.1",
>>>>>> tftp_file = "test");
>>> [2006-07-26 10:04:37,777] [engine]: INSERT INTO tftp_hosts (ip,
>>> tftp_file, updated_ts) VALUES (%s, %s, %s)
>>> [2006-07-26 10:04:37,777] [engine]: ['1.1.1.1', 'test',
>>> 'CURRENT_TIMESTAMP']
>>> /usr/local/lib/python2.4/site-packages/SQLAlchemy-0.2.6-py2.4.egg/
>>> sqlalchemy/engine/default.py:84: Warning: Data truncated for
>>> column 'updated_ts' at row 1
>>> [2006-07-26 10:04:37,779] [engine]: COMMIT
>>> the updated_ts column are set to '0000-00-00 00:00:00', I guess
>>> the final
>>> query string has CURRENT_TIMESTAMP quoted, which will lead to the
>>> above date instead of doing
>>>
>>> insert into tftp_hosts(ip, tftp_file, updated_ts) values
>>> ("1.1.1.1", "test", CURRENT_TIMESTAMP);
>>> Doing a proper Table definition with updated_ts, default =
>>> func.current_timestamp() works however, just wondering why it
>>> doesnt pick
>>> up CURRENT_TIMESTAMP properly, it looks in ansisql.py that it
>>> should.
>>> /Khaled Daham
>>> Cell: +46-70-1810278
>>> FreeBSD: The Power to Serve! http://www.FreeBSD.org/
>>> This isn't rocket science -- but it _is_ computer science.
>>> --------------------------------------------------------------------
>>> -----
>>> Take Surveys. Earn Cash. Influence the Future of IT
>>> Join SourceForge.net's Techsay panel and you'll get the chance to
>>> share your
>>> opinions on IT & business topics through brief surveys -- and
>>> earn cash
>>> http://www.techsay.com/default.php?
>>> page=join.php&p=sourceforge&CID=DEVDEV
>>> _______________________________________________
>>> Sqlalchemy-users mailing list
>>> [email protected]
>>> https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users
>
> /Khaled Daham
> Cell: +46-70-1810278
> FreeBSD: The Power to Serve! http://www.FreeBSD.org/
> This isn't rocket science -- but it _is_ computer science.
>
> <bitti> "Todayy we are going to re-arrange our core with d-link
> switches"
> <bitti> "wtf?"
> <bitti> "Yes, they have 424 682 semlor points against ciscos 410
> 589 so we decided to buy hw from them"
-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys -- and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
Sqlalchemy-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlalchemy-users