Add export script for autoindex-enabled SQL queries