search

Monday, February 20, 2017

Show raw SQL queries in PostgreSQL

If you want to inspest what queries exactly Django ORM sends to the PostgreSQL, you can do it with postgres logging. The first step is to enable logging. Add
log_statement = 'all' 
to the file:
sudo vim /etc/postgresql/9.4/main/postgresql.conf
Then you are able to see raw SQL queries with command:
sudo tail -f /var/log/postgresql/postgresql-9.4-main.log 

Monday, February 6, 2017

curl: Prettify json output

Intsall jq package:
sudo dnf install jq
Usage example:
curl -u key:x "https://api.com/users.json" | jq