Thursday, December 4, 2014

Re: Postgresql Triggers and Django

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iQIcBAEBCAAGBQJUgNiJAAoJEC0ft5FqUuEhlu4QAImmPI3TZz/2B1w5AzbjtuSb
WFupO/XIvwHuJBUQqV5OsnAeA0GK4Xqf8RBMzUJgkrdLh8vgHH3pb8EdtjnUvBIv
itO4EgBjoHBTvFGH2hqxXGqdQiGmzKnGOpcaOkPAN1sFOpc+7pacheMbz47LMY0R
aCf4knK6OWa78YtiTBt6jDq27QSQJVyg9py7zDaXF1VQKfM6g3XAFMgJ4ojJmJRH
a6F524EurBbH5r16kosMsYzoNsEdMXYZJPpRSP3zBH93orMluzZJt2XpsDkJ2i4F
UrgfiS2G6YgOAk8lwlB9brBg24Tj5x01xBiXSxNjQ7qbfMr9E4fhuNbV4aIzSJs/
6JQ6TAYDKWj+VgxkiuJvKyNoqXPuFJvipVSbl3IYF9ehUdEHjIhI8xZk+4GFamGa
0Am98m2urV9DPBmXSgX0uFqqv84mTD0dNnImoTm+Nk/8hXOW8YC88+kWoee9A7ZG
Edks5zcCHPv+0vpl4ao0vBDwKzoTEv7beJ2S2kMwXIWCaOWzPl82g+wJ8PF7MrY/
X3qQ9uT1IsR3/p5b+2FbjubziVx/oCzoMCTzr5FIshPX3K5mCS7x6cx3Rc0qO6mg
9orVpFDLQs6j5RzgZtbiEqsYldqpbOn/oDzUB0d2/OwOZ2HbErE7GpHRtKF3IecZ
T4TDJdj0OYqrdUhtwx/l
=SpLl
-----END PGP SIGNATURE-----
Hi Philip,

On 12/04/2014 02:28 PM, Philip Haynes wrote:
> Hi,
> I have tracked back through the messages in this group and examined the
> documentation for version 1.7 of Django and I have a question.
>
> The 1.7 documentation (https://docs.djangoproject.com/en/1.7/howto/initial-data/)
> describes the "Providing initial SQL data" functionality as deprecated. Is
> that referring to using this hook for any SQL processing or just for the
> loading of initial data? From the phrasing in the documentation it is not
> clear to me if the entire hook for loading SQL code after the CREATE TABLE
> statement is deprecated or whether it is just deprecated for initial data.
> The deprecation comment refers to using Migrations to achieve the purpose,
> I can do that, its just a bit more inconvenient than loading my sql
> directly.
>
> FWIW, my goal is to insert triggers into a few places in the database. I
> would prefer triggers because I have non-Django processes that can interact
> with the database and it is most robust for me to have the RDBMS itself
> perform the work.
>
> Anybody have a definitive understanding of the deprecation of the hook for
> loading app/<model_name>.sql ?

The entire mechanism is deprecated in favor of using a migration with a
RunSQL operation. Already in 1.7, for any app using migrations, initial
SQL files will be ignored.

In a world in which database tables are constructed entirely via
migrations (which is already the case for any app with migrations, and
will be the case for all apps in Django 1.9), the initial-SQL feature
just doesn't make sense: it duplicates the RunSQL operation, and it is
unclear when in the chain of migrations it would be expected to run.

Carl

--
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.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/5480D885.8090908%40oddbird.net.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment