On Sat, Jul 27, 2013 at 5:56 PM, Ivan Voras <ivoras@gmail.com> wrote:
-- Thanks, everyone!
While I'm here: is there a way to create additional db objects in the
syncdb phase? Specifically, I'd like to create some database VIEWs as
a means of avoding using raw queries in my code. Ideally, I would like
a way of specifying my own SQL which creates a Model's database object
(so I can do a CREATE VIEW instead of CREATE TABLE), or something like
that.
You have two options.
Firstly, you can use Django's ability to invoke raw SQL as part of the syncdb process:
Although the examples in that documentation describe using INSERT statements, you can issue any SQL statement you want.
Secondly, you could use South.
South is a migration framework for Django -- it allows you to manage changes in database schema, but you can also include creation of additional views, indexes, etc as part of that process.
Yours,
Russ Magee %-)
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to django-users+unsubscribe@googlegroups.com.
To post to this group, send email to django-users@googlegroups.com.
Visit this group at http://groups.google.com/group/django-users.
For more options, visit https://groups.google.com/groups/opt_out.
No comments:
Post a Comment