csvkit
csvkit copied to clipboard
sql2csv: Support for bind parameters
It would be great to be able to pass in bind parameters for parameterized queries when using sql2csv. Something along the lines of:
query.sql
select * from phone_book where last_name=:p_last_name;
Script:
sql2csv query.sql -b "p_last_name='Jones'" --db <connection string>
It seems like it can be done that way, it worked for me:
CATEGORIES=(table1 table2 table3)
for i in "${CATEGORIES[@]}"
do
:
sql2csv --db <connection string> --query "SELECT * FROM v_${i}" > csv/$i
done
Not exactly the same process but maybe it'll help someone else.