On 10/1/05, xtian <[EMAIL PROTECTED]> wrote:
>
> I've been playing around with my data model, making changes to the
> structure, dropping and recreating tables, and I've found it handy to
> be able to run an initial data script in the context of the model
> classes.
>
> Something like:
> turbogears-admin shell <filename to execute>
>
> I've implemented this in mine - just by changing the last part of
> command.Shell.run to be:
>
>         if len(sys.argv) == 2:
>             # execute the initial data file
>             datafile = sys.argv[1]
>             execfile(datafile, globals(), locals)
>         else:
>             import code
>             code.interact(local=locals)

I'd probably make it a new command like "exec" or "run" or something,
since it's not actually dropping you into the shell. Even better might
be an option for sql create to run this after creating the database.
(I assume you're using this to populate a fresh database while testing
things?)

Kevin

Reply via email to