I use the following code to inserting data in DB:
db = dbConnection("localhost", "root", "")
class Products(peewee.Model):
article = peewee.TextField()
name = peewee.TextField()
price = peewee.TextField()
price_distributor = peewee.TextField()
price_discount = peewee.TextField()
class Meta:
database = db
Products.create_table()
book = Products(article="1", name="2", price="3", price_distributor="4", price_discount="5")
book.save()
And connection function:
def dbConnection(host, user, password):
return peewee.MySQLDatabase("test", host=host, port=3306, user=user, passwd=password)
How to set table name in which I insert data?