Jan-14-2019, 08:18 PM
Hello,im pretty new at python,
but im about to start the developing of a web application, ,so i will be using flask and mysql with SQL alchemy
but the project has already a huge database, so as far as i have learned python i need to have my "models.py" file with the table structure like this
is there a tool, or a trick that i can use to autogenerate the code? i have been searching for that in the internet but didnt find anything like that
but im about to start the developing of a web application, ,so i will be using flask and mysql with SQL alchemy
but the project has already a huge database, so as far as i have learned python i need to have my "models.py" file with the table structure like this
from flask_blog import db
class Author(db.Model):
id = db.Column(db.Integer, primary_key=True)
fullname = db.Column(db.String(80))
email = db.Column(db.String(35), unique=True)
username = db.Column(db.String(80), unique=True)
password = db.Column(db.String(60))
is_author = db.Column(db.Boolean)
new = db.Column(db.Integer)
def __init__(self, fullname, email, username, password, is_author=False):
self.fullname = fullname
self.email = email
self.username = username
self.password = password
self.is_author = is_author
def __repr__(self):
return '<Author %r>' % self.usernamebut it will be very painfull and inefficient to write the code for each table,is there a tool, or a trick that i can use to autogenerate the code? i have been searching for that in the internet but didnt find anything like that
