On Saturday, March 1, 2014 11:07:52 AM UTC-8, Rob Miller wrote:
>
> Hi,
>
> I'm writing a ETL/reporting script at the moment, and I'm using Sequel 
> because it's great.
>
> One of the early steps of the reporting, though, involves loading a 
> gzipped database dump (made from our production server using mysqldump).
>
> I know that Database#run can handle being passed multiple queries, so my 
> first resort was to try:
>
> Zlib::GzipReader.open("dump.sql.gz") do |dump|
>   DB << dump.read
> end
>
>
Whether Database#run handles multiple queries depends on the underlying 
database/driver, and in any case is not supported even if it does work.  If 
this is mentioned as supported somewhere in the documentation, please let 
me know where so I can remove it.
 

>  But Sequel doesn't seem to like the stream-style comments that mysqldumpputs 
> at the top of the file — stuff like:
>
> /*!40101 SET @OLD_CHARACTER_SET_CLIENT=@@CHARACTER_SET_CLIENT */;
> /*!40101 SET @OLD_CHARACTER_SET_RESULTS=@@CHARACTER_SET_RESULTS */;
> /*!40101 SET @OLD_COLLATION_CONNECTION=@@COLLATION_CONNECTION */;
>
> Before I write a regex to strip them out, and potentially go down a rabbit 
> hole of further problems, I was wondering: am I going about this the right 
> way? Is there a way to read an SQL dump in Sequel that handles these 
> comments okay, or am I abusing Sequel in even trying?
>

You should use the mysql command line tools to load the dump. After it has 
been loaded, you can then use Sequel to manipulate the database.

Thanks,
Jeremy

-- 
You received this message because you are subscribed to the Google Groups 
"sequel-talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sequel-talk.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to