Hi,

Be aware I will never speak about Django application as often used in 
Django developpement, here the string **application_name** is not the name 
of a Django'app.
PostgreSQL permits on connection to specify a string that represent the 
name of application that connect, useful to identify human tools like *psql* 
or automated tools like *slony*, this optionnal parameter is called 
*application_name*. This is very useful to debugging purpose, postgresql 
prints this information in logs or internal view liek pg_stat_activity, for 
example

gatling=# select * from pg_stat_activity  limit 1 ;
-[ RECORD 1 ]----+------------------------------
datid            | 318636
datname          | lolyx
pid              | 8436
usesysid         | 16384
usename          | rodo
application_name | slon.local_listen
client_addr      | ::1
client_hostname  | 
client_port      | 42918
backend_start    | 2015-06-16 20:31:50.177957+02
xact_start       | 
query_start      | 2015-06-22 16:25:57.494463+02
state_change     | 2015-06-22 16:25:57.494564+02
waiting          | f
state            | idle
backend_xid      | 
backend_xmin     | 
query            | rollback transaction;

Ref : 
http://www.postgresql.org/docs/current/static/runtime-config-logging.html#GUC-APPLICATION-NAME
 http://www.postgresql.org/docs/9.4/static/libpq-connect.html#LIBPQ-CONNSTRING


The welll known python driver for postgresql *psycopg2* permots to use this 
functionnnality by using kwargs when openning connection as :

conn = connect(database='foo', port='5435',
               host='127.0.0.1', user='rodo',password='rodo',
               application_name='foobar')
le code ici

Ref : http://initd.org/psycopg/docs/module.html

But, actually Django doesn't permit to use this option, before proposing a 
patch to implement this in future version of Django I would like to receive 
your comments and idea about this feature.
My first idea is to add an optionnal entry in settings.DATABASE as is :

DATABASES 
 
This new key in DATABASE dict will not use by all backends, not only 
PostgreSQL has this functionnality, AFAIK SQL Server permits this too.

I'll read your comments with interest, this will be my first patch to 
Django and I'll be happy to discuss things like what is an acceptable name 
for this new entry ?
And of course I'll read the Contritbuting to Django before make my PR.

Is this feature is accepted, the next step will be to automatically set 
this settiings when using the **shell**, **dbshell** or **shell_plus** 
command to help identify human action on production systems !

Regards,

-- 
You received this message because you are subscribed to the Google Groups 
"Django developers  (Contributions to Django itself)" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/django-developers.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/django-developers/97cb7ff5-0b4d-4c33-9545-1a8577678ccd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to