How to run a SQL file in Ruby
<p>I have multiple <code>.sql</code> files which might consists of multiple Alter table statements or view definitions or <code>plsql</code> function definitions. I want to apply complete <code>sql</code> file on PostgreSQL DB. It should be something similar like </p>

<pre><code>psql -h "HostName" -p "Port" -U "userName" -d "pwd" -f "Sql file location"
</code></pre>

<p>I have tried doing <code>PG.connect.execute</code> and that way I need to load the file and execute each statement separately. Is there a way I can execute entire <code>sql</code> file in Ruby?</p>