Hi all,
I d like to insert a list of dictionary in a simple MySQL table but, I
have a problem, in my case, the MySQL default values are not
supported...
The table is very simple; 2 columns and a default value on the col2:
######
CREATE TABLE `test` (
`col1` int(11) default NULL,
`col2` int(11) default '3'
)
######
Here is the python code:
##################################
from sqlalchemy import *
db = create_engine("mysql://r...@localhost/test")
meta = MetaData(db)
meta.echo = True
table = Table("test", meta, autoload=True)
i = table.insert()
i.execute([{"col1" : 2, "col2" : 5}, {"col1" : 1}])
print list(db.execute("SELECT * FROM test"))
##################################
The result is:
[(2L, 5L), (1L, None)]
I don't understand... In my opinion, the result should be: [(2L, 5L),
(1L, 3L)]
I use Python 2.5.2 and sqlalchemy 0.4.7
Can someone help me please?
thks
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"sqlalchemy" group.
To post to this group, send email to [email protected]
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
-~----------~----~----~----~------~----~------~--~---