python - Enforce Not Null field in MariaDB using Peewee -
well, i'm trying use peewee small project. need fields text , url (both longtext in mariadb) not null , not null understand not allow null value stored in field, did this:
database = mysqldatabase("mydatabase", user="", password="123justkidding", host="localhost") class mytable(model): text = textfield(null = false) url = textfield(null = false, max_length = 100) class meta: database = database and then, of course, created table , started adding values, lots of values. thing there empty values on text , url fields don't want them be. ran query:
select `table`.`text`, `table`.`url` `table` `table`.`text`="" , `table`.`url`="" and gave me 4 rows. so, missing guys?
also, notice mariadb has text, medium text, longtext data-types , appears me textfield in peewee default longtext in mariadb. way can change that?
thanks in advance.
"" empty string. null different entirely.
Comments
Post a Comment