<?xml version="1.0" encoding="UTF-8"?><rss xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:atom="http://www.w3.org/2005/Atom" version="2.0" xmlns:cc="http://cyber.law.harvard.edu/rss/creativeCommonsRssModule.html">
    <channel>
        <title><![CDATA[Stories by Griff Bohannon on Medium]]></title>
        <description><![CDATA[Stories by Griff Bohannon on Medium]]></description>
        <link>https://medium.com/@gmbohannon?source=rss-493535e80d9d------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/0*MBIazxoiOytrv9Wo</url>
            <title>Stories by Griff Bohannon on Medium</title>
            <link>https://medium.com/@gmbohannon?source=rss-493535e80d9d------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 29 Nov 2026 15:11:33 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@gmbohannon/feed" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[How I Built a CSV to SQL Converter That Actually Validates Your Data (And Why It Matters)]]></title>
            <link>https://medium.com/@gmbohannon/how-i-built-a-csv-to-sql-converter-that-actually-validates-your-data-and-why-it-matters-f3b0b98b0564?source=rss-493535e80d9d------2</link>
            <guid isPermaLink="false">https://medium.com/p/f3b0b98b0564</guid>
            <category><![CDATA[saas]]></category>
            <category><![CDATA[sql]]></category>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[data-analysis]]></category>
            <category><![CDATA[csv]]></category>
            <dc:creator><![CDATA[Griff Bohannon]]></dc:creator>
            <pubDate>Sun, 25 Jan 2026 22:43:49 GMT</pubDate>
            <atom:updated>2026-01-25T22:43:49.460Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Z3Jbmz8cueUuS03DMzbpVw.png" /></figure><p><em>Spending 3 hours debugging a corrupted database import taught me that validation should happen BEFORE import, not after.</em></p><h3>Why I Built This</h3><p>I was migrating a customer database from CSV to PostgreSQL when I hit a familiar problem: ZIP codes like 07001 and 02134 were being stripped to 7001 and 2134. The automated type detection had decided they were integers.</p><p>I caught it during testing, but it made me think about how often this doesn’t get caught — especially on smaller teams or rushed migrations. A colleague once told me about a similar issue that made it to production and corrupted thousands of address records before anyone noticed.</p><p>The real problem isn’t the leading zeros. It’s that CSV-to-SQL conversion requires judgment calls that generic tools can’t make reliably. Is a column of numbers actually numeric data, or are they identifiers that happen to be digits? Should those date-like strings become DATE types or stay as text?</p><p>After fixing the same types of issues across multiple projects, I built a tool that makes these decisions transparent and adjustable.</p><h3>The Problem with CSV Imports</h3><p>CSV files are everywhere. Sales exports, customer data, analytics reports, inventory lists. Converting them to SQL is a minefield:</p><p><strong>Common disasters I’ve seen:</strong></p><ul><li>ZIP codes losing leading zeros (detected as integers)</li><li>Dates like “2024–13–45” crashing imports</li><li>Product IDs like “SKU001” becoming math expressions</li><li>Phone numbers losing their formatting</li><li>Mixed data types corrupting entire columns</li></ul><p><strong>The worst part?</strong> Most CSV-to-SQL converters just dump everything as VARCHAR or blindly guess types without validation.</p><p>You only discover the problem after importing to production.</p><h3>Building a Better Solution</h3><p>I spent a weekend building a tool that solves this. Not just another CSV converter — one that actually validates your data before generating SQL.</p><p><strong>The core idea:</strong> Show users what will break BEFORE they import.</p><p>Here’s what I built: <a href="https://csv-to-sql-converter-tau.vercel.app/">CSV to SQL Converter</a></p><h3>Technical Decisions</h3><h3>1. Server-Side Processing (Node.js + Express)</h3><p>I could have done everything client-side with JavaScript, but server-side gives me:</p><ul><li>Better CSV parsing</li><li>File handling without browser limitations</li><li>Consistent results across devices</li><li>Room to add features later (database connections, etc.)</li></ul><pre>const express = require(&#39;express&#39;);<br>const multer = require(&#39;multer&#39;);<br>const Papa = require(&#39;papaparse&#39;);</pre><pre>const app = express();<br>const upload = multer({ dest: &#39;/tmp/&#39; });</pre><pre>app.post(&#39;/preview&#39;, upload.single(&#39;csvFile&#39;), (req, res) =&gt; {<br>  const csvData = fs.readFileSync(req.file.path, &#39;utf8&#39;);<br>  const parsed = Papa.parse(csvData, {<br>    header: true,<br>    skipEmptyLines: true,<br>    dynamicTyping: false // Keep as strings for type detection<br>  });<br>  <br>  // Analyze and validate...<br>});</pre><h3>2. Smart Type Detection</h3><p>Instead of just guessing, the tool analyzes actual data:</p><pre>function detectDataType(values) {<br>  const validValues = values.filter(v =&gt; v !== null &amp;&amp; v !== &#39;&#39;);<br>  <br>  let allIntegers = true;<br>  let allDecimals = true;<br>  let allDates = true;<br>  <br>  for (const value of validValues) {<br>    const str = String(value).trim();<br>    <br>    if (!/^-?\d+$/.test(str)) allIntegers = false;<br>    if (!/^-?\d*\.?\d+$/.test(str)) allDecimals = false;<br>    if (isNaN(Date.parse(str))) allDates = false;<br>  }<br>  <br>  if (allIntegers) return &#39;INTEGER&#39;;<br>  if (allDecimals) return &#39;DECIMAL(10,2)&#39;;<br>  if (allDates) return &#39;DATE&#39;;<br>  <br>  return &#39;VARCHAR(255)&#39;; // Safe default<br>}</pre><p><strong>But here’s the key:</strong> Even after auto-detection, users can override any type. The tool shows sample data so they can make informed decisions.</p><h3>3. Database-Specific SQL</h3><p>Different databases use different SQL syntax. PostgreSQL uses NUMERIC, MySQL uses DECIMAL, SQLite uses TEXT for dates.</p><pre>function convertToDialect(genericType, dialect) {<br>  const typeMap = {<br>    postgresql: {<br>      &#39;INTEGER&#39;: &#39;INTEGER&#39;,<br>      &#39;DECIMAL(10,2)&#39;: &#39;NUMERIC(10,2)&#39;,<br>      &#39;DATE&#39;: &#39;DATE&#39;,<br>      &#39;VARCHAR&#39;: &#39;VARCHAR&#39;<br>    },<br>    mysql: {<br>      &#39;INTEGER&#39;: &#39;INT&#39;,<br>      &#39;DECIMAL(10,2)&#39;: &#39;DECIMAL(10,2)&#39;,<br>      &#39;DATE&#39;: &#39;DATE&#39;,<br>      &#39;VARCHAR&#39;: &#39;VARCHAR&#39;<br>    },<br>    // ... <br>  };<br>  <br>  return typeMap[dialect][genericType];<br>}</pre><p>This ensures the generated SQL is optimized for your specific database.</p><h3>4. Seven Validation Checks</h3><p>This is what makes it different. Before generating SQL, it runs:</p><ol><li><strong>Column Consistency</strong> — Are all rows using the same columns?</li><li><strong>Duplicate Detection</strong> — Which columns have duplicate values?</li><li><strong>NULL Analysis</strong> — What percentage of each column is empty?</li><li><strong>Date Format Validation</strong> — Are there invalid dates like “2024–13–45”?</li><li><strong>Mixed Type Detection</strong> — Is a column trying to be both numbers and text?</li><li><strong>Length Analysis</strong> — Are any values unusually long?</li><li><strong>Placeholder Detection</strong> — Did someone write “N/A” or “TBD” instead of leaving it empty?</li></ol><p><strong>Example validation result:</strong></p><pre>⚠️ WARNINGS:<br>- Column &quot;zip_code&quot; detected as INTEGER<br>  (Will lose leading zeros: 07001 → 7001)<br>  <br>❌ ERRORS:<br>- Column &quot;hire_date&quot; has 2 invalid dates<br>  Examples: &quot;2024-13-45&quot;, &quot;not-a-date&quot;</pre><p>Users see this BEFORE generating SQL. They can fix the CSV or override the types.</p><h3>Deployment: Vercel Serverless</h3><p>Initially, I tried deploying a traditional Express server on Vercel. <strong>It didn’t work.</strong></p><p>Vercel needs serverless functions, not long-running servers. The fix:</p><pre>// Export the Express app for Vercel<br>module.exports = app;</pre><p>And a vercel.json config:</p><pre>{<br>  &quot;version&quot;: 2,<br>  &quot;builds&quot;: [<br>    { &quot;src&quot;: &quot;index.js&quot;, &quot;use&quot;: &quot;@vercel/node&quot; }<br>  ],<br>  &quot;routes&quot;: [<br>    { &quot;src&quot;: &quot;/preview&quot;, &quot;dest&quot;: &quot;/index.js&quot; },<br>    { &quot;src&quot;: &quot;/convert&quot;, &quot;dest&quot;: &quot;/index.js&quot; },<br>    { &quot;src&quot;: &quot;/(.*)&quot;, &quot;dest&quot;: &quot;/public/$1&quot; }<br>  ]<br>}</pre><p>Now it deploys in seconds with automatic HTTPS and global CDN.</p><h3>Results: What I Learned</h3><p><strong>Technical lessons:</strong></p><ul><li>Server-side CSV processing is more reliable than client-side</li><li>Validation should be visual and actionable</li><li>Database-specific SQL matters more than I thought</li><li>Dark mode isn’t just aesthetic — it’s branding</li></ul><p><strong>Product lessons:</strong></p><ul><li>Solve YOUR OWN problem first (I use this tool now)</li><li>Show, don’t tell (validation results &gt; promises)</li><li>Free + valuable = word of mouth</li><li>Developer tools should look like developer tools</li></ul><h3>What’s Next?</h3><p><strong>Features people are requesting:</strong></p><ol><li>Direct database import (skip copy-paste)</li><li>Data transformations (clean phone numbers, standardize dates)</li><li>Batch processing (multiple CSVs at once)</li><li>API access</li></ol><p><strong>Monetization plan:</strong></p><ul><li>Free tier: 5 conversions/month, 10,000 rows of data</li><li>Pro tier: $10/month unlimited + direct import, up to 500,000 rows of data</li><li>Business tier: $25/month ,API access, 1 million+ rows of data, batch processing</li></ul><h3>Try It Yourself</h3><p>The tool is live and free to use: <a href="https://csv-to-sql-converter-tau.vercel.app/"><strong>CSV to SQL Converter</strong></a></p><p>Note: Because I am using Vercel’s Free Tier at the moment, the tool is limited to only use csv files with less than 10,000 rows</p><p><strong>Test it with this scenario:</strong></p><ol><li>Create a CSV with a ZIP code column (values like 07001, 02134)</li><li>Upload it</li><li>Watch the validation catch that it’s detected as INTEGER</li><li>Override to VARCHAR</li><li>Generate SQL that preserves the leading zeros</li></ol><p><strong>Feedback welcome!</strong> What other validations would be useful?</p><h3>The Code</h3><p>Full source available on GitHub: <a href="https://github.com/gbohannon99/csv-to-sql-converter">github.com/gbohannon99/csv-to-sql-converter</a></p><p>Built with:</p><ul><li>Node.js + Express</li><li>PapaParse for CSV parsing</li><li>Vanilla JavaScript (no framework)</li><li>Deployed on Vercel</li></ul><h3>Final Thoughts</h3><p>The best time to catch data problems is BEFORE they reach your database, not after.</p><p>If you’ve ever spent hours debugging a corrupted CSV import, this tool is for you.</p><p>And if you’re building something similar, here’s my advice: <strong>solve your own problem thoroughly, then share it.</strong> The best products come from real frustration.</p><p><strong>Try it:</strong> <a href="https://csv-to-sql-converter-tau.vercel.app/">https://csv-to-sql-converter-tau.vercel.app</a></p><p><strong>Questions? Feedback?</strong> Drop a comment or reach out!</p><p><strong>Tags:</strong> #webdevelopment #nodejs #database #sql #csv #dataengineering #javascript</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f3b0b98b0564" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>