When SA autocode creates the models, it does so VIA table names.  This
means it will create models like:
TgUser and TgPermissions.  You will want to change these back to what
they are in the TG quickstart: User and Permissions.  The breakage
usually occurs in model/__init__.py because the import import's these
classes explicitly.  Furthermore, the authz will have issues unless
you override the class names.  I have not had a chance to create a --
tg option for squautocode, but I have toyed with the idea.  For now, a
little bit of massaging to get the tables where you need them is
necessary.  I also recommend copying over the methods from the User
class in the quickstart into your classes.

cheers.
-chris

On Jul 14, 9:37 pm, Enrico <[email protected]> wrote:
> Thanks Percious, that's saved me some hours of frustration. So I guess
> I'll go back to Declarative. I started writing it all out again and
> then I saw this wonderful new page of doco 
> at:http://turbogears.org/2.1/docs/main/Utilities/sqlautocode.html
>
> There is a section "Reflecting the Database Declaratively", so I think
> Ah, hah! I'm often deleting devdata.db and run the setup-app again
> when I change my model. So I easy_install sqlautocode. Then I will
> simply use:
>
> sqlautocode -d -o model.py sqlite:///devdata.db
>
> My devdata.db is created from Elixir with all the foreign keys and
> relations already defined. So brilliant, this is what I want but one
> problem spoils it.
>
> Now my setup-app only makes tables autogenerated by quickstart like
> tg_group, tg_permissions etc. My model is no longer getting tables
> "Successfully setup." I changed the name of the module which was not
> very descriptive and I think this broke a link somewhere maybe in
> model.__init__.py or websetup.py or app_cfg.py but I can't find where.

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

Reply via email to