I tried the tutorial for version 0.4.8 but the example doesnt work for me. So I simplified the code the code a little bit but with session.commit I get always an exception, because sqlalchemy tries to insert a none into user_name and nothing into the primary key. Could someone help me?
#========== lfrom sqlalchemy import * from sqlalchemy.orm import * engine = create_engine('sqlite:///:memory:', echo=True) metadata = MetaData() users_table = Table('users', metadata, Column('user_id', String(4), primary_key = True), Column('user_name', String(16), nullable = False), ) metadata.create_all(engine) class User(object): def __init__(self, id, name): self.id = id self.name = name def __repr__(self): return "<User('%4s','%16s')>" % (self.id, self.name) m= mapper(User, users_table) Session = sessionmaker(bind=engine, autoflush=True, transactional=True) session= Session() print User(id='ed',name='Ede Myers') session.save(User(id='ed', name='Ede Myers')) session.commit() session.close() --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to sqlalchemy@googlegroups.com To unsubscribe from this group, send email to sqlalchemy+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en -~----------~----~----~----~------~----~------~--~---