How can I run a SQL query from a file? I have a module that will be used as a location finder, and it needs to create a table on install that will hold zip codes and their location. That's easy to do. However, I also need to populate that table. Seeing as it's quite a large dataset, and I already have it in a .sql file, I would like to be able to run that file instead of embed the query into the module_install function.

I looked over the documentation for db_query(), but I don't see a way to run a file.

Is this doable, or do I need to pull the database username and password out and run it manually?
You can use drush sql-connect for this, so you don't need to enter any credentials and/or use mysql's command line:

`drush sql-connect` &lt; my-sql-file.sql


The tildes tell your shell to replace the command drush sql-connect with the command's output. Therefore, when you run this line in your terminal, bash will actually see something like: 

mysql --database=dbname --host=localhost --user=username --password=password &lt; my-sql-file.sql


Check out Drush's documentation for much, much more.