Vidyalelo
Python · Q15

Database Connectivity with Python

Programming · Python · question 15

Q15

How do you define a class that maps to a database table using SQLAlchemy?

A.
By subclassing the Database class
B.
By using the @database_table decorator
C.
By inheriting from the Base class and defining attributes
Answer
D.
By using the map_table() function

Answer: Option C

Solution

Answer: Option C
Solution:
In SQLAlchemy, you inherit from the Base class and define attributes to map a class to a database table.