Question 28
Consider the below model definitions, and answer the given subquestions.
Consider the following model classes “Movies” and “Producers” corresponding to tables “movies” and “producers”, respectively, in the SQLite database.
class Movies(db.Model): id = db.Column(db.Integer(), primary_key = True) movie_name = db.Column(db.String(50), nullable = False, unique = True) movie_year = db.Column(db.Integer, nullable = False) producers = db.relationship('Producer', backref = 'movie', secondary = 'groups')
class Producer(db.Model): id = db.Column(db.Integer(), primary_key = True) producer_name = db.Column(db.String(50), nullable = False, unique = True) productions = db.Column(db.Integer())
class Groups(db.Model): movie_id = db.Column(db.Integer(),db.ForeignKey('movies.id'), primary_key = True) prod_id = db.Column(db.Integer(),db.ForeignKey('producer.id'), primary_key = True)The tables “movies” and “producers” are related to each other by which of the following relationships
One-to-one
One-to-many
Many-to-Many
Many-to-One