- by Az
When mapping an object using SQLAlchemy, is there a way to only map certain elements of a class to a database, or does it have to be a 1:1 mapping?
Example:
class User(object):
def __init__(self, name, username, password, year_of_birth):
self.name = name
self.username = username
self.password = password
self.year_of_birth = year_of_birth
Say, for whatever reason, I only wish to map the name, username and password to the database and leave out the year_of_birth. Is that possible and will this create problems?
Edit - 25/03/2010
Additionally, say I want to map username and year_of_birth to a separate database. Will this database and the one above still be connected (via username)?