Hi everyone!
I need to declare a few unrelated classes (from a "business"
perspective) that share some attributes/fields, so I thought I could
use an abstract class to group these common attributes (note that just
a few classes should have them, not every one)

This post
http://groups.google.it/group/sqlalchemy/msg/d3de02f609a0bbd9?hl=it
suggests to use mixins, but I can't get it to work, SQLA generates the
tables without the common fields.

I'm testing it with this script:

>from sqlalchemy.ext.declarative import declarative_base
>from sqlalchemy import Column, Integer, String
>from sqlalchemy import create_engine
>
># --- Tables definition
>Base = declarative_base()
>
>class Abstract(object):
>    notes = Column(String)
>
>class Concrete(Base, Abstract):
>    __tablename__ = 'concrete'
>    id = Column(Integer, primary_key=True)
># ---
>
># DB creation
>engine = create_engine('sqlite:///:memory:', echo=True)
>Base.metadata.create_all(engine)

Here's the sql call:
>CREATE TABLE concrete (
>       id INTEGER NOT NULL,
>       PRIMARY KEY (id)
>)

What am I missing? Did I misunderstood how the mixin should be used?
(I'm using SQLA 0.5rc4)

Many thanks!
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to