import os
import sys#sys modul provide the some function and variable that provide python run time 
from sqlalchemy import Column ,ForeignKey ,Integer,String
from sqlalchemy.ext.declarative import declarative_base  #that  provide the table in class 
from sqlalchemy.orm import relationship
from sqlalchemy import create_engine

Base=declarative_base()#configration of class
#complete configration
class Restaurant(Base):
        __tablename__='restaurant'
        id =Column(Integer,primary_key=True)
        name=Column(String(250),nullable=False)

class MenuItem(Base):
        __tablename__='menu_item'

        name =Column(String(80),nullable=False)
        id=Column(Integer,primary_key=True)
        description=Column(String(250))
        price=Column(String(8))
        course=Column(String(250))
        restaurant_id=Column(Integer,ForeignKey('restaurant.id'))
        restaurant=relationship(Restaurant)
        @property
        def serialize(self):
                #Return objetdata in easily serializeable format
                return {
                        'name':self.name,
                        'description':self.description,
                        'id':self.id,
                        'price':self.price,
                        'course':self.course,
                        }

engine=create_engine('sqlite:///restaurantmenu.db')
#showin the for of tabular form in the database
Base.metadata.create_all(engine)
