<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: Kevin Ard</title>
    <description>The latest articles on DEV Community by Kevin Ard (@therealkevinard).</description>
    <link>https://dev.to/therealkevinard</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F112933%2Fdfc41762-e5dd-490c-bf39-a1a58a8d524f.jpeg</url>
      <title>DEV Community: Kevin Ard</title>
      <link>https://dev.to/therealkevinard</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/therealkevinard"/>
    <language>en</language>
    <item>
      <title>Today I learned: Why there aren't many tools for SQLing a csv</title>
      <dc:creator>Kevin Ard</dc:creator>
      <pubDate>Mon, 20 May 2019 14:41:56 +0000</pubDate>
      <link>https://dev.to/therealkevinard/today-i-learned-why-there-aren-t-many-tools-for-sql-ing-a-csv-37b</link>
      <guid>https://dev.to/therealkevinard/today-i-learned-why-there-aren-t-many-tools-for-sql-ing-a-csv-37b</guid>
      <description>&lt;p&gt;I wear a lot of hats, and I up using CSVs pretty frequently because it's such a common layperson data exchange format. I know a bit of SQL, and I've caught myself wondering a thousand times why there aren't many tools for running SQL against a spreadsheet. &lt;/p&gt;

&lt;p&gt;I was doing a little sysadmin today and caught myself wondering the same thing again. This time, though... I took a minute to wrap my head around it. &lt;/p&gt;

&lt;p&gt;And now I know: &lt;strong&gt;Sqlite&lt;/strong&gt;&lt;/p&gt;

&lt;p&gt;What I found was how dead. stinking. simple it is to translate a csv directly to a sqlite database. From there, I could go to town on it. &lt;/p&gt;

&lt;ol&gt;
&lt;li&gt;&lt;p&gt;Find a csv and tidy-up if needed. &lt;em&gt;(caveat: all your columns need a header - makes sense for a database, though, right?)&lt;/em&gt;&lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Start sqlite: &lt;code&gt;sqlite3 some_db_file.db&lt;/code&gt; &lt;/p&gt;&lt;/li&gt;
&lt;li&gt;&lt;p&gt;Import the csv into a clean database&lt;br&gt;
&lt;/p&gt;&lt;/li&gt;
&lt;/ol&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;   .mode csv
   .import my_csv_file.csv some_db_name
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;&lt;strong&gt;Done!&lt;/strong&gt; Sqlite automagically shuffled your spreadsheet into a new database. Run SQL against it, build a CLI app that consumes it, whatever - have fun! &lt;/p&gt;

</description>
      <category>sql</category>
      <category>sqlite</category>
      <category>productivity</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
