<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>has_many :thoughts: Exporting data from SQLite</title>
    <link>http://blog.kineticweb.com/articles/2008/02/03/exporting-data-from-sqlite</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>Musings from a Ruby on Rails development team</description>
    <item>
      <title>Exporting data from SQLite</title>
      <description>&lt;p&gt;I recently discovered that sqlite3 has a number of output modes to spit out query results in different formats:&lt;/p&gt;


&lt;div class="typocode"&gt;&lt;pre&gt;&lt;code class="typocode_default "&gt;.mode MODE ?TABLE?   Set output mode where MODE is one of:

csv      Comma-separated values
column   Left-aligned columns.  (See .width)
html     HTML &amp;lt;table&amp;gt; code
insert   SQL insert statements for TABLE
line     One value per line
list     Values delimited by .separator string
tabs     Tab-separated values
tcl      TCL list elements&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;

	&lt;p&gt;By specifying &lt;code&gt;.mode insert&lt;/code&gt; one can get nicely formatted insert statements that can be imported right into MySQL. This is what I did to convert my Voicemail app to MySQL. However, if you don&amp;#8217;t specify a table name on the same line, the resulting insert statements just say &amp;#8220;insert into table&amp;#8221;. One must use &lt;code&gt;.mode insert voicemails&lt;/code&gt; to get insert statements out of sqlite3 that read &amp;#8220;insert into voicemails&amp;#8221;. A bit silly if you ask me&amp;#8230; one would think the table name in the insert statements would just default to the name of the table you were selecting from. But, this worked great for me and was all I needed to get converted.&lt;/p&gt;</description>
      <pubDate>Sun, 03 Feb 2008 09:50:00 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:39df7e5a-240c-43b9-94f8-2fc17746c8e8</guid>
      <author>Colin A. Bartlett</author>
      <link>http://blog.kineticweb.com/articles/2008/02/03/exporting-data-from-sqlite</link>
      <category>sqlite</category>
      <category>MySQL</category>
    </item>
  </channel>
</rss>
