سلام. چطور میشه تابع زیر رو کامل کرد؟
تابعی بنویسیم که یک لیستی از نامهای جداول رو بگیره و در دیتا بیس ذخیره کنه. بطوری که کلاسهای هر مدل رو این تابع خودش خودکار بسازه و از هر کلاس یک نمونه در اختیار ما برای کار با دیتابیس قرار بده.
import peewee
def table_creator(table_names):
instances = {}
for table_name in table_names:
#Create an instance of a class and add it to the instance variable and store it in mysql
if __name__ == "__main__":
tabel_names = ['table1', 'table2', 'table3']
models = table_creator(table_names)
for model in models :
model.create(value='data')