I'm trying to allow null values in some columns of a MySQL database using peewee with bottle. Looking at the docs here I thought that would be quite easy. I set up a class like this:
class TestClass(MySQLModel):
Title = pw.CharField(null = True)
created the table and tried to insert a null value like this:
myDB.connect()
x = TestClass.create(Title = None)
x.save()
Only for it to hang up on me and say "_mysql_exceptions.OperationalError: (1048, "Column 'Title' cannot be null")
". Am I doing something wrong?
TestClass.create_table()
. Table is apparently created correctly, I don't show them in the question but I successfully inserted some none-null entries. – Ivetteivetts(NULL = True)
, rather than(null = True)
. Seems to work when I fix that. Thanks guys – Ivetteivetts