I am running a bash script to extract data from a table via presto...
./presto --server myprestoserver:8889 --catalog mycatalog --schema myschema --execute "select * from TABLEResultsAuditLog;" > /mydirectory/audit.dat
This command will successfully and extract the table results and send them to the audit.dat
file. What I am looking for is to replace the
--execute "select * from TABLEResultsAuditLog;"
section and have a file located in /mydirectory/audit.sql
which would then contain the sql statement which I need executed. I have tried using
./presto --server myprestoserver:8889 --catalog mycatalog --schema myschema < /mydirectory/audit.sql > /mydirectory/audit.dat
where the audit.sql contains the select statement only, but this only populates the audit.dat file with the query statement and not the results. I'm not familiar with bash scripting, so its probably an easy fix for someone!!
Presto CLI has --file
option for this purpose:
presto-cli --server ... --file input.sql > output-file
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With