<?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 Sanchit Vijay on Medium]]></title>
        <description><![CDATA[Stories by Sanchit Vijay on Medium]]></description>
        <link>https://medium.com/@sanchitvj?source=rss-ef2e417d9441------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*q9rznC67W1-bGRgdoZcigw.png</url>
            <title>Stories by Sanchit Vijay on Medium</title>
            <link>https://medium.com/@sanchitvj?source=rss-ef2e417d9441------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sun, 06 Dec 2026 09:05:43 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@sanchitvj/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[DARE #3: Connecting S3 Tables and Snowflake Through MCP Servers in Cursor]]></title>
            <link>https://blog.dataengineerthings.org/dare-3-connecting-s3-tables-and-snowflake-through-mcp-servers-in-cursor-1f102fa3c01f?source=rss-ef2e417d9441------2</link>
            <guid isPermaLink="false">https://medium.com/p/1f102fa3c01f</guid>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[snowflake]]></category>
            <category><![CDATA[mcp-server]]></category>
            <category><![CDATA[ai]]></category>
            <category><![CDATA[aws]]></category>
            <dc:creator><![CDATA[Sanchit Vijay]]></dc:creator>
            <pubDate>Sun, 27 Jul 2025 11:50:14 GMT</pubDate>
            <atom:updated>2025-07-27T11:50:14.710Z</atom:updated>
            <content:encoded><![CDATA[<p>This is my third article in the DARE series, testing MCP servers with S3 Tables and Snowflake to see if conversational database access works beyond the marketing demos.</p><blockquote><a href="https://github.com/sanchitvj/DARE">D.A.R.E. (Data and AI Repository of Experiments)</a> is my safe place to build, break, learn from chaos, and document what works. These Articles talk about Data and AI Engineering experiments that matter.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*9agmdo32XvJJ_KCMiCVf1g.png" /></figure><p>Yesterday, I wrote the same data validation query six times. Same logic, different tables, different stakeholders asking about the same pipeline failure. Each time, I had to remember the exact syntax for row counts by partition, check data types, and compare schemas across environments.</p><p>As a data engineer working on pipelines, I frequently write the same debugging queries. Failed job? Query the source data. Data anomaly? Check row counts by partition. Schema mismatch? Compare column types across environments. Same investigative pattern, different tables and timeframes.</p><p>MCP promises to automate exactly this kind of repetitive querying. But the demos looked too clean, perfect questions receiving flawless SQL responses. What happens when you implement this with real complexity?</p><p><strong>Time to find out!</strong></p><p>I configured MCP servers for AWS S3 Tables and Snowflake in Cursor IDE, then tested them with analytical challenges, schema evolution, complex aggregations, and multi-dimensional analysis. Using my existing <a href="https://www.backblaze.com/cloud-storage/resources/hard-drive-test-data">Backblaze dataset</a> spanning multiple years with evolving schemas. This tests the gap between MCP promises and practice.</p><p><strong>What I Found</strong></p><p>Testing MCP servers with S3 Tables and Snowflake revealed the gap between marketing promises and production reality. Both systems generated identical SQL for standard analytical queries, which validates the technology’s core promise. However, S3 Tables crashed on large datasets and failed due to data type conversions, whereas Snowflake handled everything smoothly.</p><p>Bottom line: MCP servers are well-suited for routine data exploration and standard analytical tasks. They break on edge cases and complex domain logic. Worth using for eliminating syntax friction, not worth expecting magic.</p><h3>MCP Context for Data Teams</h3><p>Think of MCP servers as bilingual friends who speak both “human” and “database.” You say, “Show me the problematic drives.” They translate that into database language, fetch the results, and translate them back into human-readable insights. Instead of learning database syntax, you ask questions. The MCP server becomes your interpreter. <a href="https://d2908q01vomqb2.cloudfront.net/e1822db470e60d090affd0956d743cb0e7cdf113/2025/07/15/image-109.png">The recent AWS blog has a really good interpretation.</a></p><p><strong>The gap</strong>: Marketing demos use clean datasets with perfect questions. Production data is messy. Real analytical workflows involve complex logic, edge cases, and ambiguous requirements.</p><pre>Human Question → MCP Server → Database Query → Results → Human Answer<br>     ↑                                                          ↓<br>(Natural Language)                                    (Readable Insights)</pre><h3>Experiment Design &amp; Dataset Context</h3><p>I used the same <a href="https://www.backblaze.com/cloud-storage/resources/hard-drive-test-data">Backblaze hard drive dataset</a> from my previous DARE experiments. This choice made sense for two reasons: I already understood the data structure, and it contains genuine analytical complexity that would test MCP capabilities beyond simple demos.</p><p>Testing methodology: Real analytical questions that data teams encounter daily. Not “show me all records” queries, but business-critical analysis that requires joins, aggregations, and domain knowledge.</p><p>Infrastructure: Cursor IDE as the MCP client, with both S3 Tables and Snowflake MCP servers configured. The authentication setup became a significant part of the experiment.</p><p>Analytical scenarios tested: Drive reliability analysis with conditional grading, SSD vs HDD comparative analysis across multiple dimensions, SMART attribute anomaly detection for statistical analysis, and table creation with write operations. Each scenario tests different MCP capabilities: schema understanding, complex logic translation, and business context interpretation.</p><h3>S3 Tables MCP: Works Until It Doesn’t</h3><p><a href="https://aws.amazon.com/blogs/storage/implementing-conversational-ai-for-s3-tables-using-model-context-protocol-mcp/">This blog</a> creates a dedicated IAM user with specific S3 Tables policies. I used my existing AWS account directly without creating additional IAM roles or policies.</p><p>If your current AWS profile already has S3 Tables permissions, the MCP server inherits those credentials automatically. No extra setup needed. The server uses your configured AWS profile and region through environment variables.</p><p>Security considerations: The --allow-write flag enables table creation and data modification operations. Without it, you get read-only access. This matters because the MCP server exposes 16 tools to your AI assistant, including create_table_bucket, append_rows_to_table, import_csv_to_table, and query_database.</p><h4>Cursor Integration Configuration</h4><p>Here’s the complete configuration that works:</p><pre># First configure AWS credentials using<br>aws confgure</pre><p>Then open Cursor settings and go to Tools &amp; Integrations then clicking New MCP Server will open a mcp.json where you can paste the below code.</p><pre>{<br>  &quot;mcpServers&quot;: {<br>    &quot;awslabs.s3-tables-mcp-server&quot;: {<br>      &quot;command&quot;: &quot;uvx&quot;,<br>      &quot;args&quot;: [&quot;awslabs.s3-tables-mcp-server@latest&quot;,<br>               &quot;--allow-write&quot;,<br>               &quot;--log-dir&quot;,<br>               &quot;/path/where/you/want/s3-tables-logs&quot;],<br>      &quot;env&quot;: {<br>        &quot;AWS_PROFILE&quot;: &quot;your-profile-name&quot;,<br>        &quot;AWS_REGION&quot;: &quot;us-east-1&quot;<br>      },<br>      &quot;disabled&quot;: false,<br>      &quot;autoApprove&quot;: []<br>    }<br>  }<br>}</pre><p>Configuration breakdown: The uvx command downloads and runs the latest MCP server version. The --allow-write flag unlocks all 16 available tools, including list_table_buckets, create_table_namespace, rename_table, and get_table_metadata.</p><p>Troubleshooting: Connection failures usually stem from authentication issues. Check that your AWS profile works with aws sts get-caller-identity. Network timeouts indicate region mismatches or connectivity problems.</p><p>The disabled: false parameter tells the Cursor to load and activate this MCP server. If you set it to true or remove this line, the Cursor ignores the server configuration entirely. Think of it as an on/off switch for each MCP server in your setup. The autoApprove array stays empty for security. You want to approve MCP operations manually, especially with write access enabled.</p><p>NOTE: The Cursor needs a complete <strong>RESTART</strong> after adding the MCP server configurations. The settings won’t take effect until you fully close and reopen the IDE (see figure after Snowflake Implementation).</p><h3>Snowflake MCP Server Implementation</h3><h4>Snowflake Configuration</h4><p>I used external tables in Snowflake that connect to the R2 Data Catalog from my <a href="https://sanchitvj.substack.com/p/the-database-that-doesnt-store-your?r=4mtvza">previous experiment</a>. Here’s the clever part: <em>R2 Data Catalog doesn’t have its own MCP server, but Snowflake’s MCP server can query R2 data through external tables.</em></p><p>This setup provides conversational access to R2 data without native MCP support. The data stays in R2, Snowflake provides the query interface, and the MCP server handles the natural language translation. Plus, querying data in R2 through Snowflake external tables has <em>no egress fees</em>.</p><p>This approach essentially turns R2 Data Catalog into an MCP-enabled system without waiting for Cloudflare to build native support.</p><h4>MCP Server Setup and Configuration</h4><p>Setting up Snowflake MCP requires a different approach. Instead of using uvx with a pre-built server, you need a <a href="https://github.com/sanchitvj/DARE/blob/main/mcp_server/sf_server.py">custom SERVER</a> because the existing Snowflake MCP implementations are read-only. (I’d have copied and pasted the code here, but it&#39;s unnecessary 265 lines, too long).</p><p>Environment setup: Create a .env file with these variables:</p><pre>SNOWFLAKE_ACCOUNT=your-account          # &lt;Account Locator&gt;.us-east-1<br>SNOWFLAKE_USER=your-username  <br>SNOWFLAKE_PASSWORD=your-password<br>SNOWFLAKE_DATABASE=your-database<br>SNOWFLAKE_SCHEMA=your-schema<br>SNOWFLAKE_WAREHOUSE=your-warehouse</pre><p>Custom server requirement: The standard Snowflake MCP server only supports read operations, and logging didn’t work in my case. My sf_server.py (adapted from <a href="https://adrianleexinhan.medium.com/unlocking-ai-potential-connecting-snowflake-to-claude-with-mcp-in-cursor-034fa7b9a783">Adrian Lee&#39;s implementation</a>) handles both read and write operations with proper transaction management.</p><p>Cursor configuration:</p><pre>{<br>  &quot;mcpServers&quot;: {<br>    &quot;snowflake&quot;: {<br>      &quot;command&quot;: &quot;path/to/your/python&quot;,<br>      &quot;args&quot;: [&quot;/path/to/sf_server.py&quot;, &quot;/path/where/you/want/snowflake-logs/snowflake_mcp_server.log&quot;]<br>    }<br>  }<br>}</pre><p>You can use which python in the terminal to get the Python path.</p><p>The custom server included connection lifecycle management, query execution with transaction support, and detailed logging for debugging. Unlike the AWS S3 Tables server that runs remotely, this Python server runs locally and communicates with Snowflake.</p><p>For read-only access, you can use a <a href="https://playbooks.com/mcp/isaacwasserman-snowflake">simpler configuration</a> approach:</p><pre>{<br>  &quot;mcpServers&quot;: {<br>    &quot;snowflake_pip&quot;: {<br>      &quot;command&quot;: &quot;uvx&quot;,<br>      &quot;args&quot;: [<br>                &quot;--python=3.12&quot;,<br>                &quot;mcp_snowflake_server&quot;,<br>                &quot;--account&quot;,<br>                &quot;account_locator.us-east-1&quot;,<br>                &quot;--warehouse&quot;,<br>                &quot;your-warehouse&quot;,<br>                &quot;--user&quot;,<br>                &quot;your-username&quot;,<br>                &quot;--password&quot;,<br>                &quot;your-password&quot;,<br>                &quot;--role&quot;,<br>                &quot;your-role&quot;,<br>                &quot;--database&quot;,<br>                &quot;your-database&quot;,<br>                &quot;--schema&quot;,<br>                &quot;your-schema&quot;<br>            ]<br>    }<br>  }<br>}</pre><p>Again, you need to restart the Cursor for the MCP server to take effect.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ZsdQqkcWScQ2LxviWjw5bw.png" /><figcaption>You can see the green indicator for both S3 Tables and Snowflake. Also the enabled tools for each MCP server.</figcaption></figure><h3>Testing Real Analytical Workflows</h3><p>Here’s where MCP servers either prove their worth or expose their limitations. As a data engineer, your daily reality involves constant context switching between pipeline debugging, data quality validation, and stakeholder questions. MCP servers promise to eliminate the friction of writing repetitive investigative queries.</p><p>I tested both systems with scenarios that mirror actual engineering workflows. Not the polished demo queries, but the messy reality of production data work. I will be using different chats to do this.</p><h4>Schema Discovery and Data Exploration</h4><p>This is where MCP servers shine for pipeline development. Instead of writing DESCRIBE table or, digging through information schemas, just ask questions.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*w0EHJ_FnID6ANk13DBXeUQ.png" /></figure><p>The response included column names, data types, and contextual explanations about SMART attributes. This matters when you’re inheriting unfamiliar datasets or onboarding new team members who need to understand data structures.</p><p>One of the observations I had was that the Snowflake MCP server, when asked to list all tables present in the database, did not list external tables, even though they remain queryable.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*EL71BR0RaQ5sSTWTZQfkFg.png" /><figcaption>hdd_iceberg_r2 is external table in R2 data catalog.</figcaption></figure><p>Both servers translated these questions into proper metadata queries, but Snowflake’s responses included additional context about partition distribution and data freshness. For pipeline validation, this immediate access to data profiling eliminates the need to remember database-specific syntax.</p><p>Why this matters: During pipeline development, you constantly validate data structure assumptions. MCP servers turn these validations from syntax exercises into conversational checks.</p><h4>Complex Analytical Queries</h4><p>Real analytical work involves business logic that’s tedious to translate into SQL. We can focus on the analytical part and let the MCP servers handle the translation. Let’s use our good old hard drive failure query (my fourth article featuring this query again).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*GlWlwCaQspIp9NdsERW9ww.png" /><figcaption>Both S3 table and Snowflake MCP server gave same results with similar SQL logic.</figcaption></figure><p>Below, we can see the same results for the same analysis.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*hW3lEb5_GpA9sevgzinnZw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*4SMgWRnGT2qInOKqAWJVQg.png" /><figcaption>HDD vs SSD analyses results returned by S3 Tables and SFs MCPs</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ArSfRzld37DKq_vVjObDiQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*CA5dYnZ2grKrkWGR4k7fxg.png" /><figcaption>Corresponding SQL queries used, exactly same.</figcaption></figure><p>Both MCP servers generated identical SQL because they’re likely using similar underlying language models for query translation. This isn’t Cursor caching, it’s convergent query generation. When given the same analytical requirements, both systems arrived at the same optimal SQL structure, which validates the reliability of MCP query translation for standard analytical patterns.</p><h4>When Things Break Spectacularly</h4><p>Now let’s try something challenging. We will create tables and append to them. We will identify drives with unusual SMART attribute patterns compared to their model peers, specifically those exhibiting high read error rates or temperature spikes, for the years 2022–2025.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*OgIvOsheL3a9c_a7CsCkCw.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*46vB8mpoL6SxTaexcG8yCA.png" /><figcaption>It was straightforward with Snowflake</figcaption></figure><p>As you can observe from the above figure (on the left), it took just 62 seconds to do the entire process from table creation to appending 2 million rows. On the right, you can see how the table looks when queried in Snowflake.</p><p>Next, let’s try the same for S3 Tables. The S3 Tables MCP Server runs on the Daft engine, which has strict data type handling that becomes problematic with real-world datasets. During testing with SMART attribute data stored as strings, the system consistently failed on numeric operations.</p><p>The core issue: Daft engine <a href="https://github.com/Eventual-Inc/Daft/issues/3817">cannot perform</a> implicit or explicit casting from UTF-8 strings to numeric types in WHERE clauses or expressions. This creates a fundamental barrier for analytical queries that require numeric comparisons.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Yp7em3ydco6iniricOEa4w.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Q654qbaO-joHPhPz-JsHUg.png" /><figcaption>You can see it using create_table. Make sure to include in your prompt to append rows, if you write “INSERT INTO” then it won’t work.</figcaption></figure><p>Testing the S3 Tables MCP server with millions of rows revealed critical limitations. The server becomes completely unresponsive when processing large queries against datasets. (<em>Me ranting</em>)Another annoying part was the usage limits on Cursor Pro. Auto mode on the cursor <em>SU*KS</em> big time.</p><h3>MCP Servers: Beyond the Experiment</h3><p>This was my first time trying MCP servers. I was wondering what other data teams are doing with MCP servers in practice.</p><p>Here’s what I found: companies like AWS, Microsoft, and Runbear are actively building MCP servers for production workflows. AWS released an official <a href="https://aws.amazon.com/blogs/big-data/accelerating-development-with-the-aws-data-processing-mcp-server-and-agent/">Data Processing MCP Server</a> that connects to Glue, EMR, and other analytics services. Development teams utilize these servers for cross-repository debugging, where a single MCP instance can simultaneously access multiple microservice repositories. Business teams are connecting HubSpot and Gmail MCP servers to automatically generate client briefings before meetings. I could go on and on, but MCP is not a new concept; it has been available for a while.</p><p>BI teams report using MCP servers for conversational report generation, thereby eliminating the need for back-and-forth translation of business questions into dashboard queries. Sales teams get automated meeting prep through natural language interfaces. Analytics engineers utilize them for schema discovery and data quality checks, eliminating the need to write repetitive validation scripts.</p><p>But here’s the thing: MCP servers can become expensive fast. Each registered function adds token overhead, and most people don’t realize why their AI usage costs have exploded until they’re deep into monthly usage reports. More concerning for data teams is the security aspect. These servers inherit your database permissions, so a poorly configured MCP setup essentially gives an AI assistant the same access level you have to production data ☠️</p><p>The practical risks aren’t security breaches. They’re simpler problems that catch data engineers off guard. Command injection through user inputs that don’t get sanitized properly. Prompt manipulation, where someone figures out how to make the MCP server execute unintended operations. Token exposure occurs when OAuth credentials get logged or cached inappropriately.</p><p>What this means is straightforward: start with read-only permissions, understand exactly which tools each MCP server exposes, and closely monitor your usage costs. The technology works well for routine analytical tasks, but it’s not magic. It’s just another tool that needs proper setup and boundaries, especially when you’re giving it access to production data systems.</p><p>The real value comes from eliminating the syntax friction in daily data work, not from replacing analytical thinking. Those who expect MCP servers to handle complex domain logic end up frustrated, like I was with the S3 Tables type conversion issues.</p><h3>Should Data Engineers Use MCP Servers?</h3><p>After testing both systems extensively, here’s my honest assessment:</p><p>Start using MCP servers if you spend a significant amount of time on repetitive data exploration, schema discovery, and standard analytical queries. The syntax elimination alone saves hours per week.</p><p>Don’t expect magic from MCP servers if you work with mixed data types, need complex statistical analysis, or handle large datasets with performance constraints. You’ll hit limitations quickly.</p><p>Begin with read-only Snowflake MCP for analytical work, S3 Tables MCP for basic data lake exploration. Understand exactly which tools each server exposes before enabling write access.</p><p>The technology helps eliminate syntax friction in daily data work. It doesn’t replace analytical thinking or solve fundamental data engineering challenges. Teams that understand this distinction get genuine productivity improvements.</p><p>That’s the real gap between MCP promises and practice. The conversational interface works, but your underlying data infrastructure limitations remain unchanged.</p><p>References:</p><ul><li><a href="https://aws.amazon.com/blogs/storage/implementing-conversational-ai-for-s3-tables-using-model-context-protocol-mcp/">Implementing conversational AI for S3 Tables using Model Context Protocol (MCP) | Amazon Web Services</a></li><li><a href="https://adrianleexinhan.medium.com/unlocking-ai-potential-connecting-snowflake-to-claude-with-mcp-in-cursor-034fa7b9a783">Unlocking AI Potential: Connecting Snowflake to Claude with MCP in Cursor</a></li></ul><blockquote>Each experiment answers one question and raises three more. Some experiments work brilliantly, some fail spectacularly, but all teach me something I didn’t know yesterday. That is exactly how I like it.</blockquote><blockquote>(My cloud bill occasionally disagrees 🫠).</blockquote><blockquote>DARE Continues…</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1f102fa3c01f" width="1" height="1" alt=""><hr><p><a href="https://blog.dataengineerthings.org/dare-3-connecting-s3-tables-and-snowflake-through-mcp-servers-in-cursor-1f102fa3c01f">DARE #3: Connecting S3 Tables and Snowflake Through MCP Servers in Cursor</a> was originally published in <a href="https://blog.dataengineerthings.org/">Data Engineer Things</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[DARE #2: Cross-cloud storage adventure S3  R2]]></title>
            <link>https://blog.dataengineerthings.org/dare-2-cross-cloud-storage-adventure-s3-r2-d68ed61faece?source=rss-ef2e417d9441------2</link>
            <guid isPermaLink="false">https://medium.com/p/d68ed61faece</guid>
            <category><![CDATA[duckdb]]></category>
            <category><![CDATA[cloudflare]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[apache-iceberg]]></category>
            <category><![CDATA[data-engineering]]></category>
            <dc:creator><![CDATA[Sanchit Vijay]]></dc:creator>
            <pubDate>Thu, 03 Jul 2025 16:20:38 GMT</pubDate>
            <atom:updated>2025-07-03T16:20:38.198Z</atom:updated>
            <content:encoded><![CDATA[<p>This is the second article in my DARE series, where I will share how to move data between S3 and R2 using Spark (don’t be afraid, not EMR this time - I know the reaction when readers see “I…used EMR cluster!!… for my experiment”.</p><blockquote><a href="https://github.com/sanchitvj/DARE">D.A.R.E. (Data and AI Repository of Experiments)</a> is my safe space to create, break, learn from chaos, and document what works. These articles discuss Data and AI Engineering experiments that matter.</blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*PFqx4molEepZUww_m7L1zA.png" /></figure><p><a href="https://medium.com/@sanchitvj/dare-1-migrating-iceberg-data-from-s3-to-s3-tables-with-emr-spark-11677335ead6">In my previous article</a>, I demonstrated how to migrate Apache Iceberg tables from standard S3 storage to S3 Tables, staying entirely within the AWS ecosystem. This article demonstrates how to migrate Apache Iceberg tables from the AWS Glue catalog to the <a href="https://developers.cloudflare.com/r2/data-catalog/">Cloudflare R2 Data Catalog</a> using Spark.</p><p>This experiment addresses a critical question: Are data lakes portable between cloud providers? Everyone talks about “open standards,” but does that marketing hold up when moving real workloads from AWS to Cloudflare infrastructure?</p><p>The migration uses Spark’s dual catalog configuration to read from Glue and write to R2. I’ll show you how to handle the authentication complexity, manage JAR dependencies, and process large datasets efficiently. The experiment utilizes glue-managed iceberg tables present in Standard S3 (source: <a href="https://www.backblaze.com/cloud-storage/resources/hard-drive-test-data">Backblaze hard drive</a> data), but this time moving between two completely different cloud providers. Here’s how to make Spark work across AWS and Cloudflare infrastructure.</p><p><strong>Before all that, what is R2 Data Catalog?</strong></p><p>R2 Data Catalog is a managed Apache Iceberg catalog built directly into the R2 bucket, exposing a standard Iceberg REST catalog interface that works with existing engines such as DuckDB, Spark, Snowflake, and PyIceberg. It eliminates vendor lock-in while maintaining full Iceberg compatibility. Check out more about how R2 stands out and saves storage costs <a href="https://dataengineeringcentral.substack.com/p/cloudflare-r2-apache-iceberg-r2-data">here</a>.</p><h3>The Migration Experiment Setup</h3><p>I already had the Backblaze hard drive dataset as Iceberg tables in AWS S3, managed by the Glue catalog. The goal here is to migrate this 584 million row dataset to Cloudflare R2 Data Catalog while preserving all Iceberg features and partitioning.</p><p>Source Configuration:</p><ul><li><a href="https://github.com/sanchitvj/DARE/blob/main/comparing_storage/create_iceberg_s3.py">Apache Iceberg tables in AWS S3</a></li><li>Glue catalog managing metadata</li><li>Year-based partitioning with quarterly subdivisions</li></ul><p>Destination Configuration:</p><ul><li>Cloudflare R2 bucket with Data Catalog enabled</li><li><a href="https://developers.cloudflare.com/r2/api/tokens/">REST catalog authentication via API tokens</a></li><li>Same partitioning strategy to preserve query performance</li></ul><p>Infrastructure:</p><ul><li>EC2 instance (I used c6a.4xlarge) for local Spark session</li><li>Dual catalog configuration reading from Glue, writing to R2</li><li>JAR dependency management for cross-cloud compatibility</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/500/1*e-oCska78HHJ10k98ugUxA.jpeg" /></figure><p>The challenge is configuring Spark to authenticate with both AWS Glue and Cloudflare R2, then processing 13 years of data efficiently without running out of memory.</p><h3>Implementation</h3><p>Our script brings unique challenges compared to the previous migration (S3 to S3 Tables). This section explains how to handle these complexities.</p><p><strong>Dual Catalog Configuration</strong></p><p>Always the first step, configuring Glue Catalog and R2 Data Catalog. Each catalog requires different authentication and endpoint configuration. The key difference is that R2 uses REST catalog with OAuth2 authentication, while Glue uses AWS SDK authentication. Both catalogs use S3FileIO but with different endpoints and credentials.</p><pre># Glue catalog configuration<br>.config(&quot;spark.sql.catalog.glue_catalog&quot;, &quot;org.apache.iceberg.spark.SparkCatalog&quot;)<br>.config(&quot;spark.sql.catalog.glue_catalog.catalog-impl&quot;, &quot;org.apache.iceberg.aws.glue.GlueCatalog&quot;)<br>.config(&quot;spark.sql.catalog.glue_catalog.io-impl&quot;, &quot;org.apache.iceberg.aws.s3.S3FileIO&quot;)<br>.config(&quot;spark.sql.catalog.glue_catalog.warehouse&quot;, os.getenv(&quot;S3_WAREHOUSE&quot;))<br><br># R2 catalog configuration  <br>.config(&quot;spark.sql.catalog.r2_catalog&quot;, &quot;org.apache.iceberg.spark.SparkCatalog&quot;)<br>.config(&quot;spark.sql.catalog.r2_catalog.type&quot;, &quot;rest&quot;)<br>.config(&quot;spark.sql.catalog.r2_catalog.uri&quot;, os.getenv(&quot;R2_CATALOG_URI&quot;))<br>.config(&quot;spark.sql.catalog.r2_catalog.token&quot;, os.getenv(&quot;R2_CATALOG_API_TOKEN&quot;))<br>.config(&quot;spark.sql.catalog.r2_catalog.oauth2-server-uri&quot;, f&quot;{os.getenv(&#39;R2_CATALOG_URI&#39;)}/oauth/tokens&quot;)</pre><p>The type: rest config tells Iceberg to communicate with Cloudflare’s catalog via HTTP calls rather than direct AWS service integration. It’s the difference between having a direct phone line versus using the internet to make calls.</p><p><strong>JAR Dependencies</strong></p><p>We need specific JAR files that aren’t bundled with the standard Spark setup. I am using <a href="https://github.com/sanchitvj/DARE/blob/main/comparing_storage/r2/download_iceberg_jars.sh">this script to download</a> the following JARs in the working directory.</p><pre>required_jars = [<br>    &quot;iceberg-spark-runtime-3.5_2.12-1.6.1.jar&quot;,<br>    &quot;bundle-2.20.18.jar&quot;, <br>    &quot;url-connection-client-2.20.18.jar&quot;,<br>    &quot;hadoop-aws-3.3.4.jar&quot;,<br>    &quot;aws-java-sdk-bundle-1.12.262.jar&quot;<br>]</pre><p>The script validates that all required dependencies are present in the given location before starting.</p><p><strong>Year-by-Year strategy</strong></p><p>Instead of bulk transfer (which would be expensive and risky across cloud boundaries), the script processes data in annual batches.</p><pre>def migrate_table_batch_by_year(spark, source_table, dest_table, table_info):<br>    # Auto-detect available years from source<br>    years_df = spark.sql(f&quot;SELECT DISTINCT year FROM {source_table} ORDER BY year&quot;)<br>    years = [row.year for row in years_df.collect()]<br>    <br>    for i, year in enumerate(years):<br>        # Read specific year with predicate pushdown<br>        df = spark.sql(f&quot;SELECT * FROM {source_table} WHERE year = {year}&quot;)<br>        <br>        # Add quarter partitioning for R2 optimization<br>        df = df.withColumn(&quot;quarter&quot;, <br>            when(month(col(&quot;date&quot;)).between(1, 3), &quot;Q1&quot;)<br>            .when(month(col(&quot;date&quot;)).between(4, 6), &quot;Q2&quot;)<br>            .when(month(col(&quot;date&quot;)).between(7, 9), &quot;Q3&quot;)<br>            .when(month(col(&quot;date&quot;)).between(10, 12), &quot;Q4&quot;))</pre><p>The year-by-year approach provides three key benefits: minimized cross-cloud data transfer through predicate pushdown, granular recovery points if specific years fail, and controlled memory usage for large datasets. If 2019 data fails to migrate, you don’t lose 2013–2018 progress.</p><p><strong>Schema Evolution and Partitioning Strategy</strong></p><p>R2 migration preserves the original schema while adding enhanced partitioning for Cloudflare’s global edge optimization. The migration keeps your data structure exactly the same but reorganizes how files are split up to work better with Cloudflare’s distributed storage network.</p><pre># First batch - create table with partitioning<br>if i == 0:<br>    df.writeTo(f&quot;r2_catalog.default.{dest_table}&quot;) \<br>        .partitionedBy(&quot;year&quot;, &quot;quarter&quot;) \<br>        .tableProperty(&quot;format-version&quot;, &quot;2&quot;) \<br>        .tableProperty(&quot;write.target-file-size-bytes&quot;, &quot;268435456&quot;) \<br>        .tableProperty(&quot;write.parquet.compression-codec&quot;, &quot;snappy&quot;) \<br>        .createOrReplace()<br>else:<br>    # Subsequent batches - append with schema merging<br>    df.writeTo(f&quot;r2_catalog.default.{dest_table}&quot;) \<br>        .option(&quot;mergeSchema&quot;, &quot;true&quot;) \<br>        .append()</pre><p>The script creates 256MB files with snappy compression because this size works well for both fast queries and efficient storage across Cloudflare’s global network. Too small and you get too many files to manage, too large and data transfer becomes slow.</p><p><strong>Memory Management</strong></p><p>Cross-cloud migrations are memory-intensive, so the script includes automatic memory allocation and cleanup.</p><pre># Auto-detect available memory<br>available_memory_gb = psutil.virtual_memory().available // (1024**3)<br>driver_memory_gb = max(4, min(28, int(available_memory_gb * 0.8)))<br><br># Memory cleanup after each batch<br>df.unpersist()<br>del df<br>gc.collect()</pre><p>Each year batch is processed independently, with aggressive memory cleanup between batches to prevent OOM errors during large cross-cloud transfers. The 80% memory allocation leaves headroom for Spark’s internal operations, while explicit garbage collection prevents memory leaks that accumulate across 13 annual batches.</p><p><strong>Optimization</strong></p><p>The optimization step is crucial for R2 performance, as it rewrites files for optimal distribution across Cloudflare’s global edge network.</p><pre>spark.sql(f&quot;CALL r2_catalog.system.rewrite_data_files(table =&gt; &#39;default.{table_name}&#39;)&quot;)<br>spark.sql(f&quot;CALL r2_catalog.system.rewrite_manifests(&#39;default.{table_name}&#39;)&quot;)</pre><p>The rewrite_data_files operation consolidates small files created during the migration into optimal 256MB chunks, while rewrite_manifests optimizes metadata for faster query planning. These operations are specific to Iceberg and run after migration completes.</p><p>This implementation handles the complexity of coordinating two different catalog systems while maintaining data integrity and performance. The year-by-year batch processing proved essential for both memory management and cost control during cross-cloud transfers.</p><p>The logs below show how this configuration performs during actual migration execution.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_yNwb58VNUW0aKLn_C7cyg.png" /></figure><p>The entire 584 million row migration completed in 1 hour 48 minutes on a single node setup. Running this on an EMR cluster with multiple executors would likely reduce processing time significantly, but that’s an experiment for another day.</p><p>These code snippets highlight the critical configuration points, but the <a href="https://github.com/sanchitvj/DARE/blob/main/comparing_storage/create_iceberg_s3_to_r2.py">complete migration script</a> includes additional error handling, verification steps, and optimization routines.</p><h3>Querying with DuckDB</h3><p>Let’s verify the data accessibility and test query performance. DuckDB provides the perfect tool for this with its native <a href="https://developers.cloudflare.com/r2/data-catalog/config-examples/duckdb/">R2 Data Catalog support</a>.</p><p>Follow the basic setup instructions from the documentation (ensure you have DuckDB version 1.3.0 or later). Start by installing and loading the required extensions. Then, configure a DuckDB secret to store the R2 API token. Followed by attaching R2 Data Catalog (read-only).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/971/1*4TOoY4nPSoqvu7IzMWeIEg.png" /></figure><p>First, you need the name of your Iceberg warehouse in R2. hdd_r2_catalog is the alias we will be using to reference this catalog in DuckDB. Then you need a catalog URI. You can get these 2 from the R2 console of your bucket as shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*26-wbY5EJBfbVAl6bZovAw.png" /></figure><p>Now, let’s check the tables present in our R2 Catalog.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bVG-MKFuqBowpQ4vZPOUjQ.png" /></figure><p>We will query hdd_iceberg_r2 from default schema. Starting with the basics, getting the count of data. This confirms that all our data has been migrated properly, showing 584 million rows.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/496/1*P49LVw1u8um8OZv8aC8Jiw.png" /></figure><p>Now let’s try something complex. We will use the <a href="https://medium.com/@sanchitvj/dare-1-migrating-iceberg-data-from-s3-to-s3-tables-with-emr-spark-11677335ead6">same query</a> that we used earlier in Athena to query our S3 Table. This query analyzes hard drive reliability by model for Q2 2024, calculating failure rates and assigning reliability grades for drive models with significant sample sizes (&gt;1000 drives).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/852/1*uqOxg5K5j0BZLOt6K50Kzw.png" /></figure><p>DuckDB’s integration with R2 Data Catalog was smooth. No performance overhead from the REST catalog interface, and all Iceberg features (time travel, schema evolution) worked as expected.</p><p>This confirms that the migrated data maintains full Iceberg compatibility while benefiting from Cloudflare’s global distribution network. The 256MB file sizes created during migration proved optimal for both DuckDB’s columnar processing and R2’s edge performance.</p><h3>What did I learn?</h3><p>This cross-cloud migration experiment taught me three practical things about moving Iceberg data to R2 Data Catalog:</p><ul><li>REST catalog integration works smoothly. Once configured correctly, DuckDB and Spark treat R2 Data Catalog exactly like any other Iceberg catalog. The OAuth2 authentication setup was straightforward, and query performance matched expectations.</li><li>Year-by-year processing is essential for cross-cloud migrations. The batch approach prevented memory issues, controlled costs, and provided recovery points when network hiccups occurred. Processing 584 million rows took 1 hour 48 minutes on a single node, which felt reasonable for moving data between AWS and Cloudflare.</li><li>JAR dependency management matters more than expected. Missing or incompatible JARs caused authentication failures that only surfaced during actual data processing.</li></ul><p>The cross-cloud migration proved that vendor lock-in is more about operational convenience than technical impossibility. Sometimes, the biggest barrier to data portability is just the effort required to figure out all the configuration details. The best part about experimenting with multiple cloud providers? You realize they’re all just different flavors of the same complexity.</p><blockquote>Each experiment answers one question and raises three more. Some experiments work brilliantly, some fail spectacularly, but all teach me something I didn’t know yesterday. That is exactly how I like it.</blockquote><blockquote>(My cloud bill occasionally disagrees 🫠).</blockquote><blockquote>DARE Continues…</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d68ed61faece" width="1" height="1" alt=""><hr><p><a href="https://blog.dataengineerthings.org/dare-2-cross-cloud-storage-adventure-s3-r2-d68ed61faece">DARE #2: Cross-cloud storage adventure S3 🤝 R2</a> was originally published in <a href="https://blog.dataengineerthings.org/">Data Engineer Things</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[DARE #1: Migrating Iceberg Data from S3 to S3 Tables with EMR Spark]]></title>
            <link>https://blog.dataengineerthings.org/dare-1-migrating-iceberg-data-from-s3-to-s3-tables-with-emr-spark-11677335ead6?source=rss-ef2e417d9441------2</link>
            <guid isPermaLink="false">https://medium.com/p/11677335ead6</guid>
            <category><![CDATA[emr]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[spark]]></category>
            <category><![CDATA[s3-tables]]></category>
            <category><![CDATA[data-engineering]]></category>
            <dc:creator><![CDATA[Sanchit Vijay]]></dc:creator>
            <pubDate>Wed, 25 Jun 2025 04:01:14 GMT</pubDate>
            <atom:updated>2025-06-30T21:48:26.681Z</atom:updated>
            <content:encoded><![CDATA[<p>This article is the first of my DARE series, where I will share an experiment on how to move Apache Iceberg tables from standard S3 to S3 Tables using a Spark job in an EMR cluster.</p><p>I know the curiosity is popping….What …..is… <strong>DARE</strong>?</p><blockquote><a href="https://github.com/sanchitvj/DARE"><em>D.A.R.E. (Data and AI Repository of Experiments)</em></a><em> is my safe place to build, break, learn from chaos, and document what works. These Articles talk about Data and AI Engineering experiments that matter.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BvNx2ovXwvtNiq9VKqj3Wg.png" /></figure><p><strong>What are S3 Tables?</strong></p><p>AWS S3 Tables integrates metadata directly with storage, eliminating the need for a separate catalog service like Glue. Unlike standard S3, where you manage catalogs separately, <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-tables.html">S3 Tables</a> automatically handles metadata, compaction, and optimization. Think of it as managed Iceberg storage that speak the same APIs but handles the operational overhead.</p><p>Now, how do you actually move data from standard S3 to this managed service? This article includes a migration script, required configurations, and implementation details. Implementation Spotlights:</p><ul><li>Configuring Spark with both Glue and S3 table catalogs</li><li>Setting up partition-aware batch processing for a large dataset</li><li>Handle schema preservation and error recovery mechanisms</li><li>Structure EMR job submissions with correct configs</li></ul><p>The approach reads from the existing Glue catalog and writes to the S3 table catalog. This maintains data integrity while allowing you to monitor progress and handle failures at the partition level.</p><h3>The Migration Experiment Setup</h3><p>Before we can migrate anything, we need some real data to work with. For this experiment, I chose the <a href="https://www.backblaze.com/cloud-storage/resources/hard-drive-test-data">Backblaze Hard Drive Stats Dataset</a> — a collection of drive failure data that Backblaze has been publishing since 2013. This data is perfect for testing DE workflows because it represents the messy reality most of us deal with: inconsistent schemas across periods, varying column counts between quarters, and the kind of irregular file organization that makes you lose sleep.</p><p>The raw data consists of hundreds of CSV files with evolving schemas, some quarters have 190+ columns while others just 60, data types shift between releases, and column names occasionally change. It is exactly the kind of chaos that makes Iceberg’s schema evolution capabilities shine.</p><p>To transform this messy collection into clean, queryable Iceberg tables, I built a <a href="https://github.com/sanchitvj/DARE/blob/main/comparing_storage/create_iceberg_s3.py">manifest-driven ingestion script</a> that handles schema inconsistencies and creates properly partitioned tables in S3 using AWS Glue as the catalog. This gives us our foundation of Iceberg tables that we can migrate to S3 Tables.</p><h4>Infrastructure components:</h4><ol><li>Amazon EMR version 7.5 or higher is required for <a href="https://docs.aws.amazon.com/AmazonS3/latest/userguide/s3-tables-integrating-emr.html">S3 Tables support</a></li><li>Instance types: Master node on c5.2xlarge, core nodes on c5.4xlarge for memory-intensive Iceberg operations.</li><li>S3 logging bucket: For EMR cluster logs and job monitoring. (<em>Trust me on this one</em>)</li></ol><p>You will need an EMR service role and an EC2 instance profile with access to S3, Glue, and S3 Tables (AmazonS3TablesFullAccess). The setup focuses on the minimum viable configuration to test migration functionality rather than production optimization.</p><h3>When Migration Makes Sense?</h3><p>S3 Tables is a managed table storage service that integrates table metadata and storage, unlike standard S3, where you manage catalogs separately through services like Glue. But when does migration become relevant?</p><p>The migration process makes sense when the current multi-catalog or multi-region setup creates operational friction that outweighs the migration effort.</p><ul><li>Multi-bucket table sprawl: Iceberg tables scattered across multiple S3 buckets with separate Glue databases that need unified access.</li><li>Cross-region table replication: Current setup requires complex Glue catalog replication to access tables from multiple AWS accounts with separate Glue catalogs.</li><li>Account consolidation: Merging iceberg tables from multiple AWS accounts with separate Glue catalogs</li><li>Compliance requirements: Regulatory mandates to use a fully managed AWS service instead of a customer-managed catalog infrastructure</li></ul><p>Recent developments have addressed earlier concerns about S3 Table’s openness. As of March 2025, S3 Tables now support <a href="https://aws.amazon.com/about-aws/whats-new/2025/03/amazon-s3-tables-apache-iceberg-rest-catalog-apis">Apache Iceberg REST Catalog API</a>, enabling integration with any Iceberg-compatible query engine, including Spark, Trino, PyIceberg, and DuckDB. Additionally, S3 Tables<a href="https://aws.amazon.com/blogs/storage/bringing-more-to-the-table-how-amazon-s3-tables-rapidly-delivered-new-capabilities-in-the-first-5-months/"> integrate with third-party analytics platforms</a> like Snowflake, Dremio, and Starburst through these standard APIs.</p><p>However, consider that S3 Tables still require AWS infra and specific configurations compared to standard S3’s universal compatibility. Evaluate whether the managed benefits outweigh the architectural changes for your specific use case.</p><h3>Implementation</h3><h4>Dual Catalog Configuration</h4><p>The key challenge here is configuring Spark to read from Glue Catalog and write to S3 Tables in the same session. Notice the fundamental difference: Glue Catalog uses an S3 path for the warehouse location, while S3 Tables requires a full ARN. This dual setup allows Spark to treat both storage systems as native Iceberg catalogs.</p><pre># Source catalog - reading from existing Glue-managed tables<br>spark_builder.config(&quot;spark.sql.catalog.glue_catalog&quot;, &quot;org.apache.iceberg.spark.SparkCatalog&quot;)<br>spark_builder.config(&quot;spark.sql.catalog.glue_catalog.catalog-impl&quot;, &quot;org.apache.iceberg.aws.glue.GlueCatalog&quot;) <br>spark_builder.config(&quot;spark.sql.catalog.glue_catalog.warehouse&quot;, f&quot;s3://{your-warehouse}/&quot;)<br><br># Destination catalog - writing to S3 Tables<br>spark_builder.config(&quot;spark.sql.catalog.s3tables_catalog&quot;, &quot;org.apache.iceberg.spark.SparkCatalog&quot;)<br>spark_builder.config(&quot;spark.sql.catalog.s3tables_catalog.catalog-impl&quot;, &quot;software.amazon.s3tables.iceberg.S3TablesCatalog&quot;)<br>spark_builder.config(&quot;spark.sql.catalog.s3tables_catalog.warehouse&quot;, f&quot;arn:aws:s3tables:{aws_region}:{aws_account_id}:bucket/{s3_table_bucket}&quot;)</pre><h4>Partition Discovery</h4><p>Rather than blindly copying data, the script first analyzes the source table’s partition structure to optimize the migration strategy. This is crucial because Backblaze data spans over a decade with varying data volumes per quarter.</p><pre>source_df = spark.table(f&quot;glue_catalog.{database_name}.{table_name}&quot;)<br>total_rows = source_df.count()<br>print(f&quot;Source table contains {total_rows} total rows&quot;)<br><br># Check for partition columns to enable batch processing<br>if &quot;year&quot; in source_df.columns and &quot;quarter&quot; in source_df.columns:<br>    partition_combinations = source_df.select(&quot;year&quot;, &quot;quarter&quot;).distinct().collect()<br>    print(f&quot;Found {len(partition_combinations)} partition combinations to process&quot;)</pre><p>This discovery step is smart because it:</p><ul><li><strong>Identifies natural boundaries</strong> for batch processing based on existing partitions</li><li><strong>Estimates workload distribution — </strong>early years have smaller datasets than recent quarters</li><li><strong>Allows selective migration </strong>to migrate specific year ranges</li></ul><p>Instead of a naive “copy everything” approach, it processes each year-quarter combination as an independent transaction.</p><pre>for i, row in enumerate(partition_combinations):<br>    year, quarter = row.year, row.quarter<br>    print(f&quot;Processing partition year={year}, quarter={quarter} ({i+1}/{len(partition_combinations)})&quot;)<br>    <br>    # Filter to specific partition<br>    partition_df = source_df.filter((source_df.year == year) &amp; (source_df.quarter == quarter))<br>    row_count = partition_df.count()<br>    <br>    # Determine write mode<br>    mode = &quot;overwrite&quot; if (not table_exists and i == 0) else &quot;append&quot;<br>    <br>    # Write with schema preservation<br>    writer = partition_df.write.format(&quot;iceberg&quot;).mode(mode).option(&quot;mergeSchema&quot;, &quot;true&quot;)<br>    if not table_exists and i == 0:<br>        writer = writer.partitionBy(&quot;year&quot;, &quot;quarter&quot;)<br>    <br>    writer.saveAsTable(f&quot;s3tables_catalog.{database_name}.{table_name}&quot;)</pre><p>Each partition write is an atomic <strong>Iceberg transaction, </strong>so you get ACID guarantees at the partition level. This is far superior to bulk loading approaches that can fail catastrophically halfway through.</p><h4>Schema Preservation</h4><p>The most challenging aspect is maintaining schema fidelity across two different catalog systems. The mergeSchema option is actively reconciling potential schema differences.</p><pre># Enable schema merging for compatibility between catalogs<br>writer = partition_df.write.format(&quot;iceberg&quot;).mode(mode).option(&quot;mergeSchema&quot;, &quot;true&quot;)<br><br># Preserve original partitioning strategy<br>if not table_exists and i == 0:<br>    writer = writer.partitionBy(&quot;year&quot;, &quot;quarter&quot;)</pre><p>The partitionBy(“year”, “quarter”) call on the first write ensures S3 Tables maintains the same physical data layout as the source, preserving query performance characteristics. This consolidated approach processes each year-quarter combination as an independent Iceberg transaction, providing atomic guarantees at the partition level. These were snippets of the necessary parts in the script. You can get the <a href="https://github.com/sanchitvj/DARE/blob/main/comparing_storage/create_iceberg_std_to_s3tables.py">entire script here</a>.</p><h3>Cluster Setup and Execution</h3><p>With our migration script ready, it is time to create an EMR cluster and execute the data transfer. This section covers the practical steps to get everything running in the AWS environment. Before proceeding, make sure to upload your script to an S3 bucket.</p><h4>EMR cluster configs</h4><pre>aws emr create-cluster \                                                                                                            <br>  --name &quot;Iceberg-S3Tables-Migration-Cluster&quot; \<br>  --release-label emr-7.5.0 \                        <br>  --applications Name=Spark \<br>  --configurations &#39;[{                                                                           <br>    &quot;Classification&quot;: &quot;iceberg-defaults&quot;,            <br>    &quot;Properties&quot;: {&quot;iceberg.enabled&quot;: &quot;true&quot;}           <br>  }]&#39; \                                    <br>  --instance-groups &#39;[{          <br>    &quot;Name&quot;: &quot;Master&quot;,         <br>    &quot;Market&quot;: &quot;ON_DEMAND&quot;,        <br>    &quot;InstanceRole&quot;: &quot;MASTER&quot;,<br>    &quot;InstanceType&quot;: &quot;c5.2xlarge&quot;,<br>    &quot;InstanceCount&quot;: 1                                                                   <br>  },{<br>    &quot;Name&quot;: &quot;Workers&quot;,                                                          <br>    &quot;Market&quot;: &quot;ON_DEMAND&quot;,                                                            <br>    &quot;InstanceRole&quot;: &quot;CORE&quot;,                            <br>    &quot;InstanceType&quot;: &quot;c5.4xlarge&quot;, <br>    &quot;InstanceCount&quot;: 2                                                                           <br>  }]&#39; \                                                                       <br>  --service-role EMR_default_role \                                             <br>  --ec2-attributes InstanceProfile=ec2-instane-profile \                               <br>  --log-uri s3://your-logs-bucket/emr-logs/ \                  <br>  --region us-east-1</pre><p>Example output:</p><pre>{<br>    &quot;ClusterId&quot;: &quot;j-2AL4XXXXXX3T5&quot;,<br>    &quot;ClusterArn&quot;: &quot;arn:aws:emr:us-east-1:123456789012:cluster/j-2AL4XXXXXX3T5&quot;<br>}</pre><p>Once the cluster is in the Waiting state, submit the migration job as an EMR step:</p><pre>aws emr add-steps --cluster-id j-37XXXXXXXXXXX --steps &#39;[                                                                        ─╯<br>{<br>  &quot;Name&quot;: &quot;Iceberg to S3 Tables Migration&quot;,<br>  &quot;ActionOnFailure&quot;: &quot;CONTINUE&quot;,<br>  &quot;Type&quot;: &quot;CUSTOM_JAR&quot;,<br>  &quot;Jar&quot;: &quot;command-runner.jar&quot;,<br>  &quot;Args&quot;: [<br>    &quot;spark-submit&quot;,<br>    &quot;--deploy-mode&quot;, &quot;client&quot;,<br>    &quot;--driver-memory&quot;, &quot;4g&quot;,<br>    &quot;--executor-memory&quot;, &quot;6g&quot;,<br>    &quot;--executor-cores&quot;, &quot;3&quot;,<br>    &quot;--num-executors&quot;, &quot;4&quot;,<br>    &quot;--packages&quot;, &quot;software.amazon.s3tables:s3-tables-catalog-for-iceberg-runtime:0.1.4&quot;,<br>    &quot;s3://your-bucket/path_to/create_iceberg_std_to_s3tables.py&quot;,<br>    &quot;--source-table-identifier&quot;, &quot;glue_catalog.&lt;source_database_name&gt;.&lt;source_table_name&gt;&quot;,<br>    &quot;--dest-table-identifier&quot;, &quot;s3tables_catalog.&lt;destination_database_name&gt;.&lt;source_table_name&gt;&quot;,<br>    &quot;--source-warehouse-path&quot;, &quot;s3://source-warehouse-path/&quot;,<br>    &quot;--dest-s3tables-bucket&quot;, &quot;destination-warehouse-path&quot;,<br>    &quot;--aws-region&quot;, &quot;us-east-1&quot;,<br>    &quot;--use-s3tables&quot;<br>  ]<br>}]&#39;</pre><p>Below is how your EMR console would look. You can go to Steps to get into the details. “stdout” is what shows us the logs of our processing. It takes some time for EMR to finish writing logs after a step completes.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*15gsNyfUgu_66XT9Jzj4sA.png" /></figure><p>As you can see, it took around 32 minutes to complete this migration process for hard drive data from 2013 to 2025 with four quarters each (600 million rows total).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/622/1*V5e6AA5bxUpVIKxcttqFow.png" /></figure><h3>Let’s Query our S3 Table Using Athena</h3><p>This query analyzes hard drive reliability by model for Q2 2024 data, showing key performance metrics for each drive model with a significant sample size (&gt;1000 drives). It calculates the total number of drives monitored, failure counts, failure rate percentages, and average storage capacity, then assigns reliability grades based on failure thresholds. The results are ordered by storage capacity (descending) and then failure rate (descending), making it easy to identify which high-capacity drive models performed best or worst in Backblaze’s data centers during that quarter.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*H-RsTU9nLgPqnK7L-hxk5g.png" /><figcaption>As you can see on left, we selected s3tablescatalog as Catalog.</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*HVyUvUnG9D3fFYNlmNAk5A.png" /></figure><h4>What I Observed?</h4><ul><li>Migration speed: 32 minutes to process 600 million rows across 48 partitions (2013–2025, quarterly). The partition-aware approach processed roughly 18.75 million rows per minute.</li><li>Resource usage: c5.4xlarge executors handled the workload comfortably. Memory usage peaked during schema operations but stays within allocated limits.</li><li>Error Recovery: One partition failed due to a transient S3 error. The atomic transaction approach meant only that the partition needed reprocessing, not the entire migration.</li><li>Schema handling: The mergeSchema option successfully reconciled column differences between early Backblaze data (60 cols) and recent quarters (190+ cols).</li><li>Catalog Switching: Once migrated, querying from the S3 Tables catalog felt identical to querying from the Glue Catalog. No application changes needed.</li></ul><p>That covers the practical side of migrating Iceberg data to S3 Tables.</p><blockquote>Each experiment answers one question and raises three more. Some experiments work brilliantly, some fail spectacularly, but all teach me something I didn’t know yesterday. That is exactly how I like it.</blockquote><blockquote>(My cloud bill occasionally disagrees 🫠).</blockquote><blockquote>DARE Continues…</blockquote><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=11677335ead6" width="1" height="1" alt=""><hr><p><a href="https://blog.dataengineerthings.org/dare-1-migrating-iceberg-data-from-s3-to-s3-tables-with-emr-spark-11677335ead6">DARE #1: Migrating Iceberg Data from S3 to S3 Tables with EMR Spark</a> was originally published in <a href="https://blog.dataengineerthings.org/">Data Engineer Things</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Generic Model-Agnostic CNN(GMAN) For Single Image Dehzing]]></title>
            <link>https://medium.com/analytics-vidhya/gman-net-for-image-dehazing-65a2b3f679a5?source=rss-ef2e417d9441------2</link>
            <guid isPermaLink="false">https://medium.com/p/65a2b3f679a5</guid>
            <category><![CDATA[tensorflow]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[deep-learning]]></category>
            <category><![CDATA[kaggle]]></category>
            <category><![CDATA[dehazing]]></category>
            <dc:creator><![CDATA[Sanchit Vijay]]></dc:creator>
            <pubDate>Wed, 30 Sep 2020 11:39:36 GMT</pubDate>
            <atom:updated>2020-10-08T14:46:16.236Z</atom:updated>
            <content:encoded><![CDATA[<h3>Generic Model-Agnostic CNN(GMAN) For Single Image Dehazing</h3><p>Explanation of the paper: “Generic Model-Agnostic Convolutional Neural Network for Single Image Dehazing” by Zheng Liu and implementation of the same in <a href="https://medium.com/u/b1d410cb9700">TensorFlow</a>(version 2+).</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*1CpNH7V8Ru8cm5ROQDo9xg.jpeg" /></figure><h3>Introduction</h3><p>Haze and smog are among the most common environmental factors impacting image quality and, therefore, image analysis. This paper proposes an end-to-end generative method for image dehazing. It is based on designing a fully convolutional neural network to recognize haze structures in input images and restore clear, haze-free images.</p><p>Generic data models are speculations of traditional data models. They characterize normalized general connection types, along with the sorts of things that might be connected by such a connection type.</p><blockquote>Why this method is ‘Agnostic’, let’s answer that.</blockquote><blockquote>Until now all the state-of-the-art(SOTA) methods proposed explores the Atmosphere Scattering(explained below) model. GMAN network is agnostic in the sense that without using the atmosphere scattering model it produced better results than all previous papers using that model.</blockquote><p>You can get the research paper from <a href="https://arxiv.org/abs/1810.02862">here</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*0MFC3OkDGpLD7cKssUs37w.png" /><figcaption><strong>Left:</strong> Hazy image, <strong>Right:</strong> Dehazed image using GMAN</figcaption></figure><h3>Atmosphere Scattering Model</h3><p>The equation used to represent ASM is:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/658/1*kuizBQkGDryS91eOwUvxDQ.png" /><figcaption><a href="https://openaccess.thecvf.com/content_ICCV_2017/papers/Li_AOD-Net_All-In-One_Dehazing_ICCV_2017_paper.pdf">Image Credit</a></figcaption></figure><p>where,<br>I(x): Observed hazy image<br>J(x): Original image<br>A: Global Atmospheric Lighting<br>t(x): Transmission Matrix</p><p><em>A</em> refers to the natural light of the atmosphere across the entire scene.<br><em>t(x)</em> represents the amount of light that reaches the camera from the object.<br>It is calculated as follows:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/328/1*itCwVWi4FN0ng3KPEJlMOw.png" /><figcaption><a href="https://openaccess.thecvf.com/content_ICCV_2017/papers/Li_AOD-Net_All-In-One_Dehazing_ICCV_2017_paper.pdf">Image Credit</a></figcaption></figure><p>Before GMAN all the methods work on getting the parameters A and t(x) to restore the clear image from a hazy image. But it is unlikely that the problem of lossy reconstruction of the original image can be transformed equivalently to an estimation problem for parameters A and t(x) (or their variants), at least when the two problems are subject to the same evaluation metric. Apart from that, the complex relationship between the original and hazy images cannot be just captured by the atmosphere scattering model(ASM). Also using ASM may give good results on synthetically hazed images but it fails to generate desirable outcomes on the naturally hazed images. A solution for this is proposed by the GMAN network.</p><h3>GMAN + Parallel Network Architecture</h3><h4>Let’s start with GMAN</h4><figure><img alt="" src="https://cdn-images-1.medium.com/max/842/1*nE7o6HsOrdUUff3_XJoXyQ.png" /><figcaption><strong>GMAN Architecture(without perceptual loss)</strong></figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/206/1*WPqNf1ykPrSk4QnQMAvKQg.png" /><figcaption>CNN with shortcut connection.</figcaption></figure><p>Functionally addressing, this architecture is composed of an end-to-end generative method which uses an encoder-decoder approach to solve the dehazing problem. The first two layers which input image encounters are convolution blocks with 64 channels. Following them are 2 downsampling blocks(encoder) with stride 2. The encoded image is then fed to a layer build with 4 residual blocks. Each block contained a shortcut connection(same as ResNets). This residual layer helps to understand the haze structures. After these comes the upsampling or deconvolutional (decoder) layer which reconstructs the output of residual layers. The last two layers are convolutional blocks that transform the upsampled feature map into a 3 channel RGB image which finally added to the input image(global residual layer) and then ReLU to give dehazed output. This global residual layer helps in capturing the boundary details of objects with different depths in the scene. The encoder part of architecture helps to decrease the dimension of the image and then fed the downsampled image to the residual layer to extract the image features and the decoder part is expected to learn and regenerate the missing data of the haze-free image.</p><p>In the original paper, there was no parallel network but instead, to improve performance along with mean-squared loss, the perceptual loss was also used but by the same author this parallel network was added later and it performed better than the original architecture with perceptual loss. So I’m not going to a perceptual loss here.</p><h4>Now let’s deal with Parallel Network</h4><figure><img alt="The dilation rate of these blocks are green: 4, blue: 2  and purple: 1" src="https://cdn-images-1.medium.com/max/623/1*LKeCPxyPW6XSZkTRrzQMCQ.png" /><figcaption>Parallel Network, The dilation rate of these blocks are green: 4, blue: 2, and purple: 1</figcaption></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/296/1*rZzC8wZL8oVFREUxr2l4dg.png" /><figcaption>Dilated Convolution with kernel-size 3, dilation rate 2.</figcaption></figure><p>PN architecture is shallower than GMAN but has the same encoder-decoder structure. But what difference it makes is it uses <a href="https://github.com/vdumoulin/conv_arithmetic/blob/master/README.md">dilated convolutions</a>(or convolution with holes) instead of traditional convolutions. The convolutional layer with a larger reception field is not learnable to generate a generalizable feature map. Dilation allows the exponential increase of the reception field without spatial dimensions loss in pixel level. In short, this parallel network helps to capture the details overlooked by the GMAN network. The First 3 layers are encoder blocks with a dilation rate of 4, 2, 2 respectively. Then coming three layers have a dilation rate of 1. Followed by a deconvolution block with dilation rate 4 to transfer the feature maps to their original size. After this comes to the final convolution layer which transforms the image to a 3 channel RGB image. Throughout now all layers have 64 channels except the last one. After this same as GMAN output is added with the original input and passed through the ReLU unit.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/573/1*ISHeGzmrhhL9YVSZL7r4Sw.png" /><figcaption>Combined Network</figcaption></figure><p>Now after all this output of both the networks added to get the final dehazed image. Parameters alpha1 and alpha2 are supposed to be learned by the network itself. Enough of theory now we’ll start with code.</p><h3>Code in <a href="https://medium.com/u/b1d410cb9700">TensorFlow</a> v2.3</h3><h4>You can get the complete code from my <a href="https://github.com/sanchitvj/Image-Dehazing-using-GMAN-net">GitHub</a>.</h4><h4>Preprocessing and loading data</h4><p>This function takes the path to the image and read it and decode it into a uint8 tensor. Then we resize it to 412x548, image size in the dataset is 413x550 but the network function is creating issues because of odd input values. Finally, we normalize it and returns the image in the form of normalized tensors.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/7dd38a4a7131cac7bb5c0a930befd23c/href">https://medium.com/media/7dd38a4a7131cac7bb5c0a930befd23c/href</a></iframe><p>This function takes the path to the original and hazy image then make a split dictionary with keys: ‘train’, ‘val’ with 90% training data and 10% validation data. If you go through the dataset then the original images have a name like ‘0011’ and the corresponding hazy images have a name like ‘0011_0.85_0.2’, so every original image has more than one hazy image where numbers after underscore represent some kind of ratio in which haze is added to the original image. So below function, groups, the original image, and corresponding hazy images and returns them.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/c92986ee1081680932965696e2af6f29/href">https://medium.com/media/c92986ee1081680932965696e2af6f29/href</a></iframe><p>The below function applies the from_tensor_slices() function on the original and hazy image paths of the training set followed by a mapping function that loads the image(load_image). Then after that zip both the training datasets. Do the similar for the validation dataset. Finally return both datasets.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/4b792c84420ed39635d16b1ba190c479/href">https://medium.com/media/4b792c84420ed39635d16b1ba190c479/href</a></iframe><figure><img alt="" src="https://cdn-images-1.medium.com/max/851/1*eLMKd_HyYV6kyz2LRp9BbQ.png" /><figcaption>Hazy, original, and dehazed image.</figcaption></figure><p>We use the below function to display the output of validation data after the training of the individual epoch. It takes a model, hazy, and original image as an argument.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0dca1bf304c3dfd882def5133ec52f7f/href">https://medium.com/media/0dca1bf304c3dfd882def5133ec52f7f/href</a></iframe><h4>Network function</h4><p>Below is the network function. We’ve used Conv2D, Conv2DTranspose to construct this function. First is the GMAN network in which all the layers have several filters as 64 except encoding layers having 128 and the final output layer has 3 channels(RGB). After GMAN, Parallel Network(PN) has dilated convolution layers with all layers having 64 filters except the last one with 3 channels(RGB). I’ve explained architecture in detail above.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/2f0612258804debe700c65e1de4fde0c/href">https://medium.com/media/2f0612258804debe700c65e1de4fde0c/href</a></iframe><h4>Training</h4><p>The best thing I learned from this project is how to custom train a model. Usually fit, predict looks fascinating but the real way of training is this. The below function trains the model. In each epoch, we have a training loop and a validation loop. In the training loop, we take the training data and compute the gradients and apply them to calculate training loss. In the validation loop, we take those gradients computed in that epoch and apply them on validation data to check the output(using display_img function) and validation loss. Finally, we save the model(weights, variables, etc) of that epoch and reset the loss metrics.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/8b48d93656fdde35761a33d7453f5f64/href">https://medium.com/media/8b48d93656fdde35761a33d7453f5f64/href</a></iframe><p>Now before we train our model, we’ll define some hyperparameters. I’m using a batch size of 8 because above that GPU runs out of memory. We are not initializing kernel weights as zero, rather using random normal initialization is providing better results. And to reduce overfitting, L2 regularizer with weight decay of 1e-4 is used. Note that every layer is not having the same kernel initialization, it’s according to the research paper. Finally, call the training function.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/e9e6c3ce1809909f84cba3c524b2311f/href">https://medium.com/media/e9e6c3ce1809909f84cba3c524b2311f/href</a></iframe><h4>Evaluation(Testing)</h4><p>Now I’ve taken some random foggy(naturally hazed) images from google and tested on them, the below function is used for that.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/925eb6498ad54b9b0286cb496082be20/href">https://medium.com/media/925eb6498ad54b9b0286cb496082be20/href</a></iframe><p>One of the test output is shown above and the others are below. You can check the rest <a href="https://github.com/sanchitvj/Image-Dehazing-using-GMAN-net/tree/master/results/test%20results">here</a><strong>. </strong>You can check the validation output <a href="https://github.com/sanchitvj/Image-Dehazing-using-GMAN-net/tree/master/results/validation%20results">here</a>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*KQm319Ie8S0nhzG5_624MQ.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*TgOdTiDT8iTkjjDOVlrW1g.png" /></figure><blockquote>Voila!!! We are done.</blockquote><h3>End Thoughts</h3><p>We have successfully designed an algorithm to dehaze(restore) a hazy image. Key points we’ve learned here are:</p><ul><li>GMAN architecture and research behind the dehazing domain.</li><li>How to custom train a model in <a href="https://medium.com/u/b1d410cb9700">TensorFlow</a>.</li><li>How to deal with dataset in which features and labels both are images.</li></ul><h4>References:</h4><ul><li><a href="https://github.com/Seanforfun/GMAN_Net_Haze_Removal">https://github.com/Seanforfun/GMAN_Net_Haze_Removal</a></li><li>You can get the dataset from here: <a href="https://www.kaggle.com/wwwwwee/dehaze">https://www.kaggle.com/wwwwwee/dehaze</a></li><li>Thanks to <a href="https://medium.com/u/b1d410cb9700">TensorFlow</a>: <a href="https://www.tensorflow.org/guide/keras/writing_a_training_loop_from_scratch">https://www.tensorflow.org/guide/keras/writing_a_training_loop_from_scratch</a></li></ul><p>You can check the <a href="https://www.kaggle.com/sanchitvj/gman-net-for-image-dehazing-using-tf2">Kaggle notebook</a> of this project with output up to 5 epochs. Any suggestions are welcome. Check my other projects on <a href="http://github.com/sanchitvj">GitHub</a>.</p><blockquote>Please clap if you find my work useful.</blockquote><h4>Enjoy Learning!!!</h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=65a2b3f679a5" width="1" height="1" alt=""><hr><p><a href="https://medium.com/analytics-vidhya/gman-net-for-image-dehazing-65a2b3f679a5">Generic Model-Agnostic CNN(GMAN) For Single Image Dehzing</a> was originally published in <a href="https://medium.com/analytics-vidhya">Analytics Vidhya</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Launch Into Machine Learning]]></title>
            <link>https://medium.com/@sanchitvj/launch-into-machine-learning-f1f55d62899?source=rss-ef2e417d9441------2</link>
            <guid isPermaLink="false">https://medium.com/p/f1f55d62899</guid>
            <category><![CDATA[machine-learning]]></category>
            <category><![CDATA[towards-data-science]]></category>
            <category><![CDATA[github]]></category>
            <category><![CDATA[kaggle]]></category>
            <category><![CDATA[artificial-intelligence]]></category>
            <dc:creator><![CDATA[Sanchit Vijay]]></dc:creator>
            <pubDate>Tue, 21 Jul 2020 12:21:25 GMT</pubDate>
            <atom:updated>2020-07-21T12:30:39.105Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ST2aE8ABdNAjix8sd9AFCQ.jpeg" /></figure><p>This is the first time I decided to write something or more specifically express something in the context with the tech world. Through this, I would like to express my journey in the field of Machine Learning. Explicitly it will help enthusiasts to get a pathway.</p><p>For the starters, what excites one to get on board in the ship of machine learning is ample growth in opportunities, exponential development in the field over time, and also money(lots you receive :), hard work needed). What excited me is seeing the fascinating outcome where everything ranging from google keyboard to Amazon Alexa knows what we want to type next or which type of music we usually want to listen to. There’s an algorithm(s) behind making machines responding in such a smarter way. The backbone of these technologies is Artificial Intelligence. Oh, here we encountered a new term Artificial Intelligence(AI). The below image will give you a better understanding of domains.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/560/1*5Q6AKMR2nBZP3sCWbirJ6w.jpeg" /><figcaption>Interrelation of domains</figcaption></figure><p>I hope this image will help you clear your uncertainty in choosing the domain. Here, specifically, we’ll talk about the <em>Machine Learning(ML) subset of AI</em>. In this article, I’m not explaining machine learning, it’s more about how to learn it, which track to go along with.</p><p>Let&#39;s start with essentials.</p><h3>Prerequisites Required</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FQ_ffV8xb25-eTOwStvNmQ.jpeg" /><figcaption>This is a perfect illustration of the pathway to be followed, also at the same time, depicting the mistake people do.</figcaption></figure><p>Basics of Python programming, a basic understanding of calculus, and concepts of Linear Algebra and Statistics.<strong><em> </em></strong>Many students flow in the hype of machine learning don’t follow the path. It’s highly advised by experience(I know a lot of freshers do this) not to do the mistake shown in the pic on left. One thing I want to elucidate that ML is more about mathematics than programming. Programming is assuredly convenient when you go for projects but mathematics is foremost and predominantly required for a strong base. The third step called algorithms is the foundation of machine learning models. To find hidden insights without needing explicit programs, machine learning uses algorithms that learn from previous data to help produce reliable and repeatable decisions. It’s critical to know the iterative part of machine learning, as models can have their very own psyche when presented to new, new data. Machine learning has “revolutionized” the universe of testing, and now, its algorithms can apply complicated mathematical calculations rapidly to enormous arrangements of data effectively and rapidly, on ordinary bases.</p><h3>From Where to Begin</h3><ul><li>For the starters, you have to outset from the Stanford University Machine Learning course by Andrew Ng. This course covers majorly used algorithms in ML with their proper mathematical interpretation, explained in a very intuitive aspect. This course is available on <a href="https://www.youtube.com/watch?v=PPLop4L2eGk&amp;list=PLLssT5z_DsK-h9vYZkQkYNWcItqhlRJLN">YouTube</a> and <a href="https://www.coursera.org/learn/machine-learning">Coursera</a>. I can’t stop myself to say a few words about <a href="https://medium.com/u/592ce2a67248">Andrew Ng</a>. He’s a great competent instructor, and inspiration for all aspirants when it comes to Artificial Intelligence. Below is the frequently said line of him everyone admires a lot :).</li></ul><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_tl2-v9kJ8LzBSEkVGGsyA.jpeg" /></figure><p>In this course, MATLAB is used which nowadays is I consider outmoded for machine learning projects. So, for Python implementation of algorithms and understanding of libraries used you need to learn them separately.</p><ul><li>For learning basic Python there are many platforms and resources accessible, I’m not emphasizing that here. You can learn from anywhere. After basic python, you have to start learning libraries we’ll be using for the implementation of algorithms for practical purposes. Alongside the above(first point) course, you should start learning libraries. The course for this purpose I recommend is <a href="https://www.udemy.com/course/python-for-data-science-and-machine-learning-bootcamp/">Python for Data Science and Machine Learning Bootcamp</a>. This course gives insights on how to use algorithms in making ML models using python libraries. This course is available on <a href="https://medium.com/u/b32aa0132f1b">Udemy</a> and the instructor is <a href="https://medium.com/u/703ff67f629f">Jose Marcial Portilla</a>, proficient and skilled in explaining the approach of the subject.</li><li>After achieving the milestone above, start working on small projects involving real-world datasets for conceding efficient implementation of the concepts acquired. There are many uncomplicated datasets available for novices to practice and employ ML methods. When it comes to operating with datasets, for getting data ready to serve the algorithm we need to prepare the data or more precisely(technical term) preprocess the data. Just like garnishing the food before serving increases the taste of food similarly performing data preprocessing, feature engineering, and visualization helps in analyzing data and increasing the accuracy.</li><li>Datacamp is also an astounding platform for getting insights into machine learning. There are many subcourses available there to make the machine learning model perfect. <a href="https://www.datacamp.com/tracks/machine-learning-scientist-with-python">Machine Learning Scientist</a> is a course that covers all possible foreknowledge. You can get Datacamp premium subscription <a href="https://www.datacamp.com/github-students/">free </a>for 3 months using the <a href="https://medium.com/u/8df3bf3c40ae">GitHub</a> student developer pack.</li><li>For the folks who prefer reading over watching lectures <a href="https://medium.com/u/504c7870fdb6">Medium</a> is a classic spot to explore the charm of ML by reading. <a href="https://towardsdatascience.com/">Towards Data Science</a> and <a href="https://www.analyticsvidhya.com/">Analytics Vidhya</a> are my exclusive preferences. You will discover the explanations by highly experienced individuals on these platforms.</li></ul><h3>Dive into Hands-on</h3><p>An essential part of learning is applying principles in realistic situations. <a href="http://kaggle.com/">Kaggle</a> is a platform for data science competitions where you get all the resources for doing hands-on. Kaggle kernels(notebooks) can be used to train models, the coolest part is we get free GPUs and TPUs used in training Deep Learning models. I started using Kaggle after I had significant experience(around a month) in the field. When you start working on first real-world data you will face situations like how to begin, how to visualize, and analyze data, that’s where the major learning stage starts. In the beginning, I faced the issue’s like I know the libraries but which one to use, what should be the structure or composition of the training model. At this time the best answer is to google it read about the techniques how you can make it work. To be honest, when I was working on my first dataset, I took help from other available kernels. Initially, you will see that different people are using different libraries, there are a lot of options available you need to choose among them and that’s where you start picking up the flow. Whenever I saw a new library or code or error I’m not able to resolve I just copy-pasted it and google, documentations are available, StackOverflow is another buddy ready to help you here.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/992/1*CSsduBJMSnS1dAim3oyUnw.jpeg" /><figcaption>This is true in my case</figcaption></figure><p>By experience, I know there may be a situation where you are stuck or not getting any clue to walk ahead, or you are confused about what to start next, take advice from an endured person or you can ask me. As <strong><em>Elon Musk</em></strong> said:</p><blockquote>“Persistence is very important. You should not give up unless you are forced to give up.”</blockquote><h4>Where to find me</h4><p>Feel free to contact me. Always available to help if you are stuck somewhere in ML drive. I’m active on <a href="https://www.linkedin.com/in/sanchit-vijay-774432178">Linkedin</a>. You can check my <a href="https://github.com/sanchitvj">GitHub </a>for projects related to ML, feel free to send a pull request, and contribute to projects. Here’s my <a href="https://www.kaggle.com/sanchitvj">Kaggle </a>profile link.</p><h4><strong>Happy Learning!!!</strong></h4><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f1f55d62899" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>