This is an internal documentation. There is a good chance you’re looking for something else. See Disclaimer.

Scripts (Postgres)

n2sql-on-all-dbs

Name of Scripts : n2sql-on-all-dbs
Location: installed on all DB servers (via Ansible)
Description : Execute SQL across multiple databases

Examples:

  • execute given SQL on all Nice databases:

    n2sql-on-all-dbs 'SELECT count(*) from _nice_binary'
    
  • execute sql in file query.sql on all Nice databases``:

    n2sql-on-all-dbs -f query.sql
    

You can limit on what database it is executed via -d REGEX:

  • execute on all test systems (name ends with test) -d '.*test$'

  • execute on all but test systems (name doesn’t end with test) -D '.*test$'

Hint

Use n2sql-on-all-dbs --help for all available options and more examples.