class Forest_park(model.Model): num = model.Column(model.Integer, primary_key=True) Province = model.Column(model.Text) manager = model.Column(model.Text) name = model.Column(model.Text) name_short = model.Column(model.Text) time = model.Column(model.String) area_ha = model.Column(model.String) county = model.Column(model.Text) bd_lon = model.Column(model.String) bd_lat = model.Column(model.String) lon = model.Column(model.String) lat = model.Column(model.String)
class Provice(model.Model): pid = model.Column(model.Integer,primary_key=True,autoincrement=True) name = model.Column(model.String(32)) cities = model.relationship('City',backref='Provice',lazy='dynamic')
class City(model.Model): cid = model.Column(model.Integer,primary_key=True,autoincrement=True) name = model.Column(model.String(32)) provice = model.Column(model.Integer,model.ForeignKey(Provice.pid)) villages = model.relationship('Village', backref='City', lazy='dynamic')
class Village(model.Model): vid = model.Column(model.Integer, primary_key=True, autoincrement=True) name = model.Column(model.String(32)) city = model.Column(model.Integer, model.ForeignKey(City.cid))
class Student(model.Model): id = model.Column(model.Integer, primary_key=True, autoincrement=True) s_name = model.Column(model.String(16))