Make a Cow Display Query Results in VSQL

Jim_KnicelyJim_Knicely - Select Field - Administrator
edited August 2019 in Tips from the Team

I used to have fun with the amusing old Linux command Cowsay. It inserts any input into a word bubble and draws an ASCII cow to talk to you.

You can make the cow display your query results in VSQL!

Example:

dbadmin=> \! rpm -qa | grep cowsay
cowsay-3.04-4.el7.noarch

dbadmin=> \! cowsay I love VERTICA!
_________________
< I love VERTICA! >
-----------------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

dbadmin=> CREATE TABLE some_data (c VARCHAR(10));
CREATE TABLE

dbadmin=> INSERT INTO some_data SELECT 'A';
OUTPUT
--------
1
(1 row)

dbadmin=> INSERT INTO some_data SELECT 'B';
OUTPUT
--------
1
(1 row)

dbadmin=> INSERT INTO some_data SELECT 'C';
OUTPUT
--------
1
(1 row)

dbadmin=> INSERT INTO some_data SELECT 'D';
OUTPUT
--------
      1
(1 row)

dbadmin=> COMMIT;
COMMIT

dbadmin=> \! vsql -Atc "SELECT c FROM some_data ORDER BY c;" | cowsay
_________
< A B C D >
---------
        \   ^__^
         \  (oo)\_______
            (__)\       )\/\
                ||----w |
                ||     ||

Helpful Links:
https://en.wikipedia.org/wiki/Cowsay
https://www.vertica.com/docs/9.2.x/HTML/Content/Authoring/ConnectingToVertica/vsql/Meta-Commands/MetaCommandReference.htm

Have fun!

Sign In or Register to comment.