Looking at the output of select * from pg_stat_activity;
, I see a column called application_name
, described here.
I see psql sets this value correctly (to psql
...), but my application code (psycopg2/SQLAlchemy) leaves it blank.
I'd like to set this to something useful, like web.1
, web.2
, etc, so I could later on correlate what I see in pg_stat_activity
with what I see in my application logs.
I couldn't find how to set this field using SQLAlchemy (and if push comes to shove - even with raw sql; I'm using PostgresSQL 9.1.7 on Heroku, if that matters).
Am I missing something obvious?
invalid connection option "application_name"
). Same SA version, same psycopg2 version, probably different libpq etc. Butpsql application_name=foo_bar
works fine, both locally and against Heroku. Any tips on that? – Opuntia