Dear neighbours!

Report a typo

Imagine that you have decided to create a table to collect the information about your neighbours: their name, surname, age, and flat number. You opted for classical mapping. Take a look at the code below, and complete it by replacing *** with the correct line.

from sqlalchemy import Table, MetaData, Column, Integer, String
from sqlalchemy.orm import mapper

metadata = MetaData()

neighbours = Table('neighbours', metadata,
            Column('id', Integer, primary_key=True),
            Column('name', String(40)),
            Column('surname', String(40)),
            Column('flat', Integer),
            Column('age', Integer))

class Neighbours(object):
    def __init__(self, name, surname, flat, age):
        self.name = name
        self.surname = surname
        ***
        self.age = age

mapper(Neighbours, neighbours)
Enter a short text
___

Create a free account to access the full topic