<?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 Omprakash Suthar on Medium]]></title>
        <description><![CDATA[Stories by Omprakash Suthar on Medium]]></description>
        <link>https://medium.com/@omprograms0?source=rss-e730be715761------2</link>
        <image>
            <url>https://cdn-images-1.medium.com/fit/c/150/150/1*5Ss0an9AoORVEaMoz8L1uw.png</url>
            <title>Stories by Omprakash Suthar on Medium</title>
            <link>https://medium.com/@omprograms0?source=rss-e730be715761------2</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Tue, 01 Dec 2026 21:41:46 GMT</lastBuildDate>
        <atom:link href="https://medium.com/@omprograms0/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[Apache Airflow Certificate]]></title>
            <link>https://medium.com/@omprograms0/apache-airflow-certificate-bbf79f78f763?source=rss-e730be715761------2</link>
            <guid isPermaLink="false">https://medium.com/p/bbf79f78f763</guid>
            <category><![CDATA[airflow]]></category>
            <category><![CDATA[certification]]></category>
            <category><![CDATA[astronomer]]></category>
            <dc:creator><![CDATA[Omprakash Suthar]]></dc:creator>
            <pubDate>Mon, 18 Nov 2024 18:16:29 GMT</pubDate>
            <atom:updated>2024-11-18T18:16:29.798Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/240/1*QfeGMjZk75eCu4QKC4tFhA.png" /></figure><h3>Overview</h3><p>Apache Airflow is the leading orchestrator for authoring, scheduling, and monitoring data pipelines. It has quickly become an invaluable asset in any data professional’s toolbox.</p><p>Earning an Astronomer Certification for Airflow Fundamentals showcases your mastery of Airflow’s foundational concepts and ability to make well-informed architectural choices, grasp practical use cases, and craft efficient data pipelines.</p><p>Upon successfully passing the exam, you will acquire a digital certification badge that can be proudly showcased on social media (e.g., Linkedin).</p><p><strong>Description</strong></p><p>To pass the Airflow Fundamentals Certification, you must demonstrate an understanding of Airflow’s core concepts, such as architecture, DAGs, the task lifecycle, and the scheduling process. You should be comfortable recommending use cases, architectural needs, settings, and design choices for data pipelines. You should be able to trigger, debug, and retry DAGs (and their associated tasks) and use the correct views in the UI to monitor them.</p><p>At a minimum, it’s recommended that you have:</p><ul><li>At least three months of experience using Airflow</li><li>Completed the Airflow 101 Astronomer Academy course</li></ul><p><strong>Exam Topics</strong></p><p>The exam is designed to assess the following topics:</p><pre>The Airflow UI<br>The Airflow CLI<br>Airflow use-cases<br>Writing, scheduling, and debugging DAGs<br>DAG dependencies<br>DAG runs<br>Airflow architecture components (e.g., Web Server, Scheduler)<br>Basic Operators (e.g., PythonOperator)<br>XCom Basics<br>Connection Basics<br>Variable Basics<br>Sensor Basics</pre><p><strong>Exam details</strong></p><ul><li>Exam format: 75 Multiple-choice questions</li><li>Time allotted: 60 Minutes</li><li>Passing score: 70% (53 corrects out of 75)</li><li>Cost: $150 USD</li><li>Language: English</li></ul><p><strong>Resources</strong></p><ul><li><a href="https://www.astronomer.io/uploads/Apache-Airflow-Fundamentals-Study-Guide.pdf">Study Guide</a></li><li><a href="https://academy.astronomer.io/path/airflow-101">Astronomer Academy Airflow 101</a></li><li><a href="https://docs.astronomer.io/learn">Astronomer Learn</a></li><li><a href="https://airflow.apache.org/docs/">Airflow Documentation</a></li></ul><p><strong>Best Of Luck!!</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bbf79f78f763" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[GCP Professional Data Engineer Certification Exam Guide and Tips]]></title>
            <link>https://medium.com/@omprograms0/gcp-professional-data-engineer-certification-exam-guide-and-tips-452ca0bb3f1a?source=rss-e730be715761------2</link>
            <guid isPermaLink="false">https://medium.com/p/452ca0bb3f1a</guid>
            <category><![CDATA[gcp]]></category>
            <category><![CDATA[google-cloud-platform]]></category>
            <category><![CDATA[gcp-certification]]></category>
            <dc:creator><![CDATA[Omprakash Suthar]]></dc:creator>
            <pubDate>Mon, 18 Nov 2024 18:01:49 GMT</pubDate>
            <atom:updated>2024-11-18T18:01:49.496Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/400/1*MA5XkyhQNyby3Xo41L0TNQ.png" /><figcaption>GCP PROFESSIONAL DATA ENGINEER</figcaption></figure><p>The <strong>Google Cloud Professional Data Engineer Exam</strong> is designed to assess your ability to design, build, and manage robust data processing systems on Google Cloud. Here’s an overview of the exam format:</p><ul><li><strong>Duration:</strong> 2 hours</li><li><strong>Format:</strong> Multiple-choice and multiple-select questions</li><li><strong>Number of Questions:</strong> Typically 50–60</li><li><strong>Delivery Options:</strong> The exam can be taken online (remotely proctored) or at a testing center.</li></ul><p>My exam experience was overall positive. However, I strongly recommend reading each question carefully, as subtle keywords can make one answer stand out as the most accurate, even when multiple options seem correct. Also, be sure to review all of your answers after completing the exam. Take your time while working through the questions, as there is plenty of time to carefully consider each one.</p><h3>Key Updates to the Exam Guide</h3><p>Google has recently updated the <strong>Professional Data Engineer</strong> exam guide. If you plan to take the exam, it’s essential to refer to the new guide to stay aligned with the latest updates on the topics and services covered. The updated exam now features <strong>more realistic, practical questions</strong> with a stronger emphasis on <strong>core Data Engineering</strong> concepts. Notably, Google has moved many questions related to <strong>Data Science</strong> and <strong>Machine Learning</strong> to the newly introduced <strong>Machine Learning Engineer</strong> certification, allowing the Data Engineer exam to focus more squarely on data engineering skills.</p><h3>Important areas for the Exam</h3><ul><li><strong>Designing Data Processing Systems</strong></li><li><strong>Data Ingestion and Preparation</strong></li><li><strong>Data Storage</strong></li><li><strong>Data Analysis</strong></li><li><strong>Automating Workloads</strong></li><li><strong>Monitoring &amp; Alerting Data Systems</strong></li><li><strong>Cost Optimization</strong></li><li><strong>Access Management</strong></li></ul><p>Additionally, the updated exam now incorporates newer Google Cloud tools and services, including <strong>BigQuery Omni</strong>, <strong>Analytics Hub</strong>, <strong>Vertex AI</strong>, <strong>DataPlex</strong>, <strong>DataLake</strong>, and <strong>Redis MemoryStore</strong>.</p><h3>Services to Focus</h3><p><strong>Important Services </strong>for exam preparation:</p><h4>Critical Level-</h4><pre>BigQuery<br>Cloud Storage<br>Pub/Sub<br>Dataproc<br>Cloud SQL<br>Spanner<br>Dataflow<br>Bigtable</pre><p><strong>40-50% of the exam questions</strong> are on above services so it’s crucial to develop a deep understanding of these services. Be sure to familiarize yourself with their features, use cases, and how they integrate with each other on Google Cloud.</p><h4>Mid level -</h4><pre>BigQuery Administration (Slots)<br>Transfer Service<br>Cloud Composer<br>DataFusion<br>DLP API<br>DataPrep<br>Analytics Hub<br>Datastore</pre><p>Few question will be there from above topics.</p><h4>Low Level -</h4><p>Following are the newer services by GCP so 1–2 questions will come from these</p><pre>Big Lake<br>Dataform<br>DataStream<br>Vertex AI<br>DataPlex<br>Monitoring and Alerting</pre><h3>Resources for Google Certified Professional Data Engineer Exam Preparation</h3><h4>Exam Course and Material:</h4><ul><li><strong>A Cloud Guru GCP PDE Course:</strong> This comprehensive course covers both theoretical concepts and practical aspects likely to be tested in the exam. Completing this course typically prepares you for over ~80% of the exam content.</li><li><a href="https://www.pluralsight.com/cloud-guru/courses/google-certified-professional-data-engineer">A Cloud Guru GCP PDE Course</a></li><li><strong>Google Cloud Product Documentation</strong> — <a href="https://cloud.google.com/learn/certification/guides/data-engineer">Google Cloud Data Engineer Certification Guide</a></li></ul><h4>Practice Tests and Mock Exams:</h4><ol><li><strong>ExamTopics — Exam Question Dumps:</strong> Provides practice questions along with discussions where correct answers and justifications are clarified. Some answers may initially be incorrect, but the discussions will provide insights into selecting the best answer. <a href="https://www.examtopics.com/exams/google/professional-data-engineer/view/">ExamTopics — Professional Data Engineer</a></li><li><strong>Practice Exam Sets:</strong></li></ol><ul><li><a href="https://www.whizlabs.com/blog/google-cloud-professional-data-engineer-exam-questions/">Whizlabs — Google Cloud Professional Data Engineer Exam Questions</a></li><li><a href="https://www.udemy.com/course/google-cloud-professional-data-engineer-4-practice-exams/?couponCode=ST3MT72524">Udemy — Google Cloud Professional Data Engineer 4 Practice Exams</a></li><li><a href="https://www.udemy.com/course/google-professional-data-engineer-6-practice-exam-sets-2022/?couponCode=ST3MT72524">Udemy — Google Professional Data Engineer 6 Practice Exam Sets 2022</a></li><li><a href="https://www.passnexam.com/google/professional-data-engineer">Passnexam<strong> </strong>— Practice Questions on passnexam.com</a></li></ul><h4>Additional Resources:</h4><ul><li>For deeper insights into <strong>specific GCP services</strong>, check out <strong>Google’s official documentation</strong>, <strong>Stack Overflow</strong>, and <strong>YouTube tutorials</strong> for step-by-step guides and community discussions.</li></ul><p><strong>Note:</strong></p><ol><li>To increase your chances of passing the exam on your first attempt, practice the mock exams repeatedly until you consistently score above 80%.</li><li>Use the <strong>official Google documentation</strong> to reinforce concepts and gain a deeper understanding of the services covered in the exam.</li></ol><h3>Conclusion</h3><p>I hope this guide and these tips help you as you prepare for the GCP <strong>Professional Data Engineer Exam</strong>. By focusing on the core services, dedicating time to practical experience, and utilizing the right study materials, you’ll be well-equipped to tackle the updated version of the exam with confidence. Please give lots of mock exams to test yourself</p><p><strong>Best of luck !</strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=452ca0bb3f1a" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Partition Tables using CTAS on AWS Athena]]></title>
            <link>https://medium.com/@omprograms0/partition-tables-using-ctas-on-aws-athena-b02e823f1428?source=rss-e730be715761------2</link>
            <guid isPermaLink="false">https://medium.com/p/b02e823f1428</guid>
            <dc:creator><![CDATA[Omprakash Suthar]]></dc:creator>
            <pubDate>Mon, 25 Sep 2023 15:27:45 GMT</pubDate>
            <atom:updated>2023-09-25T15:27:45.191Z</atom:updated>
            <content:encoded><![CDATA[<p><strong>Introduction:</strong></p><p>This document outlines the steps and considerations for implementing a proof of concept (POC) for partitioning a table using the Create Table As Select (CTAS) statement on AWS Athena. Partitioning a table can improve query performance and manageability of large datasets.</p><p><strong>CTAS</strong> (Create Table As Select) is a SQL statement that is used to create a new table by selecting data from one or more existing tables in Athena. The syntax for CTAS in Athena is as follows:</p><pre>CREATE TABLE new_table_name<br>WITH (<br>  [property_name = property_value, ...]<br>)<br>AS<br>SELECT ...<br>FROM ...</pre><ul><li>new_table_name is the name of the new table that will be created.</li><li>property_name and property_value are optional properties that can be set for the new table.</li><li>SELECT … is the query that selects the data from the existing tables that will be used to populate the new table.</li></ul><p>It’s important to note that the new table will have the same columns and data types as the selected columns of the original table.</p><p><strong>Partitioning</strong></p><p>Partitioning in Athena is a method of organising large data sets by splitting it into smaller, more manageable pieces, called partitions. Each partition in an Athena table is a subdirectory in the underlying S3 location, corresponding to a specific set of values for one or more partition keys. Partitioning allows you to limit the amount of data that needs to be scanned when running a query, which can greatly improve query performance and reduce costs.</p><p>Athena supports two types of partitioning:</p><ul><li>Managed partitioning: The table is partitioned automatically by Athena based on the data format (such as Parquet or ORC) and the partition keys specified in the table’s DDL.</li><li>manual partitioning: The data is partitioned in S3 folders following a specific naming convention and the partition keys have to be explicitly specified during table creation.</li></ul><p>You can partition tables on one or more columns and it’s best to partition on columns that are commonly used in the WHERE clause of your queries. Also, you can use partition pruning, which skips the scanning of partitions that do not match the predicates in the query, further improving performance and reducing costs.</p><p>Here is a POC for partitioning on AWS Athena tables:</p><p><strong>Step 1:</strong> Uploaded one sample table data file (sales.csv) in s3 bucket which contains sales data for a retail company.</p><p><strong>Step 2:</strong> Create a table using csv file on Athena with the following command:</p><pre>CREATE EXTERNAL TABLE IF NOT EXISTS `sandbox_db`.`sales` (<br>  `product_id` string,<br>  `store_id` string,<br>  `sales_date` string,<br>  `sales` decimal(20, 2),<br>  `revenue` decimal(20, 2),<br>  `stock` double,<br>  `price` double<br>)<br>ROW FORMAT SERDE &#39;org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe&#39;<br>WITH SERDEPROPERTIES (&#39;field.delim&#39; = &#39;,&#39;)<br>STORED AS INPUTFORMAT &#39;org.apache.hadoop.mapred.TextInputFormat&#39; <br>OUTPUTFORMAT &#39;org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat&#39;<br>LOCATION &#39;s3://cc-datapipes-sandbox-apse1-ingestor-raw/ctas-poc/sales/&#39;<br>TBLPROPERTIES (&#39;classification&#39; = &#39;csv&#39;);</pre><p><strong>Step 3: </strong>Use CTAS (Create Table As Select) to create a partition table from the “sales” table. We can partition the table on the “sales_date” column with year(sales_date). The following command will create a new table named “partitioned_sales” with partition on year(sales_date) column:</p><pre>CREATE TABLE sandbox_db.partitioned_sales WITH (<br>  format = &#39;PARQUET&#39;,<br>  external_location = &#39;s3://cc-datapipes-sandbox-apse1-ingestor-raw/ctas-poc/sales_partitioned&#39;, <br>  partitioned_by = ARRAY[ &#39;yr&#39; ],<br>  write_compression = &#39;SNAPPY&#39;<br>) AS <br>SELECT <br>  product_id, <br>  store_id, <br>  sales, <br>  revenue, <br>  stock, <br>  price, <br>  sales_date, <br>  year(sales_date) as yr <br>FROM <br>  sandbox_db.sales;</pre><p><strong>Note: </strong>Column on which you want to do partition should be at the end of the select statement</p><p>After successful execution of the query we can go to the provided external location s3 path and see the partitions. For our example following partitions are created:</p><pre>SHOW PARTITIONS partitioned_sales;</pre><p><strong>Step 4:</strong> Performance comparison between queries on partitioned and non- partitioned tables</p><p>Non-partitioned table:</p><pre>select SUM(revenue) from sales where year(sales_date)=2018;</pre><p>Partitioned table:</p><pre>select SUM(revenue) from sales where year(sales_date)=2018;</pre><p>You should see a significant difference in performance between the two queries, as the partitioned table allows Athena to skip scanning irrelevant partitions, which results in faster query execution. In case of data that wasn’t partitioned, the whole data set was scanned; however, because of partitioning in the partition table, only 5.78 MB of data was scanned.</p><p><strong>Step 5:</strong> Upload a incremental file to the source folder of sales table, run INSERT INTO command, and see if the incremental data is also partitioned. Make sure to upload the file with the same format and column names as the original file. Existing data contains data for year 2017, 2018, 2019. We will add the data for 2022 year.</p><p>After copying incremental data to the source folder run the following command to insert the incremental data into the “partitioned_sales” table:</p><pre>INSERT INTO partitioned_sales<br>SELECT product_id, <br>  store_id, <br>  sales, <br>  revenue, <br>  stock, <br>  price, <br>  sales_date, <br>  year(sales_date) as yr<br>FROM sales where sales_date&gt;date(&#39;2020-01-01&#39;);</pre><p>After successful execution of run following query to get the partitions:</p><pre>SHOW PARTITIONS partitioned_sales;</pre><p>In the images above, we can see that a new partition has been added for the year 2022 with the value yr=2022.</p><p><strong>Step 6: </strong>Monitor the performance of the partitioned table</p><ul><li>After the POC is complete and the partitioned table is in production, monitor the performance of the table and make adjustments as necessary</li></ul><p>Above demonstration was for normal table which does not support UPDATE, DELETE and MERGE queries for supporting these we will need to use ICEBERG as table type.</p><p><strong>Iceberg table</strong></p><p>Iceberg tables in Athena refer to a table storage format that is optimised for handling large, slowly-changing datasets. The format is based on the Apache Iceberg project, which provides a table format that allows for efficient data management and query performance on large datasets.</p><p>Iceberg tables also allow for efficient data management operations such as adding and deleting data, and updating the schema of a table without having to rewrite the entire dataset. This makes it a good choice for use cases such as data lakes, data warehousing, and analytics on large datasets.</p><p>POC for partitioning on <strong>AWS Iceberg Athena</strong> tables:</p><p><strong>Step 1</strong> and <strong>step 2</strong> are same as above</p><p><strong>Step 3:</strong> Using CTAS to create a Iceberg partition table from the “sales” table. We can partition the table on the “sales_date” column with year(sales_date). The following command will create a new table named “partitioned_sales” with partition on year(sales_date) column:</p><pre>CREATE TABLE iceberg_partitioned_sales WITH (<br>  table_type = &#39;ICEBERG&#39;,<br>  format = &#39;PARQUET&#39;, <br>  location = &#39;s3://cc-datapipes-sandbox-apse1-ingestor-raw/ctas-poc/iceberg_partitioned_sales&#39;, <br>  is_external = false,<br>  write_compression = &#39;SNAPPY&#39;,<br>  partitioning = ARRAY[ &#39;year(sales_date)&#39; ]<br>) AS <br>SELECT <br>  product_id, <br>  store_id, <br>  sales, <br>  revenue, <br>  stock, <br>  price, <br>  sales_date<br>FROM <br>  sandbox_db.sales;</pre><p><strong>Step 4: </strong>Insert, Update, Delete from Iceberg table</p><p><strong>Insert </strong>into Iceberg table by selecting from other table</p><pre>INSERT INTO iceberg_partitioned_sales<br>SELECT <br>  product_id, <br>  store_id, <br>  sales, <br>  revenue, <br>  stock, <br>  price, <br>  sales_date<br>FROM <br>  sandbox_db.sales;<br>  <br>  <br>// Insert into Iceberg table with custom values<br>INSERT INTO iceberg_partitioned_sales (<br>  product_id, store_id, sales, revenue, <br>  stock, price, sales_date<br>) <br>VALUES <br>  (<br>    &#39;O007&#39;, <br>    &#39;OM00&#39;, <br>    25.00, <br>    7000.00, <br>    54.00, <br>    200.00, <br>    date(&#39;2023-02-26&#39;)<br>  );</pre><p><strong>Update</strong> on Iceberg table</p><pre>UPDATE <br>  iceberg_partitioned_sales <br>SET <br>  price = 100.00 <br>WHERE <br>  product_id = &#39;O007&#39; <br>  and sales_date = date(&#39;2023-02-26&#39;)</pre><p><strong>Delete</strong> on Iceberg table</p><pre>DELETE FROM <br>  iceberg_partitioned_sales <br>WHERE <br>  product_id = &#39;O007&#39; <br>  and sales_date = date(&#39;2023-02-26&#39;)<br>  and price = 100.00</pre><p><strong>MERGE </strong>on Iceberg table</p><pre>MERGE INTO iceberg_partitioned_sales target USING (<br>  SELECT <br>    product_id, <br>    store_id, <br>    sales, <br>    revenue, <br>    stock, <br>    price, <br>    sales_date <br>  from <br>    sales <br>  WHERE <br>    product_id = &#39;O007&#39; <br>    and sales_date = date(&#39;2023-02-26&#39;)<br>) source ON target.product_id = source.product_id <br>and target.sales_date = source.sales_date <br>WHEN MATCHED and target.price = 100.00 <br>THEN <br>DELETE <br>WHEN MATCHED and target.price = 200.00<br>THEN UPDATE SET price = 100.00<br>WHEN NOT MATCHED THEN <br>INSERT (<br>    product_id,<br>    store_id,<br>    sales,<br>    revenue,<br>    stock,<br>    price,<br>    sales_date<br>  ) <br>VALUES <br>  (<br>    source.product_id,<br>    source.store_id,<br>    source.sales,<br>    source.revenue, <br>    source.stock,<br>    source.price,<br>    source.sales_date<br>  );</pre><p><strong>Note:</strong> If any non-partitioned tables are utilised in a MERGE query, the complete set of data files can be scanned, which will reduces query efficiency.</p><p><strong>Step 5: </strong>Inserting incremental data into Athena Iceberg table</p><p>Upload a incremental file to the source folder of sales table, run INSERT INTO command, and see if the incremental data is also partitioned. Make sure to upload the file with the same format and column names as the original file. Existing data contains data for year 2017, 2018, 2019, 2022 and with step 4 2023 as well. We will add the data for 2000 year and see if data is there in s3 folder .</p><p>After copying incremental data to the source folder run the following command to insert the incremental data into the “iceberg_partitioned_sales” table:</p><pre>INSERT INTO iceberg_partitioned_sales<br>SELECT <br>  product_id, <br>  store_id, <br>  sales, <br>  revenue, <br>  stock, <br>  price, <br>  sales_date<br>FROM <br>  sandbox_db.sales<br>WHERE year(sales_date) =2000;</pre><p>After successful execution of above query we can see new partition folder is created in S3 data folder of our Iceberg table.</p><p>Note: As of right now Iceberg table manages the table partitions internally hence “SHOW PARTITIONS” is not supported for Athena Iceberg table.</p><p><strong>OPTIMISE Clause in Athena Iceberg table</strong></p><p>Optimises rows in an Apache Iceberg table by rewriting data files into a more optimised layout based on their size and number of associated delete files</p><p>Creating Athena Iceberg table for data of 2017 year by following query</p><pre>CREATE TABLE iceberg_partitioned_sales WITH (<br>  table_type = &#39;ICEBERG&#39;,<br>  format = &#39;PARQUET&#39;, <br>  location = &#39;s3://cc-datapipes-sandbox-apse1-ingestor-raw/ctas-poc/iceberg_partitioned_sales&#39;, <br>  is_external = false,<br>  write_compression = &#39;SNAPPY&#39;,<br>  partitioning = ARRAY[ &#39;year(sales_date)&#39; ]<br>) AS <br>SELECT <br>  product_id, <br>  store_id, <br>  sales, <br>  revenue, <br>  stock, <br>  price, <br>  sales_date<br>FROM <br>  sandbox_db.sales<br>WHERE year(sales_date) =2017<br>OR year(sales_date) =2018;</pre><p>In S3 data folder two partition folders are created</p><p>Selecting all data from the table for year 2017</p><pre>SELECT * FROM &quot;sandbox_db&quot;.&quot;iceberg_partitioned_sales&quot; WHERE year(sales_date) =2017;</pre><p>Inserting more data for year 2017 3 times:</p><pre>INSERT INTO iceberg_partitioned_sales<br>SELECT <br>  product_id, <br>  store_id, <br>  sales, <br>  revenue, <br>  stock, <br>  price, <br>  sales_date<br>FROM <br>  sandbox_db.sales<br>WHERE year(sales_date) =2017;</pre><p>New folders got created for new data with partition year 2017. Now we have four folders with different data for same partition year</p><p>Selecting all data from the table for year 2017</p><pre>SELECT * FROM &quot;sandbox_db&quot;.&quot;iceberg_partitioned_sales&quot; WHERE year(sales_date) =2017;</pre><p>As data increased for our partition the run time also got increased.</p><p>Running OPTIMISE clause for Iceberg table</p><pre>OPTIMIZE iceberg_partitioned_sales REWRITE DATA using BIN_PACK;</pre><p>After successful execution Iceberg created two new folders for both of the partitions years 2017 and 2018 with optimisation. New Snapshots are stored in these two folder and are pointed by the manifest file.</p><p>All files present in different folders for same 2017 year partition are combined together and merged into one file, resulting in faster querying performance.</p><p>Again selecting all data from the table for year 2017</p><pre>SELECT * FROM &quot;sandbox_db&quot;.&quot;iceberg_partitioned_sales&quot; WHERE year(sales_date</pre><p>Run time is reduced after OPTIMISE query.</p><p>Note -If CDC data is larger than 5 GB then after INSERT/ MERGE operation run the OPTIMISE command to optimise files for better and faster access.</p><p><strong>Considerations:</strong></p><ul><li>Partitioning a table on AWS Athena can have an impact on data loading and maintenance. Be prepared to make changes to ETL processes and other scripts that interact with the partitioned table.</li><li>Partitioning a table does not guarantee performance improvements for all queries. Carefully evaluate the impact on specific queries and use cases before committing to partitioning a table.</li><li>Be aware of the size limit of the table partition and take the necessary steps to manage partition size and prevent them from becoming too large.</li></ul><p><strong>Conclusion:</strong> Partitioning a table using the CTAS statement on AWS Athena can improve query performance and manageability of large datasets. Careful planning and testing is necessary to ensure that partitioning a table will bring the desired benefits.</p><p>Useful links:</p><p><a href="https://docs.aws.amazon.com/athena/latest/ug/partitions.html">https://docs.aws.amazon.com/athena/latest/ug/partitions.html</a></p><p><a href="https://docs.aws.amazon.com/athena/latest/ug/ctas.html">https://docs.aws.amazon.com/athena/latest/ug/ctas.html</a> <br><a href="https://docs.aws.amazon.com/athena/latest/ug/querying-iceberg.html">https://docs.aws.amazon.com/athena/latest/ug/querying-iceberg.html</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=b02e823f1428" width="1" height="1" alt="">]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Apache Airflow]]></title>
            <link>https://medium.com/@omprograms0/apache-airflow-f0a1c45b71b?source=rss-e730be715761------2</link>
            <guid isPermaLink="false">https://medium.com/p/f0a1c45b71b</guid>
            <category><![CDATA[best-practices]]></category>
            <category><![CDATA[orchestration]]></category>
            <category><![CDATA[apache-airflow]]></category>
            <category><![CDATA[data-engineering]]></category>
            <dc:creator><![CDATA[Omprakash Suthar]]></dc:creator>
            <pubDate>Sun, 29 Jan 2023 20:24:46 GMT</pubDate>
            <atom:updated>2023-01-29T20:24:46.655Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*FJsMPN5kPMI7JuqhsaP7rA.png" /></figure><p><strong>Basic Introduction with example and best practices</strong></p><p><strong>Introduction:</strong></p><p>What is Apache Airflow?</p><p>Apache Airflow is an open-source platform used for programmatically authoring, scheduling, and monitoring workflows. It provides a way to define, schedule, and orchestrate complex data processing pipelines using directed acyclic graphs (DAGs). Airflow can be used for a variety of use cases such as ETL pipelines, machine learning workflows, and big data processing. It offers a web-based user interface and APIs to manage and monitor workflows, and can be integrated with other tools and technologies like Apache Hadoop, Apache Spark, and more.</p><p><strong>Use Cases:</strong></p><ol><li>ETL pipelines: Airflow can be used to automate the process of extracting data from various sources, transforming it into a desired format, and loading it into a data warehouse.</li><li>Machine learning workflows: Airflow can be used to automate the end-to-end process of training machine learning models and deploying them in production.</li><li>Big data processing: Airflow can be used to automate the processing of large datasets using Apache Spark or Apache Hadoop.</li></ol><p><strong>Example:</strong></p><p>Let’s say you want to automate the process of extracting data from a MySQL database, transforming it into a desired format, and loading it into a data warehouse. You can use Airflow to programmatically author a DAG (Directed Acyclic Graph) that contains tasks for extracting data, transforming it, and loading it. You can also set up scheduling and dependencies between tasks to ensure the data is processed in the correct order.</p><pre>from airflow import DAG<br>from airflow.operators.python_operator import PythonOperator<br>from airflow.operators.dummy_operator import DummyOperator<br>from datetime import datetime, timedelta<br><br>default_args = {<br>    &#39;owner&#39;: &#39;John Doe&#39;,<br>    &#39;start_date&#39;: datetime(2022, 1, 1),<br>    &#39;depends_on_past&#39;: False,<br>    &#39;email_on_failure&#39;: False,<br>    &#39;email_on_retry&#39;: False,<br>    &#39;retries&#39;: 1,<br>    &#39;retry_delay&#39;: timedelta(minutes=5)<br>}<br><br>dag = DAG(<br>    &#39;etl_pipeline&#39;,<br>    default_args=default_args,<br>    description=&#39;An example ETL pipeline using Airflow&#39;,<br>    schedule_interval=timedelta(hours=1),<br>)<br><br>extract_task = PythonOperator(<br>    task_id=&#39;extract_data&#39;,<br>    python_callable=extract_data,<br>    dag=dag<br>)<br><br>transform_task = PythonOperator(<br>    task_id=&#39;transform_data&#39;,<br>    python_callable=transform_data,<br>    dag=dag<br>)<br><br>load_task = PythonOperator(<br>    task_id=&#39;load_data&#39;,<br>    python_callable=load_data,<br>    dag=dag<br>)<br><br>extract_task &gt;&gt; transform_task &gt;&gt; load_task</pre><p><strong>Standard Practices for Apache Airflow:</strong></p><p>1. Naming conventions</p><ul><li>DAG names should be descriptive and all lowercase</li><li>Task names should be descriptive and in CamelCase</li></ul><p>2. Version Control</p><ul><li>Store DAG code in a version control system like Git</li><li>Maintain a clear history of changes and rollback as needed</li></ul><p>3. Environment management</p><ul><li>Use environment variables to separate sensitive information from code</li><li>Store sensitive information like connection strings in Airflow’s metadata database</li></ul><p>4. Security</p><ul><li>Keep credentials and sensitive data encrypted</li><li>Restrict access to the Airflow web server using authentication and authorization</li></ul><p>5. Logging</p><ul><li>Centralize logs in a log aggregator system like ELK Stack</li><li>Use the Airflow Logging API to log messages, errors and debug information</li></ul><p>6. Operational Best Practices:</p><ul><li>Schedule DAGs to run at appropriate times</li><li>Set appropriate retries and SLAs for tasks</li><li>Monitor task performance and adjust concurrency as needed</li><li>Regularly backup the Airflow metadata database</li></ul><p>7. Test and Debugging</p><ul><li>Write automated tests for DAGs and tasks</li><li>Use the Airflow CLI to trigger tasks and debug issues</li><li>Keep track of task run history for troubleshooting purposes</li></ul><p>8. Continuous Integration &amp; Deployment:</p><ul><li>Automate DAG deployment through a CI/CD pipeline</li><li>Use feature branching to develop and test changes to DAG’s in isolation</li></ul><p>9. Maintenance</p><ul><li>Keep Airflow up to date with the latest releases</li><li>Regularly review and clean up inactive or obsolete DAGs</li><li>Monitor the Airflow metadata database for growth and adjust as needed</li></ul><p>Here are some useful resources for learning about Apache Airflow:</p><ol><li>Apache Airflow Documentation: <a href="https://airflow.apache.org/docs/stable/">https://airflow.apache.org/docs/stable/</a></li><li>Airflow tutorial series by Astrid: <a href="https://medium.com/datareply/airflow-tutorial-series-1-how-to-manage-your-data-pipelines-e7b6f1317c2e">https://medium.com/datareply/airflow-tutorial-series-1-how-to-manage-your-data-pipelines-e7b6f1317c2e</a></li><li>Airflow video tutorials by Corey Schafer: <a href="https://www.youtube.com/watch?v=h0tGxLQFgPk&amp;list=PL-osiE80TeTsWmV9i9c58mdDCSskIFdDS">https://www.youtube.com/watch?v=h0tGxLQFgPk&amp;list=PL-osiE80TeTsWmV9i9c58mdDCSskIFdDS</a></li><li>Airflow hands-on tutorials by Google Cloud: <a href="https://cloud.google.com/composer/docs/tutorials">https://cloud.google.com/composer/docs/tutorials</a></li></ol><p>You can also explore the Airflow community for more information and support.</p><p>Thank you,</p><p>Omprakash Suthar.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=f0a1c45b71b" width="1" height="1" alt="">]]></content:encoded>
        </item>
    </channel>
</rss>