I believe you need to add using_options(polymorphic=True) to appBase.

2008/5/24 Venkatesh <[EMAIL PROTECTED]>:
>
> Hello,
>
>  I am trying to create a base class for my application which inherits
> from Entity like this:
>
> class appBase(Entity):
>    def __str__(self):
>        outStr = ''
>        attrList = list(self.__dict__.keys())
>        attrList.sort()
>
>        for attrName in attrList:
>            outStr = outStr + attrName
>            value = getattr(self, attrName)
>
>            if value.__class__.__name__ == 'int':
>                outStr = outStr + '->' + str(value) + '\n'
>                attrName = Field(Integer)
>
>            if value.__class__.__name__ == 'str':
>                outStr = outStr + '->' + str(value) + '\n'
>                attrName = Field(String(100))
>
>        return outStr
>
>
> class User(appBase):
>    using_options(tablename='SqlUser')
>
>    credentials = OneToMany('Credential')
>
> The reason I want to do it is to create databases using the
> Introspection power of Python.
>
> I can see the object getting created in memory, but when I try to
> create the database using setup_all(True), I can only see that appBase
> table is getting created.
>
> Is it that to create a table, i **have** to inherit from Entity?
>
> Is it possible to create a table in the way that I have described?
>
> Please help.
> thanks,
> Venkatesh.
> >
>



-- 
Evolution: Taking care of those too stupid to take care of themselves.

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"SQLElixir" 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/sqlelixir?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to