Re: [sqlalchemy] Is there a way to create custom classes that inherit from sqlalchemy models in external library?

2016-07-22 Thread Mike Bayer
the first error is because declarative isn't smart enough to figure out this many __abstract__ flags, and I'd support efforts to improve this. But if you pass __abstract__ = False in a few places that gives it the clues it needs to get to the second case (as well as removing the __abstract__ =

Re: [sqlalchemy] Is there a way to create custom classes that inherit from sqlalchemy models in external library?

2016-07-21 Thread Angie Ellis
Adding __abstract__ = True to the AbstractCoupe did seem to resolve those errors, but it gave me a new one: from sqlalchemy import * from sqlalchemy.orm import * from sqlalchemy.ext.declarative import declarative_base from

Re: [sqlalchemy] Is there a way to create custom classes that inherit from sqlalchemy models in external library?

2016-06-27 Thread Mike Bayer
I think it's OK to add __abstract__ to those mixins, in this case it seems like the (pretty complicated) class graph is adding up to something that causes declarative to see AbstractCar as mapped class thus a "car" table is added. Adding __abstract__ to AbstractCoupe seems to resolve. On

Re: [sqlalchemy] Is there a way to create custom classes that inherit from sqlalchemy models in external library?

2016-06-27 Thread Angie Ellis
I implemented the changes you suggested, but I am running into errors with some polymorphic relations. Using a different theme, here is an example: class AbstractVehicle(object): __tablename__ = "vehicles" id = Column(Integer, primary_key=True) name = Column(String, nullable=False)

Re: [sqlalchemy] Is there a way to create custom classes that inherit from sqlalchemy models in external library?

2016-06-22 Thread Mike Bayer
On 06/22/2016 04:53 PM, Angie Ellis wrote: Mike, Thank you for the response! I do have control over the external library. I like your idea having both the abstract classes and concrete classes available in the library because I have use cases for both in my applications. However, I'm not

Re: [sqlalchemy] Is there a way to create custom classes that inherit from sqlalchemy models in external library?

2016-06-22 Thread Angie Ellis
Mike, Thank you for the response! I do have control over the external library. I like your idea having both the abstract classes and concrete classes available in the library because I have use cases for both in my applications. However, I'm not quite sure how to configure the inheritance and

Re: [sqlalchemy] Is there a way to create custom classes that inherit from sqlalchemy models in external library?

2016-06-03 Thread Mike Bayer
On 06/03/2016 02:44 PM, Angie E wrote: Rather than creating mixin classes that models inherit from, I have a use case that requires me to configure classes the other way around. The classes that would normally be mixin classes need to be the classes that inherit from the models as well as the

[sqlalchemy] Is there a way to create custom classes that inherit from sqlalchemy models in external library?

2016-06-03 Thread Angie E
Rather than creating mixin classes that models inherit from, I have a use case that requires me to configure classes the other way around. The classes that would normally be mixin classes need to be the classes that inherit from the models as well as the class that model objects are created