The Vertica Forum recently got a makeover! Let us know what you think by filling out this short, anonymous survey.
Please take this survey to help us learn more about how you use third party tools. Your input is greatly appreciated!
Append standard output using \o
Is there anyway to append output from the
\o
command such as: \o >> out.txtOr
\o | >> out.txt
0
Comments
I found the following piece of Vertica documentation that may help:
http://my.vertica.com/docs/7.0.x/HTML/index.htm#Authoring/ProgrammersGuide/vsql/CommandLineOptions/o...
Please let me if this was of any assistance!
Thanks,
Rory
Thanks for the update. I did some testing and it does appear that you can append to a file in the same database session, but you cannot append to the file after the database session is closed:
dbadmin=> \o test.txt
dbadmin=> select * from nodes;
dbadmin=> select * from system;
dbadmin=> \q
[dbadmin@rmckeon1 ~]$ cat test.txt
node_name | node_id | node_state | node_address | export_address | catalog_path | is_ephemeral
----------------------+-------------------+------------+--------------+----------------+--------------------------------------------------------------+--------------
v_testdb_node0001 | 45035996273704980 | UP | <IP Address> | <IP Address> | /home/dbadmin/testdb/v_testdb_node0001_catalog/Catalog | f
v_testdb_node0002 | 45035996273718962 | UP | <IP Address> | <IP Address> | /home/dbadmin/testdb/v_testdb_node0002_catalog/Catalog | f
v_testdb_node0003 | 45035996273718966 | UP | <IP Address> | <IP Address> | /home/dbadmin/testdb/v_testdb_node0003_catalog/Catalog | f
(3 rows)
current_epoch | ahm_epoch | last_good_epoch | refresh_epoch | designed_fault_tolerance | node_count | node_down_count | current_fault_tolerance | catalog_revision_number | wos_used_bytes | wos_row_count | ros_used_bytes | ros_row_count | total_used_bytes | total_row_count
---------------+-----------+-----------------+---------------+--------------------------+------------+-----------------+-------------------------+-------------------------+----------------+---------------+----------------+---------------+------------------+-----------------
139 | 138 | 138 | -1 | 1 | 3 | 0 | 1 | 479 | 0 | 0 | 7454 | 290 | 7454 | 290
(1 row)
Then, I logged out of the database, logged back in, and then ran:
dbadmin=> \o test.txt
dbadmin=> select * from resource_pools;
dbadmin=> \q
[dbadmin@rmckeon1 ~]$ cat test.txt
pool_id | name | is_internal | memorysize | maxmemorysize | executionparallelism | priority | runtimepriority | runtimeprioritythreshold | queuetimeout | plannedconcurrency | maxconcurrency | runtimecap | singleinitiator | cpuaffinityset | cpuaffinitymode
-------------------+----------+-------------+------------+---------------+----------------------+----------+-----------------+--------------------------+--------------+--------------------+----------------+------------+-----------------+----------------+-----------------
45035996273718864 | general | t | | Special: 95% | AUTO | 0 | MEDIUM | 2 | 300 | AUTO | | | f | | ANY
45035996273718866 | sysquery | t | 64M | | AUTO | 110 | HIGH | 0 | 300 | AUTO | | | f | | ANY
45035996273718868 | sysdata | t | 100M | 1G | | | | | | | | | | |
45035996273718870 | wosdata | t | 0% | 2G | | | | | | AUTO | | | | |
45035996273718872 | tm | t | 200M | | AUTO | 105 | MEDIUM | 60 | 300 | AUTO | 3 | | t | | ANY
45035996273718874 | refresh | t | 0% | | AUTO | -10 | MEDIUM | 60 | 300 | 4 | | | t | | ANY
45035996273718876 | recovery | t | 0% | | AUTO | 107 | MEDIUM | 60 | 300 | AUTO | 3 | | t | | ANY
45035996273718878 | dbd | t | 0% | | AUTO | 0 | MEDIUM | 0 | 0 | AUTO | | | t | | ANY
45035996273718960 | jvm | t | 0% | 10% | AUTO | 0 | MEDIUM | 2 | 300 | AUTO | | | f | | ANY
(9 rows)
I will create a feature request to potentially have this added to a future release of the product.
Thanks,
Rory
You're welcome. Take care!
Thanks,
Rory
Thanks Rory for following up on this limitation! Hope you don't mind if I jump in briefly:
Norbert (and anyone else reading this), the following should function as a workaround:
\o | cat >> out.txt
It's not the most elegant approach, but it should work fine.
Adam
Thanks,
Rory
For example:
twall@ubuntu:~$ vsql
Welcome to vsql, the Vertica Analytic Database interactive terminal.
Type: \h or \? for help with vsql commands
\g or terminate with semicolon to execute query
\q to quit
twall=> \o | cat >> file.txt
twall=> select 1;
twall=> select 2;
twall=> \q
twall@ubuntu:~$ vsql
Welcome to vsql, the Vertica Analytic Database interactive terminal.
Type: \h or \? for help with vsql commands
\g or terminate with semicolon to execute query
\q to quit
twall=> \o | cat >> file.txt
twall=> select 3;
twall=> \q
twall@ubuntu:~$ cat file.txt
?column?
----------
1
(1 row)
?column?
----------
2
(1 row)
?column?
----------
3
(1 row)