I have a domain that defines two objects: Property and Address. They have a one-to-one relationship where every Property has an Address.
I would like to have a single table that holds the Property and Address data in order to avoid a unnecessary join when queries Properties:
create table properties
(
id integer primary key,
name varchar(50) not null,
address_city varchar(50) not null
)
And have the bellow classes definitions:
class Property(object):
def __init__(self, id, name, address):
self.id = id
self.name = name
self.address = address
class Address(object):
def __init__(self, city):
self.city = city
How can I configure the SQLAlchemy mappers to support this kind of structure? (I saw inheritance configurations but it doesn't fit my case)