When I run the code below, I got a error

sqlalchemy.exceptions.SQLError: (LookupError) unknown encoding:
latin1_swedish_ci 'INSERT INTO `users` (name, age) VALUES (%s, %s)'
[['John', 42], ['Susan', 57], ['Carl', 33]]

How can I fix it? Thanks

from sqlalchemy import *

db =
create_engine('mysql://root:[EMAIL PROTECTED]@localhost:3306/quan_user')

db.echo = False  # Try changing this to True and see what happens

metadata = BoundMetaData(db, quote=True)

users = Table('users', metadata,
    Column('user_id', Integer, primary_key=True),
    Column('name', String(40)),
    Column('age', Integer),
    Column('password', String),
)
users.create()

i = users.insert()
i.execute(name='Mary', age=30, password='secret')
i.execute({'name': 'John', 'age': 42},
          {'name': 'Susan', 'age': 57},
          {'name': 'Carl', 'age': 33})


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