python - Accessing remote MySQL database with peewee -
i'm trying connect mysql database on amazon's rds using peewee , can't work. i'm new databases i'm doing stupid, i'm trying:
import peewee pw mydb = pw.mysqldatabase(host="mydb.crhauek3cxfw.us-west-2.rds.amazonaws.com",port=3306,user="user",passwd="password",db="mydb") class mysqlmodel(model): """a base model use our mysql database""" class meta: database = mydb class user(mysqlmodel): username = charfield() mydb.connect()
it hangs on second line, saying __init__() takes @ least 2 arguments (1 given)
what missing? why saying i'm giving 1 argument when i'm giving five?
thanks lot, alex
i changed , worked:
import peewee pw mydb = pw.mysqldatabase("mydb", host="mydb.crhauek3cxfw.us-west-2.rds.amazonaws.com", port=3306, user="user", passwd="password") class mysqlmodel(pw.model): """a base model use our mysql database""" class meta: database = mydb class user(mysqlmodel): username = pw.charfield() # etc, etc # when you're ready start querying, remember connect mydb.connect()
thanks guys, alex
Comments
Post a Comment