Ugh. Then I just don't get the point - the only reason to use inheritance is to avoid defining all the fields twice (and I have a bunch of methods - but still).
I might as well stick with the class decorators approach (which is working really well for me). On Jan 25, 2010, at 1:10 PM, Michael Bayer wrote: > Todd Blanchard wrote: >> I upgraded from 0.5.6 to 0.5.8 but it is still the same. >> >> The fields from MakerGraphic do not appear in the event_types table.:-/ > > This is a common misunderstanding when using concrete. You need to > define each column specifically for each concrete table since each class > represents an entirely different table. See the example at > http://www.sqlalchemy.org/docs/reference/ext/declarative.html#concrete-table-inheritance > . > >> >> On Jan 25, 2010, at 9:43 AM, Michael Bayer wrote: >> >>> Todd Blanchard wrote: >>>> I have >>>> >>>> MarkerGraphic.__table__.create() >>>> EventType.__table__.create() >>>> >>>> In the upgrade portion of my script >>> >>> SQL for CREATE TABLE will be emitted unconditionally at the point at >>> which >>> create() is called - which implies that part of the script isn't being >>> called for whatever reason, or perhaps you have some engine/URL >>> confusion >>> going on. >>> >>> I'd also ditch all the session stuff that isn't necessary for migrate. >>> >>> Also make sure you're on 0.5.8 or 0.6 trunk to eliminate the possibility >>> of any bugs in very old versions of 0.5 (and don't even consider 0.4). >>> >>> >>> >>>> >>>> Sent from my iPhone >>>> >>>> On Jan 25, 2010, at 8:14, Michael Bayer <[email protected]> >>>> wrote: >>>> >>>>> Todd Blanchard wrote: >>>>>> I have this definition in my upgrade script using migrate >>>>>> >>>>>> meta = MetaData(migrate_engine) >>>>>> DeclarativeBase = declarative_base(metadata=meta) >>>>>> maker = sessionmaker(autoflush=True, autocommit=False, >>>>>> extension=ZopeTransactionExtension()) >>>>>> DBSession = scoped_session(maker) >>>>>> DBSession.configure(bind=migrate_engine) >>>>>> >>>>>> class MarkerGraphic(DeclarativeBase): >>>>>> __tablename__ = 'marker_graphics' >>>>>> id = Column(Integer, primary_key=True) >>>>>> base_url = Column(Unicode,default="http://chart.apis.google.com/ >>>>>> chart") >>>>>> >>>>>> class EventType(MarkerGraphic): >>>>>> __tablename__ = 'event_types' >>>>>> __mapper_args__ = {'concrete':True} >>>>>> >>>>>> id = Column(Integer, primary_key=True) >>>>>> name = Column(Unicode(60), nullable=False, unique=True) >>>>>> >>>>>> def __unicode__(self): >>>>>> return self.name >>>>>> >>>>>> and when doing an upgrade, only the EventType columns are created in >>>>>> the db (postgresql). >>>>>> >>>>>> Is concrete not compatible with declarative? >>>>> >>>>> Concrete is entirely compatible with declarative. I don't see where >>>>> you're issuing metadata.create_all() above, yet you say its creating >>>>> one >>>>> of the tables, so the above is not a full script. >>>>> >>>>> >>>>> >>>>> >>>>>> >>>>>> -- >>>>>> You received this message because you are subscribed to the Google >>>>>> Groups >>>>>> "sqlalchemy" group. >>>>>> To post to this group, send email to [email protected]. >>>>>> To unsubscribe from this group, send email to >>>>>> [email protected]. >>>>>> For more options, visit this group at >>>>>> http://groups.google.com/group/sqlalchemy?hl=en. >>>>>> >>>>>> >>>>> >>>>> -- >>>>> You received this message because you are subscribed to the Google >>>>> Groups "sqlalchemy" group. >>>>> To post to this group, send email to [email protected]. >>>>> To unsubscribe from this group, send email to >>>>> [email protected] >>>>> . >>>>> For more options, visit this group at >>>>> http://groups.google.com/group/sqlalchemy?hl=en >>>>> . >>>>> >>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups >>>> "sqlalchemy" group. >>>> To post to this group, send email to [email protected]. >>>> To unsubscribe from this group, send email to >>>> [email protected]. >>>> For more options, visit this group at >>>> http://groups.google.com/group/sqlalchemy?hl=en. >>>> >>>> >>> >>> -- >>> You received this message because you are subscribed to the Google >>> Groups "sqlalchemy" group. >>> To post to this group, send email to [email protected]. >>> To unsubscribe from this group, send email to >>> [email protected]. >>> For more options, visit this group at >>> http://groups.google.com/group/sqlalchemy?hl=en. >>> >> >> -- >> You received this message because you are subscribed to the Google Groups >> "sqlalchemy" group. >> To post to this group, send email to [email protected]. >> To unsubscribe from this group, send email to >> [email protected]. >> For more options, visit this group at >> http://groups.google.com/group/sqlalchemy?hl=en. >> >> > > -- > You received this message because you are subscribed to the Google Groups > "sqlalchemy" group. > To post to this group, send email to [email protected]. > To unsubscribe from this group, send email to > [email protected]. > For more options, visit this group at > http://groups.google.com/group/sqlalchemy?hl=en. > -- You received this message because you are subscribed to the Google Groups "sqlalchemy" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/sqlalchemy?hl=en.
