Insert data into database even the field are not allowing null values
I am unclear what you are asking. Perhaps you have a mysql setting enabled that causes it to use default/empty values instead of raising an exception?

At any rate, this is not a peewee issue but a mysql question. Please take it to stackoverflow.
I have an issue with inserting data using peewee Model.create method.

after running the code below, the data will be inserted into the database with default values empty string for the **other field** and 0 for the **int_field**.

My question is how can I invoque an exception without inserting data into database.

import peewee as pw
from datetime import datetime

db = pw.MySQLDatabase('tests', user = 'root', password = 'root', host = 'localhost', port = 3306)


class Model(pw.Model):
    name = pw.CharField()
    created_at = pw.DateTimeField(default = datetime.now())
    other = pw.CharField(null = False)
    int_field = pw.IntegerField(null = False)

    class Meta:
        database = db
        db_table = 'nmodel'

Mode.create_table()
Model.create(name = "tests")
