<?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[Data Epic - Medium]]></title>
        <description><![CDATA[Data Epic Mentorship - Medium]]></description>
        <link>https://medium.com/data-epic?source=rss----74ea905d0b09---4</link>
        <image>
            <url>https://cdn-images-1.medium.com/proxy/1*TGH72Nnw24QL3iV9IOm4VA.png</url>
            <title>Data Epic - Medium</title>
            <link>https://medium.com/data-epic?source=rss----74ea905d0b09---4</link>
        </image>
        <generator>Medium</generator>
        <lastBuildDate>Sat, 28 Nov 2026 22:46:08 GMT</lastBuildDate>
        <atom:link href="https://medium.com/feed/data-epic" rel="self" type="application/rss+xml"/>
        <webMaster><![CDATA[yourfriends@medium.com]]></webMaster>
        <atom:link href="http://medium.superfeedr.com/" rel="hub"/>
        <item>
            <title><![CDATA[Poetry in Motion: Python’s Dependency Management Tool]]></title>
            <link>https://medium.com/data-epic/poetry-in-motion-pythons-dependency-management-tool-3ba56bbe990f?source=rss----74ea905d0b09---4</link>
            <guid isPermaLink="false">https://medium.com/p/3ba56bbe990f</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[python-poetry]]></category>
            <dc:creator><![CDATA[Madukoma Blessed ]]></dc:creator>
            <pubDate>Mon, 16 Jun 2025 17:39:09 GMT</pubDate>
            <atom:updated>2025-06-16T17:39:09.376Z</atom:updated>
            <content:encoded><![CDATA[<h3>Poetry in Motion: How Python’s Elegantly Crafted Dependency Manager Transforms Development Workflows</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/200/0*zT66T6deguCYv0-u" /></figure><p>As a Python engineer, managing dependencies is often a chore — <em>pip install</em>, <em>pip freeze</em>, <em>virtual environments</em>, and more. However, while attending the <a href="https://linktr.ee/dataepic">DataEpic</a> boot camp (an awesome boot camp; you should apply😉), a resource was shared on dependency management using <a href="https://python-poetry.org/">Poetry</a>, a tool that’s revolutionizing how Python developers handle project dependencies. This article firstly explores the dependency management landscape and problem, how Poetry fixes the issues to streamline project setup, and how to get started with Poetry, bringing a much-needed structure to your Python development workflows. Also, the article concludes by comparing Poetry to other dependency management tools.</p><h3>The Dependency Management Problem</h3><p>Python’s ecosystem has had a fascinating history with dependency management. The standard approach, using <em>pip</em> and the <em>requirements.txt</em> file, while functional, presents several challenges that can hinder development efficiency and project stability.</p><p>The traditional workflow typically involves:</p><ol><li>Creating a virtual environment with <em>venv</em> or <em>virtualenv</em></li><li>Activating the environment</li><li>Installing packages with <em>pip install &lt;package-name(s)&gt;</em></li><li>Freezing dependencies with <em>pip freeze &gt; requirements.txt</em></li><li>Manually managing version conflicts</li></ol><p>Although this approach works, there are a few issues with it:</p><ul><li><em>requirements.txt</em> files don’t differentiate between direct dependencies and sub-dependencies, making it difficult to understand what your project depends on versus what those dependencies require.</li><li>managing development-only dependencies (like testing tools e.g. <em>pytest</em>) becomes cumbersome, often requiring separate requirements files.</li><li>version conflicts often emerge when dependencies have incompatible sub-dependencies, leading to the infamous “<a href="https://www.boldare.com/blog/software-dependency-hell-what-is-it-and-how-to-avoid-it/">dependency hell</a>.”</li></ul><p>These issues compound when working with multiple Python projects simultaneously or collaborating with teams, leading to lost productivity and frustrating debugging sessions.</p><h3>Poetry: A Modern Solution</h3><p>Poetry emerged as a response to these challenges, created by <a href="http://www.sebastien-eustace.fr/">Sébastien Eustace</a> in 2018. Its core philosophy is simple yet powerful: provide a single tool to handle dependency management, packaging, and publishing while ensuring consistency and reproducibility — a very bold claim I must say.</p><p>Unlike traditional Python package management approaches, Poetry welcomes the Python Packaging Authority’s (PyPA) newer standards, specifically the <em>pyproject.toml</em> file format introduced in <a href="https://peps.python.org/pep-0518/">Python Enhancement Proposals (PEP) 518</a>. This shift from <a href="http://setup.py/">setup.py</a> and <em>requirements.txt</em> allows for a more structured approach to handling project dependencies.</p><h4>How is Poetry different?</h4><ol><li>Poetry chose an integrated approach, providing a unified interface for an entire development cycle rather than requiring a collection of separate tools (virtualenv, pip, etc.)</li><li>It handles virtual environments behind the scenes, resolving dependencies to prevent conflicts, and simplifying package publishing to PyPI.</li></ol><p>Poetry has quickly gained adoption among Python developers seeking a more modern, reliable approach to dependency management. Poetry’s design principles emphasize:</p><ul><li><strong>Simplicity</strong>: Commands are intuitive and easy to remember.</li><li><strong>Determinism</strong>: The same dependencies should be installed every time, everywhere.</li><li><strong>Performance</strong>: Dependency resolution is optimized for speed.</li><li><strong>Modularity</strong>: Works well with other Python tools and workflows.</li></ul><h3>Getting Started with Poetry</h3><p>Getting started with Poetry is straightforward, regardless of whether you’re beginning a new project or migrating an existing one. The <a href="https://python-poetry.org/docs">documentation</a> guide is a gold mine.</p><h4>Installation</h4><p>Poetry can be installed using its official installer script, which ensures you get the latest version:</p><pre>curl -sSL https://install.python-poetry.org | python3 -</pre><p>For Windows users, you can run the installer using PowerShell:</p><p><em>PowerShell:</em><br>(Invoke-WebRequest -Uri <a href="https://install.python-poetry.org/">https://install.python-poetry.org</a> -UseBasicParsing).Content | python -</p><p>After installation, verify that Poetry is correctly installed:</p><pre>poetry --version</pre><h4>Creating a New Project</h4><p>To create a new project with Poetry:</p><pre>poetry new my-new-project</pre><p>This command generates a project structure with the following files:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/624/1*I1TImCdEm7aZ91Mfor48vw.png" /></figure><ul><li><em>pyproject.toml</em>: Contains project metadata and dependencies</li><li><em>README.md</em>: Basic readme file</li><li><em>my_new_project</em>: Source directory</li><li><em>tests</em>: Directory for tests</li></ul><h4>Converting an Existing Project</h4><p>For existing projects, navigate to your project directory and initialize Poetry:</p><pre>cd existing-project<br>poetry init</pre><p>If you already have a <em>requirements.txt</em> file, you can import it:</p><p><em>bash</em><br>poetry add $(cat requirements.txt)</p><h4>Basic Configuration</h4><p>A typical <em>pyproject.toml</em> file looks like this:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/875/1*DGjs1lYXgD4-vmpiC3bgRg.png" /><figcaption>A typical pyproject.toml file</figcaption></figure><p>This configuration specifies that your project requires Python 3.13 or newer.</p><h3>Core Features That Make Poetry Shine</h3><p>Poetry’s feature set addresses many pain points in the Python development workflow, making it a great choice for projects of all sizes:</p><ol><li><strong>Dependency Resolution and Management:</strong> Poetry employs a refined dependency resolver that finds compatible versions of all dependencies, including sub and grouped dependencies. When you add a package:</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/684/1*iZMl3wR2gtxE7p89uFOJ9g.png" /><figcaption>Adding a package using Poetry</figcaption></figure><p>Poetry does not just install the latest version; it finds a version compatible with your existing dependencies and Python version. It then updates the <em>pyproject.tom</em>l file and the <em>poetry.lock</em> file, which contains the exact versions of all packages.</p><p>2. <strong>Lock Files for Deterministic Builds:</strong> The <em>poetry.lock</em> file is crucial for ensuring replicable builds. It records the exact version of every package in your dependency tree, along with hashes to verify integrity. When someone else (or a CI system) runs <em>poetry install</em>, they get the same dependencies you have, eliminating “it works on my machine” problems.</p><p>Unlike <em>pip freeze</em>, the lock file distinguishes between your direct dependencies and sub-dependencies, making it easier to understand and maintain your dependency tree.</p><p>3. <strong>Environment Management: </strong>Poetry creates and manages virtual environments automatically. By default, it creates project-specific environments, but you can configure it to use your preferred environment strategy:</p><pre>poetry config virtualenvs.in-project true # Creates venv in .venv directory</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/737/1*jF_QCCVK7X3xJq6MRdzmRg.png" /></figure><p>You can activate the virtual environment using:</p><pre>poetry shell</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/355/1*guz5qLC2JRNhp1H8eV9Swg.png" /></figure><p>Or run commands within the environment without activation:</p><p><em>bash</em></p><pre>poetry run python script.py</pre><p>4. <strong>Seamless Package Publishing: </strong>When your project is ready for distribution, Poetry simplifies the publishing process:</p><p><em>bash</em><br>poetry build <em># Creates source and wheel distributions</em><br>poetry publish <em># Uploads to PyPI</em></p><p>This eliminates the need for separate tools like <em>setuptools</em>, <em>wheel</em>, and <em>twine</em>, streamlining the release process.</p><h3>Practical/Real-World Poetry Workflows</h3><p>Implementing Poetry in real-world scenarios showcases its practical benefits and how it integrates into different development workflows.</p><h4>Grouped vs. Production Dependencies</h4><p>Poetry distinguishes between different types or groups of dependencies such as the main, development, test, etc:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/781/1*AgzoWgCmkTYvTjDa8HGIvQ.png" /><figcaption>grouped dependencies</figcaption></figure><p>When deploying to production, you can install only the main dependencies, keeping production environments clean while giving developers the needed tools</p><h4>Managing Complex Dependency Trees</h4><p>For projects with complex dependencies, Poetry provides tools to understand and manage the dependency tree:</p><pre>poetry show --tree</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bDpYc9OwJCj_OizVqhnjZg.png" /><figcaption>poetry show — tree command in action</figcaption></figure><p>This command visualizes the entire dependency structure, helping you identify potential issues or opportunities for optimization.</p><p>When conflicts arise, Poetry provides clear error messages indicating which packages are incompatible and why, making resolution more straightforward.</p><h4>Team Collaboration Best Practices</h4><p>Poetry helps promote team environment through consistent development experiences:</p><ol><li><strong>Commit both</strong> <em>pyproject.toml</em> and <em>poetry.lock</em> to version control</li><li><strong>Use consistent Poetry versions</strong> across the team (or use the <em>poetry self-update</em> command regularly)</li><li><strong>Agree on virtual environment strategies</strong> using Poetry’s configuration options</li><li><strong>Document workflow conventions</strong> in your project README</li></ol><p>These practices ensure everyone on the team has identical environments, reducing “it works for me” issues and streamlining onboarding.</p><h3>Poetry vs. Other Package Managers</h3><p>Understanding how Poetry compares to alternatives helps choose the right tool for specific projects and workflows:</p><h4>Comparing with pip+venv</h4><p><strong>Pip + venv</strong> is Python’s standard approach:</p><ul><li><strong>Pros:</strong> Universal availability, simplicity for basic needs.</li><li><strong>Cons:</strong> No dependency resolution, manual environment management, separate tools needed for different tasks.</li></ul><p><strong>Poetry</strong> offers a more integrated experience:</p><ul><li><strong>Pros: </strong>All-in-one solution, dependency resolution, lock file for reproducibility.</li><li><strong>Cons:</strong> Additional tool to learn, occasional compatibility issues with very specialized packages.</li></ul><h4>Comparing with Pipenv</h4><p><strong>Pipenv</strong> was an earlier attempt to solve similar problems:</p><ul><li><strong>Pros:</strong> Combined dependency management and virtual environments, has a lock file.</li><li><strong>Cons:</strong> Slower performance, less active development, less intuitive command structure.</li></ul><p><strong>Poetry</strong> generally improves on Pipenv’s model:</p><ul><li><strong>Pros</strong>: Faster dependency resolution, more active development, better Python packaging integration.</li><li><strong>Cons</strong>: Slightly more opinionated about project structure.</li></ul><h4>Comparing with Conda</h4><p><strong>Conda</strong> is a different approach, focusing on scientific computing:</p><ul><li><strong>Pros:</strong> Cross-language package management, binary distribution, excellent for data science.</li><li><strong>Cons:</strong> Separate ecosystem from PyPI, larger overhead, sometimes slower.</li></ul><p><strong>Poetry</strong> remains focused on the Python ecosystem:</p><ul><li><strong>Pros:</strong> Lighter weight, direct PyPI integration, standard Python packaging.</li><li><strong>Cons:</strong> Can’t manage non-Python dependencies, less established in scientific computing.</li></ul><h4>When to Choose Any of the Tools</h4><ul><li>Choose <strong>pip+venv</strong> for: Simple scripts, maximum compatibility, and environments where installing Poetry isn’t possible.</li><li>Choose <strong>Poetry</strong> for: Most Python applications and libraries, team projects, and anything being published to PyPI.</li><li>Choose <strong>Conda</strong> for: Data science work, projects with non-Python dependencies, and scientific computing.</li></ul><p>Many teams adopt Poetry for application development while using Conda and the others for data science workflows, leveraging the strengths of each tool where appropriate.</p><p><strong>Note:</strong> Poetry offers more advanced features such as custom repositories, version constraints, performance optimization, and many more. Check out Poetry’s <a href="https://python-poetry.org/docs/">docs</a> for more information.</p><p>Poetry continues to grow alongside Python’s packaging ecosystem, as the team regularly releases updates addressing community feedback. Poetry fits into Python’s evolving ecosystem with several PEPs aimed at standardizing and improving the dependency and packaging experience:</p><ul><li><a href="https://peps.python.org/pep-0621/">PEP 621</a>: Storing project metadata in <em>pyproject.toml</em></li><li><a href="https://peps.python.org/pep-0631/">PEP 631</a>: Dependency specification in <em>pyproject.toml</em></li><li><a href="https://peps.python.org/pep-0650/">PEP 650</a>: Specifying installer requirements for Python projects</li></ul><h3>Conclusion</h3><p>Poetry has transformed Python dependency management from a necessary chore into a streamlined, reliable process. By combining dependency resolution, virtual environment management, and publishing capabilities into a single tool with an intuitive interface, it addresses longstanding pain points in the Python ecosystem.</p><p>Whether you’re working on small personal projects or large team endeavors, Poetry offers compelling advantages: reproducible builds through lock files, clear separation of development and production dependencies, sophisticated version constraints, and a growing ecosystem of plugins and integrations.</p><p>Give <a href="https://python-poetry.org/docs/">Poetry a try</a> on your next project, and experience firsthand how it can transform your Python development workflow. Your future self (and your team) will thank you.</p><p>I also write more <a href="https://mblessed.hashnode.dev/">blog</a> posts, you can connect on <a href="https://linkedin.com/in/blessed-madukoma">LinkedIn</a> and <a href="https://github.com/blessedmadukoma">GitHub</a> 🚀. Until next time, keep being awesome👋🏿!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=3ba56bbe990f" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-epic/poetry-in-motion-pythons-dependency-management-tool-3ba56bbe990f">Poetry in Motion: Python’s Dependency Management Tool</a> was originally published in <a href="https://medium.com/data-epic">Data Epic</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[SQL RELATIONSHIPS: How to Build Relational Database Models with SQLAlchemy using a…]]></title>
            <link>https://medium.com/data-epic/sql-relationships-how-to-build-relational-database-models-with-sqlalchemy-using-a-acb24cd4eb74?source=rss----74ea905d0b09---4</link>
            <guid isPermaLink="false">https://medium.com/p/acb24cd4eb74</guid>
            <dc:creator><![CDATA[Michael Ayodeji]]></dc:creator>
            <pubDate>Sat, 07 Jun 2025 17:46:45 GMT</pubDate>
            <atom:updated>2025-06-07T17:46:45.392Z</atom:updated>
            <content:encoded><![CDATA[<h3>SQL RELATIONSHIPS: How to Build Relational Database Models with SQLAlchemy using a Student-Course-Teacher Concept</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*oDKingoHLHn4OiVuqzs_Pw.png" /></figure><blockquote>Hey! Are you like me, who likes to grasp the simplicity of a concept before diving into the technicalities? Then I hope this article helps you to fully understand SQL RELATIONSHIPS using SQLAlchemy.</blockquote><h3>Understanding Databases, Schema, SQL, and SQLAlchemy</h3><p><strong>Databases</strong> are collections of data, often structured, that can be easily accessed, updated, and managed by a computer, enabling efficient access and management.</p><p><strong>Relational databases</strong> organize data into related tables (rows and columns), ideal for complex datasets.</p><p><strong>Schema</strong>, In the context of databases, refers to the structured blueprint that defines the organization and relationships of data within a database. It outlines the tables, fields, data types, and relationships between entities, acting as the foundation for data storage and retrieval.</p><p><strong>SQL (Structured Query Language)</strong> is the standard language for creating, reading, updating, and deleting data in these databases.</p><p><strong>SQLAlchemy</strong>, a Python library, simplifies database interaction by providing an Object Relational Mapper (ORM). The ORM allows developers to work with database tables as Python objects, with SQLAlchemy translating these Python operations into the necessary SQL commands. Essentially, SQLAlchemy bridges the gap between Python code and relational databases.</p><h3>Let’s explore how SQL handles relationships using SQLAlchemy, a Python library:</h3><blockquote>Installation:</blockquote><pre>pip install sqlalchemy<br>poetry add sqlalchemy (if you are using poetry to manage your dependencies)</pre><blockquote>In your .py script:</blockquote><pre>from sqlalchemy import create_engine, Column, Integer, String, ForeignKey, Table,<br>from sqlalchemy.orm import relationship, sessionmaker, declarative_base<br><br># 1. Define the database engine (replace with your database URL)<br>DATABASE_URL = &quot;postgresql://your_user:your_password@your_host:your_port/your_database&quot;<br>engine = create_engine(DATABASE_URL)<br><br># 2. Create a session to interact with the database<br>Session = sessionmaker(bind=engine)<br>session = Session()<br><br># 3. Define a base for declarative models<br>Base = declarative_base()<br><br># 4. Define a model (table)<br># This is the part I will be exploring more when creating and explaining relationship models using SQLAlchemy.<br>class User(Base):<br>    __tablename__ = &#39;users&#39;<br>    student_id = Column(Integer, primary_key=True)<br>    student_name = Column(String)<br>    student_email = Column(String)<br><br>    def __repr__(self):<br>        return f&quot;&lt;User(id={self.student_id}, name=&#39;{self.student_name}&#39;, email=&#39;{self.student_email}&#39;)&gt;&quot;<br><br># 5. Create the table in the database<br>Base.metadata.create_all(engine)</pre><blockquote>Have you ever wondered how Netflix knows your favorite genres or how school systems track student enrollments? It’s all about data relationships…</blockquote><h3>Understanding Relationships: Explained Like You’re in High School</h3><p>Let’s imagine a school setting to make this simple.</p><ul><li>A Teacher teaches multiple Courses.</li><li>A Student can enroll in many Courses.</li><li>Each Course has one Teacher, and many Students.</li></ul><p>This setup is exactly what we deal with in databases — objects that relate to each other. Think of tables as different groups of information and relationships as the links between them. SQLAlchemy helps us model these relationships in Python so our apps can understand how things connect.</p><h3>Types of Relationships</h3><blockquote>There are three main types of relationships in databases:</blockquote><h4><strong><em>One-to-One (1:1)</em></strong></h4><p>Set Up: A Student has one locker, and each Locker belongs to one Student.</p><pre># Mother Table<br>class Student(Base):<br>    __tablename__ = &#39;students&#39;<br>    id = Column(Integer, primary_key=True)<br>    name = Column(String, nullable=False)<br>    locker = relationship(&quot;Locker&quot;, uselist=False, back_populates=&quot;student&quot;)<br><br># Child Table<br>class Locker(Base):<br>    __tablename__ = &#39;lockers&#39;<br>    id = Column(Integer, primary_key=True)<br>    number = Column(String, unique=True, nullable=False)<br>    student_id = Column(Integer, ForeignKey(&#39;students.id&#39;))<br>    student = relationship(&quot;Student&quot;, back_populates=&quot;locker&quot;)</pre><ul><li><strong>Very Important</strong>: “uselist” at default is equal to “True” and it is a must to declare “uselist=False” in the mother table which signifies that this is a one-to-one relationship. List can hold more than one datatype(s) at once which is very useful in the next relationship we will talk about.</li></ul><h4><strong><em>One-to-Many (1:N)</em></strong></h4><p>Set Up: One Teacher teaches many Courses. But each Course is taught by one Teacher.</p><pre># Mother Table<br>class Teacher(Base):<br>    __tablename__ = &#39;teachers&#39;<br>    id = Column(Integer, primary_key=True)<br>    name = Column(String, nullable=False)<br>    courses = relationship(&quot;Course&quot;, back_populates=&quot;teacher&quot;)<br>    <br># Child Table<br>class Course(Base):<br>    __tablename__ = &#39;courses&#39;<br>    id = Column(Integer, primary_key=True)<br>    title = Column(String, nullable=False)<br>    teacher_id = Column(Integer, ForeignKey(&#39;teachers.id&#39;))<br>    teacher = relationship(&quot;Teacher&quot;, back_populates=&quot;courses&quot;)</pre><ul><li><strong>Very Important:</strong> “uselist” at default is equal to “True” and you don’t have to declare it. A list can hold more than one data type(s) at once which is very useful in this kind of relationship we are talking about.</li></ul><h4><strong><em>Many-to-Many (N:N)</em></strong></h4><p>In database terms, multiple rows in one table can be related to multiple rows in another table. It is highly important to note that this type of relationship typically requires a “middle man” — <strong>an association table </strong>— to link them.</p><p>Set Up: A Student can enroll in many Courses, and each Course can have many Students.</p><pre># Association Table<br>student_course = Table(&#39;student_course&#39;, Base.metadata,<br>    Column(&#39;student_id&#39;, ForeignKey(&#39;students.id&#39;), primary_key=True),<br>    Column(&#39;course_id&#39;, ForeignKey(&#39;courses.id&#39;), primary_key=True)<br>)<br><br># Mother Table<br>class Student(Base):<br>    __tablename__ = &#39;students&#39;<br>    id = Column(Integer, primary_key=True)<br>    name = Column(String)<br>    courses = relationship(&quot;Course&quot;, secondary=student_course, back_populates=&quot;students&quot;)<br><br># Child Table<br>class Course(Base):<br>    __tablename__ = &#39;courses&#39;<br>    id = Column(Integer, primary_key=True)<br>    title = Column(String)<br>    students = relationship(&quot;Student&quot;, secondary=student_course, back_populates=&quot;courses&quot;)</pre><h4>Common Mistakes and Tips</h4><blockquote>Even experienced developers can trip up on a few common SQLAlchemy relationship issues.</blockquote><p>Here are some quick tips to save you hours of debugging:</p><ol><li><strong>Forgetting back_populates</strong></li></ol><p>This is one of the most common mistakes when setting up bidirectional relationships. Without back_populates, SQLAlchemy doesn’t know how the two sides of the relationship are connected. Always define it on both sides of your relationship if you want automatic synchronization.</p><p>Fix:</p><pre>teacher = relationship(&quot;Teacher&quot;, back_populates=&quot;courses&quot;)<br>courses = relationship(&quot;Course&quot;, back_populates=&quot;teacher&quot;)</pre><p>2<strong>. Misplacing Foreign Keys</strong></p><p>Foreign keys must always be declared on the child table — the table that holds the reference to the other.</p><p>Don’t do this: Placing <strong><em>ForeignKey(‘courses.id’)</em></strong> in <strong><em>Teacher</em></strong>.</p><p>Do this: Place <strong><em>ForeignKey(‘teachers.id’)</em></strong> in <strong><em>Course</em></strong>, because each course belongs to one teacher.</p><p>3. <strong>When to Use secondary</strong></p><p><strong><em>secondary</em></strong> is only needed for many-to-many relationships using an association table. If you try to use it in a one-to-many or one-to-one, you’ll likely get unexpected behavior.</p><p>Use it only like this:</p><pre>relationship(&quot;Course&quot;, secondary=student_course, back_populates=&quot;students&quot;)</pre><p>And remember: association tables don’t need to be models themselves unless they have extra data like timestamps or grades.</p><h4>Conclusion</h4><p>SQLAlchemy makes handling relationships between tables simple and readable. Whether you’re building a school system or a big tech app, modeling relationships helps you structure your data effectively.</p><p>To recap:</p><ul><li>One-to-One: One student, one locker.</li><li>One-to-Many: One teacher, many courses.</li><li>Many-to-Many: Many students in many courses.</li></ul><p>Think of your database as a social network of data — each table is a person, and relationships are the connections. With SQLAlchemy, you’re basically designing that network using Python. Happy learning!</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/0*JXyq9SEKb9Y7_Auf" /><figcaption>Photo by <a href="https://unsplash.com/@frank_romero?utm_source=medium&amp;utm_medium=referral">Frank Rolando Romero</a> on <a href="https://unsplash.com/?utm_source=medium&amp;utm_medium=referral">Unsplash</a></figcaption></figure><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=acb24cd4eb74" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-epic/sql-relationships-how-to-build-relational-database-models-with-sqlalchemy-using-a-acb24cd4eb74">SQL RELATIONSHIPS: How to Build Relational Database Models with SQLAlchemy using a…</a> was originally published in <a href="https://medium.com/data-epic">Data Epic</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[End-to-End Near-Real-Time Data Engineering Project Using AWS Services Part 2]]></title>
            <link>https://medium.com/data-epic/end-to-end-near-real-time-data-engineering-project-using-aws-services-part-2-09be1533952a?source=rss----74ea905d0b09---4</link>
            <guid isPermaLink="false">https://medium.com/p/09be1533952a</guid>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[sammygis]]></dc:creator>
            <pubDate>Fri, 30 May 2025 08:26:06 GMT</pubDate>
            <atom:updated>2025-07-30T23:09:40.044Z</atom:updated>
            <content:encoded><![CDATA[<h4>Building a Data Pipeline with AWS Lambda and Firehose</h4><h3>Introduction</h3><p>In this project, we will discuss the end to end deployment of our data pipeline. In the first part, we explored the system. Here, our data source is an API. We need a system that runs the API and sends data to <strong>Firehose</strong>. For this task, we use <strong>AWS Lambda</strong> — a serverless cloud tool. While it has its limitations and advantages, it is <em>perfect for this project</em>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SQ5apPTRf-r-dJ58nDgQpg.jpeg" /></figure><h3>Setting up the Producer with AWS Lambda</h3><p><strong>AWS Lambda</strong> will serve as our <em>producer</em>, collecting data from the API. Since the API refreshes every 5 minutes, we will also set a <strong>trigger</strong> to automatically execute the Lambda function at the same interval.</p><h3>Steps to Create the Lambda Function</h3><ol><li>Go to the AWS homepage.</li><li>Search for <strong>Lambda</strong> and open the service.</li><li>Click on <strong>Create function</strong></li><li>Select <strong>Author from scratch</strong>.</li><li>Provide a function name.</li><li>Choose <strong>Python</strong> as the runtime.</li><li>Leave the execution role as default (it will create a basic Lambda role).</li><li>Click <strong>Create Function</strong>.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*htGOu_qiTv8FI_70I25RUg.png" /></figure><p>The newly created function (e.g., dp-producer) will now be ready for scripting.</p><h3>Lambda Producer Script</h3><blockquote><em>We implemented a CI/CD pipeline using GitHub. Every time changes are pushed to the connected repository, Lambda updates automatically. For details, check the project repo or explore </em><a href="https://www.youtube.com/watch?v=ekNhTHtIT1k"><em>CI/CD setup tutorials.</em></a></blockquote><p>Below is the producer code:</p><pre>import urllib.request<br>import urllib.parse<br>import boto3<br>import json<br>import os<br><br><br>def lambda_handler(event, context):<br>    API_KEY = os.getenv(&quot;API_KEY&quot;)<br>    STOCKS = [&#39;TSLA&#39;, &#39;NVDA&#39;]<br>    FIREHOSE_STREAM = &quot;stock_data_data_stream&quot;<br>    <br>    firehose = boto3.client(&#39;firehose&#39;)<br>    records = []<br>    <br>    for symbol in STOCKS:<br>        url = f&quot;https://alpha-vantage.p.rapidapi.com/query?function=TIME_SERIES_INTRADAY&amp;symbol={symbol}&amp;interval=1min&amp;output_size=compact&amp;datatype=json&quot;<br>        headers = {<br>            &quot;x-rapidapi-key&quot;: API_KEY,<br>            &quot;x-rapidapi-host&quot;: &quot;alpha-vantage.p.rapidapi.com&quot;<br>        }<br>        try:<br>            req = urllib.request.Request(url, headers=headers)<br>            with urllib.request.urlopen(req) as response:<br>                data = json.loads(response.read().decode(&#39;utf-8&#39;))<br>                for timestamp, values in data.get(&#39;Time Series (1min)&#39;, {}).items():<br>                    record = {<br>                        &quot;symbol&quot;: symbol,<br>                        &quot;timestamp&quot;: timestamp,<br>                        &quot;open&quot;: float(values[&quot;1. open&quot;]),<br>                        &quot;high&quot;: float(values[&quot;2. high&quot;]),<br>                        &quot;low&quot;: float(values[&quot;3. low&quot;]),<br>                        &quot;close&quot;: float(values[&quot;4. close&quot;]),<br>                        &quot;volume&quot;: int(values[&quot;5. volume&quot;])<br>                    }<br>                    records.append({&#39;Data&#39;: json.dumps(record)})<br>        except Exception as e:<br>            print(f&quot;Error processing {symbol}: {str(e)}&quot;)<br>            continue<br>    <br>    if records:<br>        firehose.put_record_batch(<br>            DeliveryStreamName=FIREHOSE_STREAM,<br>            Records=records<br>        )<br>    <br>    return {<br>        &#39;statusCode&#39;: 200,<br>        &#39;body&#39;: f&quot;Processed {len(records)} records&quot;<br>    }</pre><blockquote><strong><em>Note:</em></strong></blockquote><blockquote><em>We use </em><em>boto3 to connect to Firehose. The API key is stored as an environment variable in Lambda’s </em>Configuration<em> tab.</em></blockquote><blockquote><em>We format the raw JSON into a Firehose-friendly structure to avoid common issues like Duplicates ID or Missing IDs.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*XrTVXcflZ4eqePeBoZ08hg.png" /></figure><h3>Setting a Trigger Using EventBridge</h3><ol><li>In the Lambda console, select <strong>Add Trigger</strong>.</li><li>Choose <strong>EventBridge (CloudWatch Events)</strong>.</li><li>Create a new rule: Name your rule.</li></ol><p>In <strong>Rule Type</strong>, select <em>Schedule expression</em>.</p><p>Use cron expression: cron(* * * * ? *) (runs every 1 minute). <a href="https://crontab.guru/"><em>You can use crontab.guru to learn more about cron expressions.</em></a></p><figure><img alt="" src="https://cdn-images-1.medium.com/max/979/1*Ax-hxI4iAZxSW5KedVNqKw.png" /></figure><h3>Creating the Transformation Function</h3><p>Now, let’s create another function called dp-transform-data to transform data before it’s stored.</p><pre>import base64<br>import json<br>import logging<br>from datetime import datetime<br><br>logger = logging.getLogger()<br>logger.setLevel(logging.INFO)<br>def lambda_handler(event, context):<br>    output = []<br>    logger.info(f&quot;Received event: {json.dumps(event)}&quot;)<br>    <br>    for record in event[&#39;records&#39;]:<br>        try:<br>            logger.info(f&quot;Processing recordId: {record[&#39;recordId&#39;]}&quot;)<br>            decoded_data = base64.b64decode(record[&#39;data&#39;]).decode(&#39;utf-8&#39;)<br>            payload = json.loads(decoded_data)<br>            dt = datetime.strptime(payload[&#39;timestamp&#39;], &quot;%Y-%m-%d %H:%M:%S&quot;)<br>            transformed = {<br>                &#39;symbol&#39;: payload[&#39;symbol&#39;],<br>                &#39;datetime&#39;: payload[&#39;timestamp&#39;],<br>                &#39;open&#39;: payload[&#39;open&#39;],<br>                &#39;high&#39;: payload[&#39;high&#39;],<br>                &#39;low&#39;: payload[&#39;low&#39;],<br>                &#39;close&#39;: payload[&#39;close&#39;],<br>                &#39;volume&#39;: payload[&#39;volume&#39;],<br>                &#39;date&#39;: dt.date().isoformat(),<br>                &#39;hour&#39;: dt.hour<br>            }<br>            encoded_data = base64.b64encode(json.dumps(transformed).encode(&#39;utf-8&#39;)).decode(&#39;utf-8&#39;)<br>            output.append({<br>                &#39;recordId&#39;: record[&#39;recordId&#39;],<br>                &#39;result&#39;: &#39;Ok&#39;,<br>                &#39;data&#39;: encoded_data,<br>                &#39;metadata&#39;: {<br>                    &#39;partitionKeys&#39;: {<br>                        &#39;symbol&#39;: payload[&#39;symbol&#39;],<br>                        &#39;date&#39;: dt.date().isoformat(),<br>                        &#39;hour&#39;: dt.hour<br>                    }<br>                }<br>            })<br>        except Exception as e:<br>            logger.error(f&quot;Error processing record {record[&#39;recordId&#39;]}: {str(e)}&quot;, exc_info=True)<br>            output.append({<br>                &#39;recordId&#39;: record[&#39;recordId&#39;],<br>                &#39;result&#39;: &#39;ProcessingFailed&#39;,<br>                &#39;data&#39;: record[&#39;data&#39;],<br>                &#39;message&#39;: str(e)<br>            })<br>    logger.info(f&quot;Returning {len(output)} records&quot;)<br>    return {&#39;records&#39;: output}</pre><blockquote><em>This function handles </em>transformation<em> and returns partition keys (</em><em>symbol, </em><em>date, </em><em>hour) for scalable storage.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/975/1*PGsYwFsDQIu0ihlC2fT95w.png" /></figure><h3>Creating Firehose Stream</h3><ol><li>Go to <strong>Amazon Kinesis &gt; Firehose</strong>.</li><li>Click <strong>Create delivery stream</strong>.</li><li>Choose: <strong>Source</strong>: Direct PUT. <strong>Destination</strong>: Amazon S3</li><li>Select the <strong>dp-transform-data</strong> function to transform records.</li><li>Use <strong>Parquet</strong> as the output format (for performance and efficiency).</li><li>Enable <strong>Dynamic Partitioning</strong>.</li><li>Buffer size = 1MB, Buffer interval = 30 seconds. These settings are optimized based on expected data volume.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/979/1*QN6Z3qudjJ2UBmctdLz-eg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/979/1*lqFGMYgG5lr325aF-ey6xA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/979/1*oKcj57Kfz2Vlrqn9CSfBvQ.png" /></figure><p>So in this process, we want to transform our data before it drops into the S3 bucket. We would also like to keep the raw data.</p><p>Click <strong>Browse</strong> and select the the dp-producer function we created earlier. Leave the buffer size at <strong>1MB</strong> — this is based on the expected data volume. The <strong>buffer interval</strong> defines the time before the function runs after being triggered. This means the function doesn’t execute immediately; it waits up to <strong>30 seconds</strong>.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/979/1*iCslYnXXzxaNR2Mv5grVJg.png" /></figure><p>We want to save our data as <strong>Parquet</strong> due to its advantages over other formats. To understand why, read this article: <a href="https://medium.com/@aiiaor/which-data-file-format-to-use-csv-json-parquet-avro-orc-e7a9acaaa7df">which-data-file-format-to-use-csv-json-parquet-avro</a></p><p>Set up the transformation Lambda function and connect it to Firehose. Proceed to create a delivery stream with transformation enabled and ensure dynamic partitioning is activated.</p><h3>Creating Glue Data Catalog</h3><p>To catalog the data, we create a Glue database and table.</p><ol><li>Go to <strong>AWS Glue &gt; Data Catalog &gt; Tables</strong>.</li><li>Click <strong>Add Table</strong>.</li><li>Create a <strong>new database</strong>.</li><li>Select <strong>S3</strong> as the data store (your S3 bucket for final transformed data).</li><li>Set format to <strong>Parquet</strong>.</li><li>Manually add the schema fields to match the transformed output.</li></ol><blockquote><em>Ensure field names match exactly to avoid ingestion issues.</em></blockquote><figure><img alt="" src="https://cdn-images-1.medium.com/max/979/1*UURhG0UypGpvULrhTQA1zg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/877/1*D_qZG57YR3LarjnAQU7Ecg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/876/1*kx3Pk3nCHCn9t0O60mKNqA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/794/1*UqMObrT1ZKWbW_RjEh2a_g.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/979/1*aHxsADqmPy_luPZgz-kaxg.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/765/1*psCrR0xENvc7bSKTOEZuww.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/667/1*y4nEn4qqi_8opoTVRyrpUg.png" /></figure><p>We selected <strong>Apache Parquet</strong> as the output format. Since Parquet is a columnar format that supports schema definition, we need to define a proper schema. To do this, we must create a <strong>Glue table</strong> and a <strong>Glue database</strong>. If you’ve already created them, you can simply browse and select them during setup.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/979/1*pfcfcMaoBC_KHrpAKuUgeA.png" /></figure><h3>Setting Firehose Final Destination</h3><p>We have selected <strong>dynamic partitioning</strong>, which means the data will be partitioned based on specific column headers. These columns have already been defined in the <strong>partitionKeys</strong> metadata returned by the transformation Lambda function. However, we still need to explicitly specify them in the Firehose configuration. Once that’s done, you can save your Firehose stream — completing the setup successfully.</p><ol><li>Select your S3 bucket.</li><li>Choose <strong>JSON</strong> format.</li><li>Enable: <strong>Dynamic Partitioning and Multi-record deaggregation</strong></li><li>Do <strong>not</strong> enable delimiters (JSON format does not use them).</li><li>Define partition keys (symbol, date, hour) as specified in the transformation Lambda.</li><li>Click <strong>Save</strong> — your Firehose stream is now complete.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/979/1*XAHi-TEpkYqM4T-izI4PxA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/979/1*4HEWaCuX4tYOxWfANNwjZA.png" /></figure><h3>Bonus: Querying Data with Athena</h3><p>You can query the transformed and stored data in S3 using <strong>Amazon Athena</strong>.</p><ol><li>Go to <strong>Amazon Athena</strong>.</li><li>Connect to the Glue Catalog where your table resides.</li><li>Query using SQL.</li></ol><figure><img alt="" src="https://cdn-images-1.medium.com/max/979/1*F5vGMKJGS-CLznCO1GRoRA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/979/1*AcH6W8SNvXmueR9S4Vx0vA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/979/1*kWDOxrYpVuZqoQtzUFXoZA.png" /></figure><figure><img alt="" src="https://cdn-images-1.medium.com/max/979/1*UgJtDKiJDzRKpgzJJqm42g.png" /></figure><blockquote><em>To connect Athena to Power BI Desktop, watch this tutorial:<br>🎥 </em><a href="https://www.youtube.com/watch?app=desktop&amp;v=FKdCr6vmq-o"><em>Power BI + Athena Integration</em></a></blockquote><p><strong>Important:</strong> Ensure that all resources — including Glue, S3, Lambda, and Firehose — are created in the same AWS region. This consistency is essential for seamless integration and to avoid region-related errors.</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=09be1533952a" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-epic/end-to-end-near-real-time-data-engineering-project-using-aws-services-part-2-09be1533952a">End-to-End Near-Real-Time Data Engineering Project Using AWS Services Part 2</a> was originally published in <a href="https://medium.com/data-epic">Data Epic</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[End-to-End Near-Real-Time Data Engineering Project Using AWS Services Part 1]]></title>
            <link>https://medium.com/data-epic/end-to-end-near-real-time-data-engineering-project-using-aws-services-part-1-47bf44a5d84b?source=rss----74ea905d0b09---4</link>
            <guid isPermaLink="false">https://medium.com/p/47bf44a5d84b</guid>
            <category><![CDATA[data-engineering]]></category>
            <category><![CDATA[etl]]></category>
            <category><![CDATA[aws]]></category>
            <category><![CDATA[kinesis]]></category>
            <category><![CDATA[firehose]]></category>
            <dc:creator><![CDATA[sammygis]]></dc:creator>
            <pubDate>Fri, 30 May 2025 08:23:12 GMT</pubDate>
            <atom:updated>2025-05-30T08:23:12.581Z</atom:updated>
            <content:encoded><![CDATA[<p>This article will be a two-part series. In the first part, we will discuss the workflow, while in the second part, we’ll walk through the entire process and set everything up. 🌟</p><h4>Project Overview:</h4><p>In this project, we will set up an <strong>end-to-end real-time data pipeline</strong> using <strong>AWS Kinesis Data Firehose</strong>. The goal is to ingest data from an API, process it in real-time, store it in <strong>Amazon S3</strong>, and query it using <strong>Amazon Athena</strong> for analytics.</p><h4>Part 1: Understanding the Project and Data Flow Design</h4><p>In this first part of the series, we will break down the project, discuss the overall architecture, and understand the flow of data through the system. This will give you a clear understanding of how the various components come together before we dive into setting up the system. Here’s how we will set it all up:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*SQ5apPTRf-r-dJ58nDgQpg.jpeg" /></figure><ol><li><strong>Python and Boto3 for Data Fetching and Transformation</strong>:<br> We will use <strong>Python</strong> and the <strong>Boto3</strong> library to fetch, transform, and interact with the data stored on AWS and GitHub. <strong>Boto3</strong> will allow us to interact with AWS services like <strong>S3</strong>, <strong>Kinesis Firehose</strong>, <strong>Lambda</strong>, and more. Python will be used to handle data transformations (e.g., cleaning, parsing) before sending it through the pipeline. We will also use Python for automating interactions with the <strong>GitHub repository</strong>, ensuring that the CI/CD pipeline is connected to the right resources and code changes</li><li><strong>CI/CD Integration with GitHub Actions</strong>:<br>To automate the deployment and management of our Lambda functions, Kinesis Data Firehose, and other resources, we will set up <strong>GitHub Actions</strong> for CI/CD. This will allow us to trigger workflows whenever changes are pushed to our GitHub repository. The CI/CD pipeline will automatically deploy Lambda functions and update configurations on AWS, streamlining the process of managing and updating the system.</li><li><strong>Data Ingestion with Lambda</strong>:<br>We will set up a <strong>Lambda function</strong> as the <strong>data producer</strong>, which will fetch data from the <strong>Alpha Vantage API</strong> at a defined frequency (1-minute interval). This ensures that we have near real-time data coming into the pipeline.</li><li><strong>Event Triggering with EventBridge</strong>:<br> To automate the data ingestion, we will use <strong>Amazon EventBridge</strong> to trigger the Lambda function based on the defined frequency. EventBridge will schedule and manage the Lambda function execution at set intervals, ensuring continuous data retrieval without manual intervention.</li><li><strong>Sending Data to Kinesis Data Firehose</strong>:<br> The Lambda function will send the ingested data to <strong>Kinesis Data Firehose</strong>. Kinesis Firehose is a fully managed service that makes it easy to load real-time data streams into AWS services like <strong>S3</strong>, <strong>Redshift</strong>, <strong>Elasticsearch</strong>, and more. It allows us to stream the data directly without worrying about scaling or managing the infrastructure behind it.</li><li><strong>Backup of Raw Data in S3</strong>:<br> Once the data is streamed through <strong>Kinesis Data Firehose</strong>, it will be stored in <strong>Amazon S3</strong>. This acts as a backup of the raw data, preserving all incoming records for later use. You can configure Firehose to deliver data in batches or continuously, depending on your requirements.</li><li><strong>Data Transformation with Lambda</strong>:<br> After the data is sent to Firehose, we will use <strong>AWS Lambda</strong> for <strong>on-the-fly data transformation</strong>. This step allows us to modify, clean, or format the data before it is stored in S3. For example, we might convert data formats, remove irrelevant fields, or apply specific logic to prepare the data for analysis.</li><li><strong>Dynamic Partitioning in S3</strong>:<br> As the data is transformed, we will store it in <strong>dynamically partitioned files in S3</strong>. Partitioning the data based on time (e.g., by year, month, day) or other attributes helps improve query performance, scalability, and makes it easier to manage large datasets.</li><li><strong>Schema Definition with AWS Glue</strong>:<br> To make the data accessible for querying, we will use <strong>AWS Glue</strong> to define a <strong>Data Catalog</strong> and create a <strong>Glue Table</strong> that describes the data schema. This metadata helps <strong>Amazon Athena</strong> interpret and query the data efficiently. Glue will automatically discover and catalog the schema from the data stored in S3.</li><li><strong>Analytics with Athena</strong>:<br> Once the data is in S3 and cataloged by Glue, you can use <strong>Amazon Athena</strong> to perform SQL-based queries directly on the data in S3. Athena provides serverless, ad-hoc querying capabilities without the need for provisioning any infrastructure.</li></ol><h4>Additional Components:</h4><p><strong>11. Log Monitoring with CloudWatch</strong>:<br> For real-time monitoring and debugging, we will integrate <strong>AWS CloudWatch</strong> to view logs for the Lambda functions and Kinesis Data Firehose. CloudWatch will capture logs and metrics, allowing us to track the performance and status of each component in the pipeline. This will also help us identify any errors or issues in the data processing and ingestion flow.</p><p>When it comes to real-time processing, there are many tools both open and closed source, that offer different advantages and disadvantages. One of the main challenges with setting up open-source pipelines is the complexity involved in configuring the system. Tools like <strong>Kafka</strong> and <strong>Redpanda</strong> are examples of open-source technologies that can be used to build real-time data pipelines. However, new users often find it challenging to set up and manage these systems effectively.</p><p><strong>AWS</strong> provides managed services that simplify real-time data processing. Two of the main services are <strong>Kinesis Data Streams</strong> and <strong>Kinesis Data Firehose</strong>. Both have their strengths and limitations, but for our use case, we will be leveraging <strong>Kinesis Data Firehose</strong>.</p><h3>Why choose Kinesis Data Firehose over Kinesis Data Streams?</h3><p>Kinesis Data Firehose is a <strong>near real-time</strong> processing service with a typical latency of about <strong>60 seconds</strong>. On the other hand, Kinesis Data Streams offers <strong>lower latency</strong>, around <strong>50 milliseconds</strong>. While Streams provide finer control and faster delivery, <strong>Firehose is much easier to set up</strong>, making it more suitable for beginners or for use cases that don’t require ultra-low latency.</p><p>Another important consideration is the level of management required. Kinesis Data Streams is not fully managed, which means you’re responsible for provisioning infrastructure, managing scaling, handling sharding, and configuring data retention policies. This adds operational complexity and requires ongoing tuning to match workload demands.</p><p>On the other hand, Kinesis Data Firehose is a fully managed service that automates scaling, batching, error handling, and data delivery to destinations such as S3, Redshift, or OpenSearch. It also manages data retention internally without user intervention. Firehose’s built-in support for dynamic partitioning, data transformation using AWS Lambda, and data format conversion (e.g., JSON to Parquet or ORC) makes it especially suited for streamlined, production-ready data pipelines with minimal setup and maintenance.</p><p>In this project, we will set up a <strong>Kinesis Data Firehose</strong> system to process our data, store raw data in <strong>S3</strong>, process data with lambda, query it with <strong>Athena</strong>, and create a <strong>Kinesis Firehose</strong> connector that streams data from the API endpoint.</p><h3>Why Firehose for this project?</h3><p>The data we are using comes from the <strong>Alpha Vantage API</strong>, which was created on RapidAPI. I created the free <a href="https://rapidapi.com/alphavantage/api/alpha-vantage"><strong>API access</strong></a>, and the API offers multiple refresh frequency options: 1 minute, 5 minutes, 10 minutes, and 16 minutes. For our use case, we decided to go with the <strong>1-minute frequency</strong>. Since this is <strong>near real-time data</strong>, <strong>Kinesis Data Firehose</strong> is the best choice for our pipeline because of its ease of setup, scalability, and near real-time processing.</p><h3>Costing with Kinesis Data Firehose</h3><p>When it comes to the <strong>cost of Firehose</strong>, it depends on several factors, such as:</p><ul><li><strong>Data Ingestion</strong>:<br> You are charged based on the amount of data you send to <strong>Kinesis Data Firehose</strong>. The pricing is generally based on the volume of data ingested (per GB) and any additional features, such as encryption, enabled for the stream. Ensure to estimate the volume of data you expect to send to optimize costs.</li><li><strong>Data Transformation</strong>:<br> If you perform data transformation using <strong>AWS Lambda</strong> before delivery, there may be additional costs. Lambda charges are based on the amount of compute time consumed (in GB-seconds) and the number of invocations. For example, you are billed for every 1ms of execution time and the amount of memory allocated to the Lambda function.</li><li><strong>Data Delivery</strong>:<br> The destination you choose for your data (such as <strong>Amazon S3</strong>, <strong>Redshift</strong>, <strong>Elasticsearch</strong>, etc.) will have its own associated costs for storage, data transfer, or querying, for example <strong>Amazon S3</strong>: Charges are based on the volume of data stored and the amount of data transferred out of S3 and etc.</li></ul><p><strong><em>In this project, the Firehose delivery stream ingests approximately 100 records per minute, with each record sized at 5 KB. This results in 500 KB of data per minute. Over one hour, that equals 30 MB, and over a 30-day month, the total ingested data adds up to approximately 21.6 GB. AWS Kinesis Data Firehose pricing for delivery to S3 currently charges $0.029 per GB of data ingested. The estimated monthly cost for using Firehose is $0.63 per mont</em>h</strong></p><blockquote><strong>Firehose pricing is based on: The volume of data being ingested, The destination where data is delivered (e.g., Amazon S3), and optional data transformation with AWS Lambda.</strong></blockquote><p><strong>Note:</strong> Given that we are storing the data in S3 and querying it with Athena, the major cost will come from the volume of data being transferred to Firehose and the storage in S3.</p><p>We’ve tried to break down the flow of this work, and in the next part, we will be diving into the hands-on process of creating our resources in AWS.</p><p>Happy learning!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=47bf44a5d84b" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-epic/end-to-end-near-real-time-data-engineering-project-using-aws-services-part-1-47bf44a5d84b">End-to-End Near-Real-Time Data Engineering Project Using AWS Services Part 1</a> was originally published in <a href="https://medium.com/data-epic">Data Epic</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unveiling the Art of Feature Engineering: How to Transform Raw Data into Insights.]]></title>
            <link>https://medium.com/data-epic/unveiling-the-art-of-feature-engineering-how-to-transform-raw-data-into-insights-d057b22e4632?source=rss----74ea905d0b09---4</link>
            <guid isPermaLink="false">https://medium.com/p/d057b22e4632</guid>
            <category><![CDATA[feature-engineering]]></category>
            <category><![CDATA[data-science]]></category>
            <dc:creator><![CDATA[Yahaya Onagie]]></dc:creator>
            <pubDate>Tue, 12 Dec 2023 03:50:24 GMT</pubDate>
            <atom:updated>2023-12-12T03:50:24.339Z</atom:updated>
            <content:encoded><![CDATA[<p>In the world today, where data drives the majority of activities, the abundance of raw data has become the new norm. But the real value lies not in the massive volume of data but in the insights that can be revealed. A step or method used in bridging the gap between raw data and actionable insights is feature engineering. In Data Science, this process plays a pivotal role in refining and transforming raw unstructured data into meaningful structured features.</p><p><strong>The Role of Feature Engineering</strong></p><p>Feature Engineering is an art as much as it is a science, it encompasses the processes of selecting, extracting, and transforming raw data attributes into a set of relevant features that capture essential information for model learning. A well-engineered feature set can simplify the learning process, reduce computational complexity, and enhance model generalization. By extracting meaningful patterns and relationships from the data. Feature engineering is an iterative process that requires domain expertise, creativity, and a deep understanding of the data and the problem at hand. It is not a one-size-fits-all approach, as the specific techniques and strategies employed will vary depending on the nature of the data, the machine-learning task, and the desired outcome.</p><p><strong>Role of Featuring Engineering in Transforming Raw Data</strong></p><ol><li>Data Cleaning: Before delving into feature engineering, data cleaning is a crucial step. Handling missing values, treating outliers, and dealing with inconsistent data are vital for ensuring the quality and reliability of the feature set.</li><li>Feature Selection: From the abundance of available features, feature selection involves identifying the most relevant and informative ones. This process helps eliminate redundant or irrelevant features, reducing noise and improving model performance.</li><li>Encoding Categorical Variables: Machine learning algorithms often require numerical data. Therefore, categorical variables must be encoded into.</li><li>Handling Numerical Variables: Scaling numerical features to a similar range or normalizing them can improve model convergence and prevent certain features from dominating the learning process.</li><li>Time-Based Features: In time-series data, creating time-based features, such as day of the week, month, or season, can capture the inherent periodic patterns and boost forecasting accuracy.</li><li>Polynomial Features: Introducing polynomial features, such as squared or interaction terms, can capture nonlinear relationships between variables, allowing models to learn more complex patterns.</li></ol><p><strong>Feature Engineering Techniques</strong></p><p>Comprehending the training data and the specific problem at hand remains an essential aspect of Feature Engineering in data science and machine learning. There are no rigid guidelines on how to accomplish this task. However, certain feature engineering techniques in this field are imperative knowledge for all data scientists.</p><p>1. Missing Value Handling:</p><p>· Impute missing values using mean, median, or mode imputation techniques.</p><p>· Create binary indicators for missing values (1 if missing, 0 otherwise).</p><p>· Use more advanced imputation techniques like k-nearest neighbours or regression imputation.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/607/1*NzU2tsFXgnAGgSDiRehvlQ.png" /></figure><p>2. Categorical Data Encoding:</p><p>· Convert categorical variables into numerical representations, common methods include one-hot encoding or target encoding.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1009/1*0oxX86Ecb7V-WMcq_JQX0A.png" /></figure><p>3. Datetime Features:</p><p>· Extract relevant information from date-time variables such as year, month, day, day of the week, or time of day. This can be useful for time series analysis or other temporal pattern applications.</p><p>4. Text Data Processing:</p><p>· Extract features from text data using techniques like TF-IDF (Term Frequency-inverse Document Frequency) or word embeddings.</p><p>· Create features based on text length, word count, or the presence of specific keywords.</p><p>5. Feature Scaling:</p><p>· Standardize or normalize numerical features to ensure they are on a similar scale. This is important for algorithms sensitive to feature magnitudes, such as support vector machines or k-means clustering.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/696/1*RjgufGl9SrMeJ0grt5sStg.png" /></figure><p>6. Domain-Specific Features:</p><p>· Create new features based on domain knowledge. For example, in retail, you might create features like discounts, profit margins, or customer purchase history metrics.</p><p>7. Handling Outliers: The various methods of handling outliers include:</p><p>· Removal: The records containing outliers are removed from the distributional. However, the presence of outliers over multiple variables could result in losing out on a large portion of the datasheet with this method.</p><p>· Replacing Values: The outliers could alternatively be treated as missing values and replaced by using appropriate imputation.</p><p>· Capping: Capping the maximum and minimum values and replacing them with an arbitrary value from a variable distribution.</p><p>8. Feature Creation:</p><p>· Feature creation involves deriving new features from existing ones. This can be done by simple mathematical operations such as aggregations to obtain the mean, median, mode, sum, or difference and even product of two values. Although derived directly from the given input data, these features can impact the performance when carefully chosen to relate to the target.</p><p>Feature engineering serves as a vital link connecting raw data to actionable insights. Its importance cannot be emphasized enough, given its substantial impact on the effectiveness and interpretive capability of machine learning models. A skillfully executed feature engineering procedure can reveal concealed patterns and correlations within datasets, thereby enabling data scientists and analysts to extract valuable insights and arrive at well-informed decisions.</p><p><strong>References:</strong></p><p>· <a href="https://www.linkedin.com/pulse/feature-engineering-unveiling-art-data-transformation-machine/"><strong>https://www.linkedin.com/pulse/feature-engineering-unveiling-art-data-transformation-machine/</strong></a></p><p>· <a href="https://medium.com/@evertongomede/the-art-of-feature-engineering-unraveling-the-essence-of-data-9cba7b61502f"><strong>https://medium.com/@evertongomede/the-art-of-feature-engineering-unraveling-the-essence-of-data-9cba7b61502f</strong></a></p><p>· <a href="https://www.projectpro.io/article/8-feature-engineering-techniques-for-machine-learning/423"><strong>https://www.projectpro.io/article/8-feature-engineering-techniques-for-machine-learning/423</strong></a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=d057b22e4632" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-epic/unveiling-the-art-of-feature-engineering-how-to-transform-raw-data-into-insights-d057b22e4632">Unveiling the Art of Feature Engineering: How to Transform Raw Data into Insights.</a> was originally published in <a href="https://medium.com/data-epic">Data Epic</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Data migration: How to Migrate data from Google Sheets to a PostgreSQL using Python.]]></title>
            <link>https://medium.com/data-epic/data-migration-how-to-migrate-data-from-google-sheets-to-a-postgresql-using-python-561ada38efb4?source=rss----74ea905d0b09---4</link>
            <guid isPermaLink="false">https://medium.com/p/561ada38efb4</guid>
            <category><![CDATA[postgresql]]></category>
            <category><![CDATA[data-migration]]></category>
            <category><![CDATA[google-sheets-api]]></category>
            <category><![CDATA[python]]></category>
            <dc:creator><![CDATA[Ayomide Omotosho]]></dc:creator>
            <pubDate>Thu, 07 Dec 2023 17:46:37 GMT</pubDate>
            <atom:updated>2023-12-07T17:46:37.715Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/721/1*LSKnf27qQrxt1gEtnWYreQ.png" /></figure><p>Data migration is the process of transferring data from one data storage system to another and also between data formats and applications. It also involves data transfers between different data formats and applications. The data migration process also includes data preparation, extraction, and transformation. It is usually conducted when introducing new systems and processes in an organization. The efficiency of data migration has far-reaching implications for an organization.</p><blockquote>Efficient data migration is crucial for organizations as it minimizes downtime, reduces data loss risk, ensures business continuity, and maintains data integrity for informed decision-making, while inefficient migration can lead to significant costs and data quality issues.</blockquote><h3>Introduction to Google Sheets and PostgreSQL</h3><p>Google Sheets is a widely used online spreadsheet application, part of the Google Drive suite. It allows users to create, edit, and collaborate on spreadsheets in real-time. Its accessibility, user-friendly interface, and integration with other Google services make it a popular choice for data storage and preliminary analysis.</p><p><em>PostgreSQL, on the other hand, is an advanced, open-source relational database management system, known for its robustness, scalability, and compliance with SQL standards. It is capable of handling large volumes of data and complex queries, making it a preferred database for applications requiring reliable data storage and sophisticated data manipulation capabilities.</em></p><h4>Why Migrate from Google Sheets to PostgreSQL?</h4><p>Sheets are used to store tabular data in day-to-day work life. This data storage system can be used as a database for relatively smaller-scale projects, to collect and fetch data from users. But for various reasons like data consistency, organized and extensible data structure, and operational convenience, a simple database is not manageable for even slightly complicated data structures — a relational database is required in these cases. Other reasons include:</p><ul><li><strong>Performance Speed:</strong> The performance of GS as a database in fetching and rendering APIs is well at low volumes but the performance is affected when the dataset grows large.</li><li><strong>Storage Limit: </strong>Google Sheets also has a storage limit of 5 million cells, which would seriously hamper the amount of data that can be ⁷ in a company’s database with ever-increasing data.</li><li><strong>Limited functionality:</strong> Spreadsheet applications are not designed to be used like databases, so the functionality of Google Sheets is limited compared to more advanced database management systems. For example, you can’t save videos or images, or add rich field types and there’s no built-in interface to query, filter or update data.</li><li><strong>Not scalable: </strong>Due to limited storage, Google Sheets is not scalable. Also, if many team members are working on the spreadsheet at the same time, the software will slow down, and you may encounter more errors.</li><li><strong>Cannot see beyond a table:</strong> No other views like Kanban or Calendar are supported in Google Sheets.</li></ul><p>These are few out of the many reasons why large-scale companies migrate their data from google sheet data storage system to other RDBMS like PostgreSQL.</p><h4>Why Use Python for this Data Migration?</h4><p>The use of Python for data migration, especially from Google Sheets to PostgreSQL, offers several compelling advantages:</p><ul><li><strong>Ease of Use and Readability:</strong> Python’s syntax is clear and concise, making it easy to write, read, and maintain code. This readability is particularly beneficial for complex data migration tasks, as it simplifies debugging and collaborative development.</li><li><strong>Robust Libraries and Frameworks: </strong>Python provides a rich ecosystem of libraries and frameworks suited for data manipulation and database interaction. Libraries like gspread for Google Sheets, pandas for data processing, and psycopg2 for PostgreSQL interaction, streamline the migration process.</li><li><strong>Flexibility and Scalability:</strong> Python’s flexibility allows it to handle various data types and structures encountered in Google Sheets and PostgreSQL. It can easily scale to accommodate large datasets, a critical factor in data migration projects.</li><li><strong>Automation and Scripting: </strong>Python is excellent for writing scripts that automate repetitive tasks. In the context of data migration, it can automate data extraction, transformation, and loading processes, reducing manual effort and the potential for errors.</li></ul><h4>Establishing Connections Using Python.</h4><p>Before data migration, you need to establish a connection with the google sheet API and PostgreSQL, and to do that you have to first setup an access for your google sheet and also create a database on Postgres, the two can be done following these steps;</p><ol><li><strong>Accessing the Google sheet using Google Sheets API</strong></li></ol><p>To establish a connection with google sheet you need to have a GCP account which you can use to create a project, and, on the interface, you can navigate to google APIs and Services and enable the Google Sheets API.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*uBMwrbi785Oj6arUg_hDPg.png" /></figure><p>After enabling the API, you can then create a service account in your Google Cloud project and download the JSON key file. This file contains credentials to authenticate your Python script with Google’s API, it looks something like this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*ohRom0DLuyKB8zFyfuCG3g.png" /></figure><p>The next thing to do is to share the Google Sheets with the email associated with your service account and give editor right (not necessary). This step is necessary for the service account to access the sheets.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/492/1*XcBJ0IzV4wdjjgNGr_wfIA.jpeg" /></figure><h4>2. Creating a PostgreSQL Database and Table</h4><p>If not already installed, download and install PostgreSQL from the link below:</p><p><a href="https://www.postgresql.org/download/">PostgreSQL: Downloads</a></p><p>Follow the installation instructions for your operating system.</p><p>After completing the installation on your OS, navigate to PgAdmin on your PC and with the use of PgAdmin, you can create a new database by running a SQL script on the SQL editor or just create it manually on PgAdmin interface. For example, in SQL, you can create a database with:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/858/1*4V_DapzQqpCKpabGwXYBYw.png" /></figure><p>When you are done setting up your database, based on the data structure in your Google Sheets, design a corresponding table schema in PostgreSQL. Determine the columns and their data types and if the data types are different, you can perform some sort of transformation to get the right data type before ingestion.</p><p>You can create a table in the query editor or on PgAdmin interface, to create the table using the editor you can simply execute the SQLstatement below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/972/1*L_1Oj4kCAUeFvVjy4z__4w.png" /></figure><p>You can replace your_table_name, column1, datatype1, etc., with your specific table and column names and data types.</p><p>After setting up the access to the google sheet and creating a table in the database we can now write our python script in the following steps.</p><h3>What does the python script look like??</h3><h4>1. Creating a Connection with the PostgreSQL Database in the Python Script</h4><p>Before you start writing your script, ensure you have the necessary credentials to connect to your PostgreSQL database, including the host, database name, username, and password. If you haven’t already, install the pycorpg2library, which is a PostgreSQL adapter for Python, you can use pip to install this on your bash:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/972/1*M8PgtYzdjFtr60Pv1YLqFQ.png" /></figure><p>Write a Python Script to connect in your Python environment, write a script to establish a connection to the PostgreSQL database. For example:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*WlthQbHvgCoc0543_loTMw.png" /></figure><p>Replace the parameters with your actual database credentials.</p><p>Execute a simple query to test the connection, such as retrieving data or the table schema.</p><h4>2. Getting data from the worksheet using Gspread library</h4><p>With your credentials, you can use the gspread Python library to connect to your Google Sheets document.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/976/1*FkPcuaWfWfvEsvwtobm8Lw.png" /></figure><p>Install it using pip and authenticate using the obtained credentials from your google service account, Once authenticated, use gspread to open the desired spreadsheet by its name and fetch the required worksheet. You can then read the data into a Python list or a Pandas dataframe for easier manipulation. This can be done using the script below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*bSvuFa6ZSOSMEELV2_o3hw.png" /></figure><p>Replace name_of_spreadsheetwith the actual name of your Google Sheets file and replace worksheet_titlewith the title of the worksheet you want to extract data from. The get_all_recordsmethod is a function of the gspread library that retrieves all the data from the worksheet and returns it as a list of dictionaries, where each dictionary represents a row in the sheet. In a more professional setting, it is advisable to have things like service_account_file as an environment variable.</p><p>For more info on gspread library you can access the documentation through this link:</p><p><a href="https://docs.gspread.org/en/v5.10.0/user-guide.html#getting-all-values-from-a-worksheet-as-a-list-of-lists">Examples of gspread Usage — gspread 5.10.0 documentation</a></p><h4>3. Ingesting the data into Postgres Database</h4><p>After performing every necessary transformation, you want to do on the data, you can simply ingest by running this python script into the table in your PostgreSQL database.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*_SLdk9WL9BLw_t5-qM8pXA.png" /></figure><p>Once executed, the script will efficiently insert the transformed data into your PostgreSQL database, making it available for further analysis, reporting, and utilization within your data ecosystem. This streamlined process ensures that your valuable data is seamlessly integrated into your database, enabling you to derive insights and make informed decisions based on the transformed and enriched dataset.</p><h3>Conclusion</h3><p>In conclusion, Efficient data migration from Google Sheets to PostgreSQL is a critical aspect of modern data management, particularly when dealing with larger datasets or when advanced data manipulation capabilities are required.</p><p>By following the established steps for establishing connections, authenticating with Google Sheets, and PostgreSQL, and employing Python scripts for data migration, organizations can ensure a seamless transition of data, maintain data integrity, and enable data-driven decision-making.</p><h3>References</h3><p><a href="https://corporatefinanceinstitute.com/resources/data-science/data-migration/">Data Migration — Types, Definition, Process, Practices (corporatefinanceinstitute.com)</a></p><p><a href="https://stackby.com/blog/google-sheets-database/">Google Sheets as a Database: Pros &amp; Cons (stackby.com)</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=561ada38efb4" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-epic/data-migration-how-to-migrate-data-from-google-sheets-to-a-postgresql-using-python-561ada38efb4">Data migration: How to Migrate data from Google Sheets to a PostgreSQL using Python.</a> was originally published in <a href="https://medium.com/data-epic">Data Epic</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Visualizing Data: Techniques for Creating Impactful Presentations]]></title>
            <link>https://medium.com/data-epic/visualizing-data-techniques-for-creating-impactful-presentations-0016c14be370?source=rss----74ea905d0b09---4</link>
            <guid isPermaLink="false">https://medium.com/p/0016c14be370</guid>
            <category><![CDATA[design]]></category>
            <category><![CDATA[data-science]]></category>
            <category><![CDATA[data-visualization]]></category>
            <category><![CDATA[presentations]]></category>
            <category><![CDATA[data-engineering]]></category>
            <dc:creator><![CDATA[Emmanuel Olayinka Omidiora]]></dc:creator>
            <pubDate>Tue, 05 Dec 2023 22:18:51 GMT</pubDate>
            <atom:updated>2023-12-05T22:18:51.168Z</atom:updated>
            <content:encoded><![CDATA[<p>Today, data has become a major yard stick that is used in any organization, for any business or organization to grow, there are 3 areas to work on PEOPLE, STRUCTURE AND DATA, data presentation today is no longer just about numbers on a screen, making decisions that are impactful and insightful requires data.</p><p>To start with, there are 2 stages to creating an impactful presentation:</p><h3>Things to know Before Creating your Presentation.</h3><h4>What is Data Presentation?</h4><p>Data presentation is a process of comparing two or more data sets with visual aids, such as graphs. Using a graph, you can represent how the information relates to other data.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*7jXTT_V2X-a_7dCKBMEchg.png" /></figure><blockquote><em>Data presentation can be as simple as telling a story or as complicated as decoding cosmic complexities.</em></blockquote><p>The truth is that there is so much that occurs at an event right, but really how much of it does the brain reserve. The brain would only reserve what it counts as relevant right? and discard the rest.</p><p>Contrary to many opinions that say you have to choose from various options, such as tables, charts, graphs, maps, or infographics, what format to use, there is nothing stopping you from using as many of each format you find necessary in your presentation.</p><h4>Simplicity is key-Consistency is vital</h4><p>To create an impactful presentation, you should avoid unnecessary complexities, too many colors, fonts, labels, or elements and should you also be at the verge of using — use the same style and conventions to help your audience recognize and compare different data sets and categories.</p><h4>Know Your Audience</h4><p>70–80 % of your presentation pattern is determined by your Audience, the same information can be communicated without in 3 various ways depending on the audience.</p><p><strong>Peers </strong>— These are data analysts, data scientists, and anyone in analytics that understands what you’re explaining if you drill down to methodology, analytic approaches, or code. Detailed information is preferable for this audience to share your work and for them to understand your approach and possibly leverage for their projects.</p><p><strong>Stakeholders </strong>— These are people in the department you support that asks you questions. A moderate level of detail is needed in your presentation for stakeholders to understand the results and make decisions.</p><p><strong>Senior leadership</strong> — These are people that manage your stakeholders and occupy senior positions in the company. Only high-level information is required that will impact the business. There is no need to go into details that you would with peers or stakeholders.</p><h4>Create Readable Slides</h4><p>Make sure your spreadsheet is formatted and labeled exactly how you want it. Think about the message you want to share with your audience and get rid of anything that doesn’t help you tell your story because data that is clean and organized is easier to display and analyze.</p><p>It is also good practice to Include how and why you gather this data to provide context. You might share your research questions to preface what the data reveals, identifying the main ideas of your data and research helps organize your presentation and communicates clearly the significance of your presentation.</p><h4>Practice Your Presentation</h4><p>As is always said, practice makes perfect, practicing your delivery would always help you communicate your ideas as effectively as possible. Time yourself presenting to ensure you’re speaking in an appropriate amount of time.</p><h3>What to include in your data presentations</h3><h4>Title and Objective</h4><p>Needless to say the first thing to be seen in any presentation is the “Title page”, there is a saying that goes thus “first impressions are the most lasting”. While everyone is getting settled, you are all introducing yourselves and the likes, do you now see how necessary it is, meanwhile very little people pay attention to this.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/642/1*NtvSjZIyuYquq2v3k48qOA.jpeg" /><figcaption><em>Title page for Data Presentation — Image source: </em><a href="https://de.venngage.com/templates/presentations/education">Venngage</a>.com</figcaption></figure><blockquote>Note: The title must be clear and Informative, nothing too bogus to read or too complex to understand and you are one step in.</blockquote><h4>Primary Objective / Purpose</h4><p>Given the scenario where the presentation is to be done and your audience your objective could range from a simple sentence to a paragraph something to wet the appetite of your audience.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/816/1*gQh3ESs7bLyZg5Vc7lpqCg.png" /></figure><h4>Key data points</h4><ul><li>Present the most essential data points or findings that align with your objective. Are they clear, are they written.</li><li>Use charts, graphical presentations or visuals to illustrate these key points for better comprehension.</li></ul><h4>Visual markers</h4><p>There are points called the “Aha!” zone, that spot where everything correlates, that point you get to and there is an obvious “oh!”. Visually highlighting the “Aha!” zone itself with a circle or shading helps to reinforce the most important takeaways from your data</p><h4>Descriptions</h4><p>Descriptions are different from summaries, in descriptions you are telling your audience know what they are looking at, they need this information before there can be a clear understanding of your summaries. Always make sure they are short and sentence concise, with this your audience get to appreciate how you came about your suggestions.</p><h4>Summaries</h4><p>These are implications or actions to be taken from your data, never show any illustration that has no implication or action point.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/960/1*ye-1HtAH7amOhi2V0hqUJQ.jpeg" /></figure><p>An image like this is <strong>incomplete</strong> without a summary, there cannot be an assumption that everyone would understand from the image, what works and what doesn’t. Should the company focus more on the marketing strategy that performed best, change their approach, what are you suggesting.</p><h4>Time for Questions &amp; Discussion</h4><p>At the end of your presentation, allocate time for questions and open discussion to engage the audience. It is necessary to give time for the audience to ask questions. This way there is a thorough understanding of your research.</p><h4><strong>Conclusion</strong></h4><p>Remember, the goal of data presentation is to make complex topics much easier to understand, and if you’re bringing too much information to the table, you’re missing the point. The more information you give, the more time it will take for your audience to process it all.</p><h3>References</h3><p><a href="https://venngage.com/blog/data-presentation-examples/">https://venngage.com/blog/data-presentation-examples/</a></p><p><a href="https://venngage.com/blog/data-presentation-examples/">https://towardsdatascience.com/how-to-create-a-successful-data-presentation-7eae7a9a41f</a></p><p><a href="https://venngage.com/blog/data-presentation-examples/">https://www.linkedin.com/advice/0/what-key-principles-effective-data-presentation-research</a></p><p><a href="https://venngage.com/blog/data-presentation-examples/">https://www.slideteam.net/media/catalog/product/cache/1280x720/c/o/content_marketing_performance_evaluation_ppt_sample_Slide01.jpg’</a></p><p><a href="https://in.indeed.com/career-advice/career-development/data-presentation">What Is Data Presentation? (Definition, Types And How-To) | Indeed.com India</a></p><p><a href="https://hbr.org/2020/02/present-your-data-like-a-pro">https://hbr.org/2020/02/present-your-data-like-a-pro</a></p><p><a href="https://ahaslides.com/blog/10-methods-of-data-presentation/">https://ahaslides.com/blog/10-methods-of-data-presentation/</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=0016c14be370" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-epic/visualizing-data-techniques-for-creating-impactful-presentations-0016c14be370">Visualizing Data: Techniques for Creating Impactful Presentations</a> was originally published in <a href="https://medium.com/data-epic">Data Epic</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[The Art of Web Scraping in Python using Selenium]]></title>
            <link>https://medium.com/data-epic/the-art-of-web-scraping-in-python-using-selenium-1c52901c34cc?source=rss----74ea905d0b09---4</link>
            <guid isPermaLink="false">https://medium.com/p/1c52901c34cc</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[selenium]]></category>
            <category><![CDATA[web-scraping-tools]]></category>
            <category><![CDATA[selenium-webdriver]]></category>
            <category><![CDATA[web-scraping]]></category>
            <dc:creator><![CDATA[Sadiquetimileyin]]></dc:creator>
            <pubDate>Tue, 05 Dec 2023 20:27:05 GMT</pubDate>
            <atom:updated>2023-12-05T20:27:05.361Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="Scraping" src="https://cdn-images-1.medium.com/max/480/1*5l8Ve6uWP1yse6aCxOsgKQ.gif" /><figcaption>Scraper</figcaption></figure><p>What is web scraping? Web scraping is the process of extracting data from websites. It is a very potent method that transforms data gathering and processing. Web scraping has become a vital tool for both consumers and corporations due to the abundance of internet data.</p><p>Selenium is a Python library that can be used to perform automated testing on web applications. It can simulate user inputs, such as entering content, tapping buttons, and scraping sites. Selenium is an open-source tool that works on all major operating systems and browsers.</p><h4>Why use Selenium for web scraping?</h4><p>Python offers a large number of modules and frameworks that make it simple to extract data from websites, which makes it a popular programming language for web scraping.</p><p>Using Python and Selenium for web scraping offers several advantages over other web scraping techniques:</p><ol><li><strong>Dynamic websites:</strong> JavaScript and other scripting languages are used to build dynamic web sites. When the website loads completely or the user interacts with it, these sites frequently have elements that are visible. Because Selenium can communicate with various components, it’s an effective tool for data scraping from dynamic websites.</li><li><strong>User interactions: </strong>Selenium is capable of simulating scrolling, clicks, and form submissions. This enables you to scrape websites like login forms that demand input from users.</li><li><strong>Debugging: </strong>You may step through the scraping process with Selenium in debug mode, seeing what the scraper is doing at each stage. When something goes wrong, you can use this to troubleshoot it.(reference <a href="https://nanonets.com/blog/web-scraping-with-selenium/">nanonets.com</a>)</li></ol><h3>Setting up selenium:</h3><p>First and foremost, install the selenium driver using pip either on your local terminal or directly in your IDE</p><pre>pip install Selenium</pre><p>then, we install a web-driver manager. The web-driver has a common problem of needing to manually update the web-driver according to the version of chrome your are using so in this article we will cover ways to automatically update the chrome driver. This will automatically download and install the appropriate WebDriver for you. To install web driver-manager, you can use the following command:</p><pre>pip install webdriver-manager</pre><p>Setup complete.</p><p>Moving forward, step by step setup for selenium</p><h4>Step 1: The imports</h4><p>The imports below is the basic import needed when initializing selenium. we will be focusing mainly on using Chrome browser</p><pre>from selenium import webdriver<br>from Selenium.webdriver.common.keys import Keys<br>from Selenium.webdriver.common.by import By</pre><h4>Step 2: Web-driver manager</h4><p>Setting up web-driver manager on Chrome browser use the following imports:</p><pre>from selenium.webdriver.chrome.service import Service as ChromeService<br>from webdriver_manager.chrome import ChromeDriverManager</pre><p>The code below has a function that auto update your chrome driver automatically regardless of which version of chrome you are using. Using the code below:</p><pre> drivers = webdriver.Chrome(service=ChromeService(ChromeDriverManager().install()))</pre><h4>Step 3: Basic Selenium functions</h4><ol><li>The <strong>get()</strong> function, it is used to access the website after the link has been provided as shown below:</li></ol><pre>link = &quot;htpps://google.com&quot; # This is just a reference <br>driver.get(link)</pre><p>2. The <strong>find_element() </strong>and <strong>find_elements()</strong>. The difference between this two functions is the find_element() returns the first find on the webpage that has the selector e.g h1 the find_element returns the first h1 on the webpage. Meanwhile the find_elements() fetches all the h1’s on the page and we use a for loop to access the data gotten from the find_elements(). implementation below:</p><pre># For the find element<br>driver.find_element(By.TAG_NAME, value=&#39;h1&#39;)<br><br># For find elements<br>driver.find_elements(By.CSS_SELECTOR, value=&#39;h1&#39;)<br><br># Don&#39;t worry about the By selector if it looks like mystery now dont&#39;t worry we will cover it in this article</pre><p>This functions above is mainly the three functions you will need for basic selenium usage.</p><p>The For loop solution as stated above the for loop basically stores the output directly into a list.</p><pre># For links<br>links = driver.find_elements(By.CSS_SELECTOR, value=&#39;.directory-content-box-inner a&#39;)<br>linked = []<br>for link in links:<br>    linked.append(link.get_attribute(&#39;href&#39;))<br><br># For texts <br>element = driver.find_elements(By.TAG_NAME, value=&#39;h3&#39;)<br>elements = []<br>for txt in element:<br>    elements.append(txt.text)</pre><h4>Step 4: Navigating using the By selector</h4><p>The By selector consists of 8 major selector types which are: NAME, ID, CSS_SELECTOR, TAG_NAME, CLASS_NAME, XPATH, LINK_TEXT, PARTIAL_LINK_TEXT. The following are various methods to navigate through the website.</p><pre>&lt;input type=&quot;text&quot; name=&quot;passwd&quot; class=&quot;passwd-class&quot; id=&quot;passwd-id&quot; /&gt; # Example of a basic html code</pre><p><strong>By.ID:<br></strong> This method is used when the id of a html code is given as shown below.</p><pre>element = driver.find_element(By.ID, value=&quot;passwd-id&quot;)</pre><p><strong>By.NAME:</strong> <br>This method is used when the name is indicated in the html code as shown below</p><pre>element = driver.find_element(By.NAME, value=&quot;passwd&quot;)</pre><p><strong>By.CSS_SELECTOR:</strong> <br>This method requires using css tag names to search through a webpage to select a specific part of the code that may have similarities with the other parts of the code.</p><pre>element = driver.find_element(By.CSS_SELECTOR, value=&quot;input#passwd-id&quot;)</pre><p><strong>By. XPATH:</strong> <br>When using this method we can write the XPATH manually but we have to be very careful the best practice is to copy directly from your web inspect page the explanation of how XPATH works is <a href="https://www.guru99.com/xpath-selenium.html"><strong><em>here</em></strong></a></p><figure><img alt="Chrome web inspect page" src="https://cdn-images-1.medium.com/max/747/1*TOXagtMpACXXaj-HugT-mg.jpeg" /><figcaption>How to copy XPATH</figcaption></figure><pre>element = driver.find_element(By.XPATH, value=&quot;//input[@id=&#39;passwd-id&#39;]&quot;)</pre><p><strong>By.CLASS_NAME:</strong> <br>This method is selecting the part of the html code by the name of the class indicated as shown below.</p><pre>element = driver.find_element(By.CLASS_NAME, value=&quot;passwd-class&quot;)</pre><p><strong>By.TAG_NAME:</strong> <br>This method is selecting the part of the html code by the name of the tag as shown below. Examples of tag names are h1, a, e.t.c.</p><pre>element = dirver.find_elements(By.TAG_NAME, value=&quot;input&quot;)</pre><p><strong>By.LINK_TEXT:</strong> <br>This method is using the texts that are attached to anchor tags in html as shown in the image below.</p><figure><img alt="Selection by link txt" src="https://cdn-images-1.medium.com/max/737/1*4d-mejfDMUr4vJ_D7iwboA.jpeg" /><figcaption>Explanatory image for link text</figcaption></figure><pre>element = driver.find_element(By.LINK_TEXT, value=&quot;click here&quot;)</pre><p><strong>By.PARTIAL_TEXT:</strong> <br>This is also the same as above but this does not require the full name of the link text just a bit of it is enough for it to run</p><pre>element = driver.find_element(By.PARTIAL_LINK_TEXT, value=&quot;here&quot;)</pre><h4>Step 5: Viewing texts in python IDE</h4><p>This step is necessary incase we want to save any data gotten from the website in a file or just a list and so on we use the following to pick outputs from the website.</p><ol><li>The text keyword at the end of the element is used to allow python decipher the coded output directly from the website then convert it to a text understood by the user. Example is shown below.</li></ol><pre>element = driver.find_element(By.TAG_NAME, value=&#39;h1&#39;)<br>element_name = element.text</pre><p>2. The get attribute function is used to mostly print out links from an anchor tag using the “href” keyword.</p><pre>element = driver.find_element(By.TAG_NAME, value=&#39;a&#39;)<br>link = element.get_attribute(&#39;href&#39;)</pre><p>The code above will print out the links found in the anchor tags</p><h4>Step 6: Saving into a file</h4><p>Saving all the output into a file we can always use the csv file format preferably because it is easier to work with in any other aspect especially during data cleaning.</p><pre>    with open(&quot;Canada_companies.csv&quot;, &#39;a&#39;) as file:<br>        files = file.write(f&quot;{element_name},{link}\n&quot;)</pre><p>Just an addition, for faster loading times we add the headless option this make the web-driver not need to open the website instead it open is in the background and it does all the scraping for you without opening the webpage.</p><pre>def chrome_driver():<br>    option = webdriver.ChromeOptions()<br>    option.add_argument(&#39;--headless&#39;)<br>    drivers = webdriver.Chrome(service=ChromeService(ChromeDriverManager().install()), options=option)<br>    return drivers</pre><h4>Conclusion:</h4><p>To sum up, using Selenium for web scraping is an effective way to retrieve data from websites. It can save you a lot of time and effort by enabling you to automate the data collection process. With Selenium, you may interact with websites in a manner similar to that of a human user and retrieve the necessary data more quickly.</p><p>Thank you for reading, more to come!</p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=1c52901c34cc" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-epic/the-art-of-web-scraping-in-python-using-selenium-1c52901c34cc">The Art of Web Scraping in Python using Selenium</a> was originally published in <a href="https://medium.com/data-epic">Data Epic</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Unit Testing in Python and Continuous Integration with GitHub Actions]]></title>
            <link>https://medium.com/data-epic/unit-testing-in-python-and-continuous-integration-with-github-actions-bdb86a207197?source=rss----74ea905d0b09---4</link>
            <guid isPermaLink="false">https://medium.com/p/bdb86a207197</guid>
            <category><![CDATA[github]]></category>
            <category><![CDATA[python]]></category>
            <category><![CDATA[github-actions]]></category>
            <category><![CDATA[pytest]]></category>
            <dc:creator><![CDATA[Humphery]]></dc:creator>
            <pubDate>Tue, 05 Dec 2023 00:18:18 GMT</pubDate>
            <atom:updated>2023-12-05T01:16:02.293Z</atom:updated>
            <content:encoded><![CDATA[<figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*myxoSgbNVq6DNVhO_TiwTA.jpeg" /></figure><p>There’s a motivation behind tests, and we shouldn’t start this journey together without knowing what it is. Tests in computer programs are ways of checking whether the software works as expected or not. There are different ways of testing a software program depending on the level, here are a few:</p><ul><li><strong>Unit testing</strong>: Individual units or components are tested.</li><li><strong>Integration testing</strong>: Individual units are combined and tested as a group.</li><li><strong>System testing</strong>: Complete integrated system software is tested. The purpose of this test is to evaluate the system compliance with specified requirements.</li><li><strong>Acceptance testing</strong>: The purpose of this test is to evaluate the system compliance with business requirements and access whether it is acceptable for delivery.</li></ul><p>Unit testing comes at the first of these levels of the pipeline or pyramid and can serve as a building block to learn other types of tests, which is why in this article we will work on unit testing.</p><p>According to <a href="https://aws.amazon.com/what-is/unit-testing/">aws. amazon</a>, <strong>unit testing</strong> is a process where you test the smallest functional unit of your code. It is a program written to check various parts of the code if it is working as expected, it helps to check different pieces or units in a code, hence the name unit testing.</p><p><strong>Some Importance of Unit test to a computer program</strong></p><ul><li>To ascertain a section of the code is working as expected.</li><li>To test every function and procedure.</li><li>To ensure reusability.</li></ul><p><strong>Note</strong>: Writing tests is a dynamic concept, all that would be covered here would try to encompass common concepts to enable you start writing basic tests for your programs, but there is definitely a whole lot more to learn under this topic.</p><h3><strong>Continuous Integration with GitHub Actions</strong></h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*IsMDyuvj4xpSOcKfMvKGSQ.jpeg" /></figure><p>Imagine you and your team are working on a project. Instead of everyone independently developing their features and waiting until the end to put everything together, <strong>Continuous Integration (CI)</strong> encourages developers to regularly merge their changes into a shared code repository. This process is automated, meaning there’s a system <strong>(CI server)</strong> that checks (tests) and merges the code automatically whenever someone makes changes.</p><p><a href="https://docs.github.com/en/actions"><strong>GitHub Actions</strong></a> serves as a <strong>Continuous Integration (CI) server</strong> or platform. It allows you to define, customize, and automate your CI workflows directly within your GitHub repository. GitHub Actions can be used to <strong>build</strong>, <strong>test</strong>, and <strong>deploy</strong> your code automatically whenever changes are pushed to the repository.</p><h4><strong>Use Case: Writing test for a Python Program</strong></h4><p>Here is a simple python program.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/bae4ea2abfadebe923ab74c3b5037754/href">https://medium.com/media/bae4ea2abfadebe923ab74c3b5037754/href</a></iframe><p>This python program uses the selenium library to scrape information from a GitHub repository (mine in this use case). Understanding each and every line of code in the above program is not essential to understanding the concept of this article, so it is okay, if you are new to scrapping or don’t know much about selenium. To give a brief explanation on what various parts of the code is doing:</p><pre>import os<br>import logging <br>import gspread<br>import pandas as pd<br>from dotenv import load_dotenv<br>from selenium import webdriver<br>from selenium.webdriver.common.by import By</pre><ul><li>This section imports various libraries needed for the execution of the program, the <strong>os</strong> package helps to interact with the operating system.</li><li><a href="https://docs.gspread.org/en/v5.10.0/oauth2.html"><strong>Gspread</strong></a> library enables us send data to an online <strong>google spreadsheet</strong> (the data being sent in this case is the information gotten from the GitHub repo), <strong>pandas</strong> enable us work with dataframes, or series objects.</li><li><strong>Selenium</strong> library scrapes the data from the GitHub repository.</li></ul><pre>class UpdateSpreadSheet():<br>    <br>    def __init__(self):<br>        &quot;&quot;&quot;initializes instance variables of class&quot;&quot;&quot;<br>        #dictionary to hold features and values of github data<br>        self.github_repo = {}<br>        #list variable holding repository names<br>        self.RepoName = [] <br>        #list variable holding language used<br>        self.Language = [] <br>        #list variable holding Description of each repo<br>        self.Description = [] <br>        #list variable holding datetime when repo was las updated/posted<br>        self.Datetime_Posted = []</pre><p>The main program is enclosed in a class and separated into multiple methods. Now, here is <strong>another benefit</strong> of unit testing, because it forces you to separate your code into <strong>units(functions)</strong> that can be easily tested, multiple ripple positive effects come from this also, because with this you can easily <strong>understand your code</strong>, and more <strong>easily debug</strong> various sections of the code.</p><p>This section of the code creates the class UpdateSpreadSheet (as stated before, the script updates an online google spreadsheet with help of gspread) and initializes various instance variables of the class, the variables: RepoName, language, description and Datetime_posted are the various information being scrapped.</p><pre>def getting_data(self):<br>        &quot;&quot;&quot;gets data from the github_repo url&quot;&quot;&quot;<br>        #Getting Repository names from github repo  with selenium<br>        self.RepoName += [name.text if isinstance(name,webdriver.remote.webelement.WebElement) is True else name for name in driver.find_elements(by=By.CSS_SELECTOR,value=&#39;a[itemprop=&quot;name codeRepository&quot;]&#39;)]<br>        #Getting Language used for each repo from github repo  with seleniums<br>        self.Language += [language.text if isinstance(language,webdriver.remote.webelement.WebElement) is True else language for language in driver.find_elements(by=By.CSS_SELECTOR,value=&#39;span[itemprop=&quot;programmingLanguage&quot;]&#39;)]<br>        #Getting Description of each repo from github repo  with selenium<br>        self.Description += [desc.text if isinstance(desc,webdriver.remote.webelement.WebElement) is True else desc for desc in driver.find_elements(by=By.CSS_SELECTOR, value=&#39;p[itemprop=&quot;description&quot;]&#39;)]<br>        #Getting Datetime when repo was posted or last updated from github repo  with selenium<br>        self.Datetime_Posted += [datetime.text if isinstance(datetime,webdriver.remote.webelement.WebElement) is True else datetime for datetime in driver.find_elements(by=By.CSS_SELECTOR,value=&#39;relative-time[class=&quot;no-wrap&quot;]&#39;)]</pre><p>This method scrapes the data from the github repository and updates the various instance variables.</p><pre>def populating_dictionary(self):<br>        &quot;&quot;&quot;updates dictionary variables<br>           with data obtained from github&quot;&quot;&quot;<br>        #populating dictionary github_repo which will be used to create pandas dataframe<br>        self.github_repo[&quot;RepoName&quot;] = self.RepoName<br>        self.github_repo[&quot;Language&quot;] = self.Language<br>        self.github_repo[&quot;Description&quot;]= self.Description<br>        self.github_repo[&#39;Datetime_posted&#39;] = self.Datetime_Posted</pre><p>This populates the dictionary github_repo with the data/information scrapped, this dictionary is needed to create the dataframe which is done next.</p><pre>def create_dataframe(self):<br>        &quot;&quot;&quot;creating dataframe with dictionary<br>           which contains data gotten from github&quot;&quot;&quot;<br>        #attempting to create pandas dataframe and assigning to data variable<br>        try:<br>            self.data =  pd.DataFrame(self.github_repo).reset_index(drop=True)<br>        except Exception as e:<br>            raise ValueError(&quot;All arrays must be of the same length&quot;,e)</pre><p>This section attempts to create the dictionary, if the data scrapped is missing some information, then the dataframe will raise a valueerror.</p><pre>def worksheet_update(self):<br>        &quot;updating workshet with data&quot;<br>        #updating to spreadsheet<br>        self.worksheet.update([self.data.columns.tolist()] + self.data.values.tolist()),</pre><p>Finally, this section updates a particular worksheet of the chosen google spreadsheet with the information gotten.</p><h4><strong>Now let’s write a test program</strong></h4><p>One thing to note is when writing a unit test, what is being tested is the code itself (to check if the code structure is working as expected) and not servers or external elements for example, for this code where there is a connection with GitHub website, if GitHub suddenly crashes, obviously the code will not perform its functions anymore, but that is not due to the fault of the programmer who wrote the code, but due to the GitHub website which crashed,</p><p>Hence as the programmer who wrote the code, you want to test that your program is working as expected (syntax and algorithm wise) and not whether the GitHub server is working smoothly, therefore when writing the test, we will utilize the concept of <strong>mocking</strong>. Mocking helps <strong>isolate</strong> the code being tested from <strong>external services or systems</strong>. This isolation ensures that the test results accurately reflect the behavior of the code itself. We will see more on mocking later on.</p><p><strong>Step 1: Install Required Packages</strong></p><p>To write tests in python, two libraries are commonly used, the <strong>unittest</strong> library which is a testing framework set in python by default, therefore has no need for installation, unittest is a <strong>simpler</strong>, <strong>more straightforward</strong> option that is suited for smaller projects.</p><p>Then there is the <strong>pytest</strong> library which is more <strong>powerful</strong> and <strong>flexible</strong>, and a great choice for more complex projects, here we will use the pytest library, we will also use part of the unittest for mocking purposes.</p><blockquote>on the command line run: pip install -U pytest, then run: pytest — version to confirm that pytest has indeed installed.</blockquote><p><strong>Step 2: Import Libraries and Packages</strong></p><pre>import pytest<br>from gspread_code import UpdateSpreadSheet<br>from unittest.mock import patch<br>import pandas as pd</pre><p>The pytest library is imported, then the UpdateSpreadSheet class is imported from our main code which we want to test called gspread_code into our test script, from the unittest.mock class we import patch, more on how to use this will be explained as we go on, finally the pandas library is imported.</p><p><strong>Step 3:</strong> <strong>Create Test class</strong></p><pre>class TestUpdateSpreadSheet:  <br>    <br>    @pytest.fixture<br>    def instantiate_class(self):<br>        &quot;&quot;&quot;setup function to create<br>            instance of class&quot;&quot;&quot;<br>        self.inst = UpdateSpreadSheet()<br>        return self.inst</pre><p><strong>Some points to note</strong>:</p><ul><li>Pytest requires certain naming conventions to be able to automatically detect tests, all your <strong>test functions</strong> or methods should start with the <strong>prefix test.</strong></li><li>If they are <strong>methods of a class</strong> as is done here, the <strong>class name</strong> should also have the prefix test, your class should also <strong>not</strong> contain an <strong>__init__</strong> method.</li><li>Finally, the name of your test script should be prefixed or suffixed by the name test (eg: test_gspread_code.py or gspread_code_test.py), here we will save ours as test_gspread_code.py .</li></ul><p>So, here we create our class TestUpdateSpreadSheet and define our first method instantiate_class<strong>, </strong>this method is not a test but rather a setup method and that is the purpose of the decorator @<strong>pytest.fixture, </strong>which is for <strong>setup</strong> and<strong> teardown</strong> operations. So, in our setup method an instance of the class UpdateSpreadSheet is created.</p><p><strong>Step 4: Write test for getting_data function</strong></p><pre>def test_getting_data(self,instantiate_class):<br>        &#39;&#39;&#39;test to check that the data is being added to the list<br>         variables successfully&#39;&#39;&#39;<br>        <br>        #mocking selenium driver attribute for checks if code syntax is accurate<br>        with patch(&quot;gspread_code.driver.find_elements&quot;) as mocked_get:<br>            #mocked attribute driver.find_elements is assigned to list to check<br>            mocked_get.return_value = [&#39;textID&#39;,&#39;yes&#39;]<br>            #calling getting_data function which begins to get the data from selenium<br>            instantiate_class.getting_data()<br>            #asserting all list variables were updated with first round of data gotten<br>            assert instantiate_class.RepoName == [&#39;textID&#39;,&#39;yes&#39;]<br>            assert instantiate_class.Language == [&#39;textID&#39;,&#39;yes&#39;]<br>            assert instantiate_class.Description == [&#39;textID&#39;,&#39;yes&#39;]<br>            assert instantiate_class.Datetime_Posted == [&#39;textID&#39;,&#39;yes&#39;]<br><br>            #assigning new data <br>            mocked_get.return_value = [1,2]<br>            instantiate_class.getting_data()<br>            #checking all list variables retained previous data and have added new data<br>            assert instantiate_class.RepoName == [&#39;textID&#39;,&#39;yes&#39;,1,2]<br>            assert instantiate_class.Language == [&#39;textID&#39;,&#39;yes&#39;,1,2]<br>            assert instantiate_class.Description == [&#39;textID&#39;,&#39;yes&#39;,1,2]<br>            assert instantiate_class.Datetime_Posted == [&#39;textID&#39;,&#39;yes&#39;,1,2]</pre><p>So, we are unto writing our first test, first thing to note is the naming convention, <strong>test_getting_data</strong>, asides from the fact pytest requires the prefix of test to <strong>locate</strong> it, the name given accurately <strong>describes</strong> the function being tested.</p><p>The purpose of this test function is outlined in the docstring. So, for this test we adopt the concept of mocking. Now, the simplest way to understand mocking is seeing it as putting <strong>representatives</strong> or <strong>in place values, </strong>so instead of connecting to the server and scrapping our data, we just replace the function that gets the data.</p><p>Here the function is driver.find_elements (the gspread in front is because we are importing the function from that module), so we replace this with a mocked object —<strong> </strong>mocked_get and return the value of mocked_get as [‘textID’, ‘yes’], so it is like putting this as our inplace value and assuming this is what was scrapped by the function driver.find_elements.</p><p>Next, we call our <strong>getting_data()</strong> function with the instance we have created, now since we have mocked the scrapping function, this getting_data() returns what we assigned which is [‘textID’, ‘yes’]</p><p>Here comes the test, using the keyword assert, we verify if the data scrapped is updated in each of our instance variables; RepoName, Language, Description, Datetime_Posted, if this test doesn’t pass then it lets us know something is wrong with our program and it isn’t working as expected, because it fails to update the instance variables with the data as we expect, this is what we mean by testing our program and not that of the server or other external elements.</p><p>Next, we assign another value to mocked_get which is [1, 2], now we expect our instance variable to be updated with this new data, that is they should now contain four data now, the previous two sent and the new two sent. this is important cause most likely we are scrapping more than one row of data from the site, so if it doesn’t add the new data to the list, then we will have loss of information and again the program won’t perform as expected.</p><p><strong>Step 5: Write test for populating dictionary function.</strong></p><pre>def test_populating_dictionary(self,instantiate_class):<br>        &quot;&quot;&quot;test to check if dictionary variable<br>           github_repo is succesfully being populated&quot;&quot;&quot;<br>        <br>        #populating list variables wiith values<br>        instantiate_class.RepoName = [1]<br>        instantiate_class.Language = [1,2]<br>        instantiate_class.Description = [1,2]<br>        instantiate_class.Datetime_Posted = [1,2]<br>        #calling function to populate dictionary<br>        instantiate_class.populating_dictionary()<br>        #asserting keys of dictionary are same as the number of list variables<br>        assert len(instantiate_class.github_repo.keys()) == 4<br>        #asserting values of dictionaries are identical to combination of values contained in list variables<br>        assert list(instantiate_class.github_repo.values()) == [[1],[1,2],[1,2],[1,2]]</pre><p>Here we write another test for our populating_dictionary() function. something to note here: You don’t have to write tests for every function in your code, it is a choice left to you and probably your organization, you write tests for functions that it would be beneficial to do so.</p><p>Now, for this test we assign values to the various instance variables as shown, here we don’t mock, because we are not interfacing with any external element, we just give our inplace values and test if our dictionary github_repo which we expect to be <strong>populated</strong> with all the data gotten and column names when we call the function populating_dictionary(), is indeed populated.</p><p>Hence, we assert the keys of the dictionary is equal to 4, keys are what represent our columns and we have 4 columns corresponding to:</p><ul><li>RepoName</li><li>Language</li><li>Description</li><li>Datetime_Posted.</li></ul><p>We also check the values of the dictionary contains same data that was in the rows under those columns.</p><p><strong>Step 6: Write test for creating_dataframe function.</strong></p><pre>def test_creating_dataframe(self,instantiate_class):<br>        &quot;&quot;&quot;test to check if dataframe is created successfully<br>           when given appropriate data and if the ValueError<br>           is raised when the data is not appropriate&quot;&quot;&quot;<br><br>        #populating dictionary variable github_repo with appropriate data<br>        instantiate_class.github_repo = {&#39;test1&#39;:[2,&#39;3&#39;],&#39;test2&#39;:[&#39;5&#39;,&#39;4&#39;]}<br>        #calling create data_frame function which creates a dataframe with dictionary github_repo<br>        instantiate_class.create_dataframe()<br>        #asserting data variable which holds the dataframe created from github_repo is equal expected dataframe<br>        assert instantiate_class.data.equals(pd.DataFrame({&#39;test1&#39;:[2,&#39;3&#39;],&#39;test2&#39;:[&#39;5&#39;,&#39;4&#39;]}))<br><br>        #populating github_repo variable with inappropriate data<br>        instantiate_class.github_repo = {&#39;test1&#39;:[2,&#39;3&#39;],&#39;test2&#39;:[5]}<br>        #asserting that ValueError is raised when an attempt to create a dataframe with this data is made<br>        with pytest.raises(ValueError):<br>            instantiate_class.create_dataframe()</pre><p>Now we write another test for our create_dataframe function, again here we populate the github_repo dictionary, it exists within our code and is not an external element, hence we don’t need to mock it, we can simply assign values to it as is done, then we call the create_dataframe() function which we expect to create our dataframe if the data contained in the GitHub dictionary is appropriate (when we say appropriate we mean, no missing values in some rows, every column should have same length).</p><p>Now, in case there are missing values, we expect our function to raise a valueerror, we also test that by populating the dictionary with inappropriate data, in the data being passed test1 column has two rows of data [2, ‘3’] while test2column only has one row of data [5]. if the value error is not raised when we call the create_dataframe() function, then the test will fail. <strong>Note</strong> how the test for errors is written, it <strong>differs</strong> from the usual assert method used in others.</p><p><strong>Step 7: Write test for test_worksheet_update</strong></p><pre>def test_worksheet_update(self,instantiate_class):<br>        &quot;&quot;&quot;test to check if the values passed in to<br>           update worksheet is accurate&quot;&quot;&quot;<br>        <br>        #populating github_repo variable<br>        instantiate_class.github_repo = {&#39;test1&#39;:[2,&#39;3&#39;],&#39;test2&#39;:[&#39;5&#39;,&#39;4&#39;]}<br>        #creating dataframe from github_repo<br>        instantiate_class.create_dataframe()<br><br>        #asserting dataframe created contains expected columns<br>        assert instantiate_class.data.columns.tolist() == [&#39;test1&#39;,&#39;test2&#39;]<br>        #asserting dataframe created contains expected values<br>        assert instantiate_class.data.values.tolist() == [[2,&#39;5&#39;],[&#39;3&#39;,&#39;4&#39;]]</pre><p>Finally comes our last test, here we write a test to check if the function we pass in the worksheet_update which is data.columns.tolist() and data.values.tolist(), we assert here that these two functions return the what we expect in the correct format cause if this not so, when we attempt to add as we do, either an <strong>error</strong> is thrown by the program or the resulting data if it does still add, will be different from <strong>what we expec</strong>t it to be, and our worksheet will now be updated with the data but not in the correct format.</p><p>And breathe! we have written four tests for our python script, this section gives you the insight on how to go about writing your own tests, now let’s run our test script, by now you should have pytest installed.</p><ul><li>Navigate to the working directory on your command prompt/anaconda prompt.</li><li>Run the command pytest on your command prompt/anaconda prompt and if you named the file correctly then you should see the outputs of your tests.</li></ul><p><strong>Output:</strong></p><p>If all your tests passed you should see an image like then one below, letting you know the total number of tests you wrote passed, in this case we wrote 4 tests.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*Ddll7Ult42uxQW69ksGSNg.png" /><figcaption>All tests Passed.</figcaption></figure><p>If any of your test fails, you should see an output that looks like the one below.</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*diH8fVaYdz_31PfOd2VUFg.png" /><figcaption>Not all tests passed.</figcaption></figure><p>When a test fails, it not only tells you the number that passed and failed as is shown in the image, it gives you information on what test failed and why, in this case the test that failed was the test_creating_dataframe() and that was cause it did not throw a valueerror when we expected it too, this was due to the fact the data passed in was appropriate, but we were testing for a case when inappropriate data is passed, hence it was actually expecting an inappropriate data.</p><p>And that’s a wrap on test, next we move to the other section, how to we <strong>automate (Continuous Integration)</strong> this test we have written with github actions.</p><h4><strong>Section 2: Continuous Integration</strong></h4><p>Again, on this concept there is a lot to learn, what we will cover here is what you need to start automating your tests scripts and working with GitHub actions, you can learn more on the <a href="https://docs.github.com/en/actions/quickstart">GitHub actions </a>documentation. Two things we need to achieve this:</p><ol><li>GitHub actions works with a specific path. To set up your workflow (the automated process you want to set up, in our case an automated test) you need a .yml file, and you need to set it up in the following path .github/workflows/main.yml , hence you create this directory and the .yml file (you can give it any name, here we name it main.yml).</li><li>The .yml file is the file where you write the syntax to execute the workflow process. Yaml is a language itself, so the syntax to write it is different from python that you are probably used to, but it is simple to learn.</li></ol><p>Let’s write our workflow process.</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/5822ba8dbb6eba378bed3423402f8eed/href">https://medium.com/media/5822ba8dbb6eba378bed3423402f8eed/href</a></iframe><p>The syntax program follows thus:</p><ol><li>We give the name of our workflow —here we call it continuous integration.</li><li>The on command is where you specify what will trigger your workflow, here our workflow will be triggered whenever we make a push to the repository in essence, whenever we push a new update of our code, the test workflow begins and the test which we run in our workflow will be carried out on our updated code. this provides one of the uses of GitHub actions, cause now you don’t need to manually test if your updated code has broken some syntax and isn’t working as you expect, just push and a test will be done automatically as specified by your workflow, if the test fails then you know your updated code has some issues.</li><li>jobs,this is where you specify the actual actions you want your workflow to have, here we have two jobs, <strong>build</strong> and <strong>test</strong>.</li><li>For our first job build, we specify the operating system which it runs on, with the runs-on command, the common one used is the <strong>ubuntu-latest</strong><em>, </em>but you can check the docs for other types, although this should do just fine.</li><li>Next, we start specifying the steps of this particular job, first it checks out our repository to the runner, this enables us run this script and other actions against our code, then we install the dependencies that should be contained in your requirements.txt file with the run command, note: pytest must be part of this dependencies for us to carry out your tests, and that’s it for our first job build.</li><li>Then we go on to our next job test, a specify similar procedure to the one above, just here, we have an extra step with the name test_script and the run command pytest, this will run the tests we have written in our test_gspread_code.py .</li><li>the needs keyword in the test job, specifies that the test job should only run after the build runs. In essence we are saying test needs the build job to have completed running in order to run itself.</li></ol><p>Now when you push an updated code to GitHub, your workflow is triggered! You should see a small yellow dot close to the green code button showing that your workflow has started running.</p><p>Next, you click on actions on the top bar of the GitHub page, and it takes you to where you see all your workflows, and if they passed or failed like shown below:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*nsBisSiKtReh3PFZ08a37g.png" /><figcaption>Workflows</figcaption></figure><p>Here it shows the workflows that have run, one has failed and is shown boldly with a red sign with an ‘x’, and one has passed, which is the latest one we just ran. finally, you can click on the workflows themselves and it takes you to where you can view the step by step process the workflow ran:</p><figure><img alt="" src="https://cdn-images-1.medium.com/max/1024/1*BgjtbCGOallMPfXcQy_4kQ.png" /></figure><p>If we want to still view more details, we click on the build or test jobs, and it shows us more details of the workflow process.</p><blockquote>And that’s a wrap! What a journey! Thanks for sticking along till the end and I hope you found this article informative, and you are able to start writing your very own tests and automating your workflows with GitHub actions!</blockquote><h4>References</h4><p>[1]: geeksforgeeks. <a href="https://www.geeksforgeeks.org/software-testing-basics/">What is Software Testing? — GeeksforGeeks</a></p><p>[2]: pythontutorial. <a href="https://www.pythontutorial.net/python-unit-testing/python-unittest/">Introduction to Python unittest Framework (pythontutorial.net)</a></p><p>[3]: How-to-geek. <a href="https://www.howtogeek.com/devops/what-is-unit-testing-and-why-is-it-important/">What Is Unit Testing and Why Is It Important? (howtogeek.com)</a></p><p>[4]: aws.amazon. <a href="https://aws.amazon.com/what-is/unit-testing/">What is Unit Testing? — Unit Testing Explained — AWS (amazon.com)</a></p><p>[5]: atlassian. <a href="https://www.atlassian.com/continuous-delivery/continuous-integration">What is Continuous Integration | Atlassian</a></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=bdb86a207197" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-epic/unit-testing-in-python-and-continuous-integration-with-github-actions-bdb86a207197">Unit Testing in Python and Continuous Integration with GitHub Actions</a> was originally published in <a href="https://medium.com/data-epic">Data Epic</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
        <item>
            <title><![CDATA[Poetry: How to Manage Package Dependencies in Python]]></title>
            <link>https://medium.com/data-epic/poetry-how-to-manage-package-dependencies-in-python-6917648b8b06?source=rss----74ea905d0b09---4</link>
            <guid isPermaLink="false">https://medium.com/p/6917648b8b06</guid>
            <category><![CDATA[python]]></category>
            <category><![CDATA[package-manager]]></category>
            <category><![CDATA[virtual-environment]]></category>
            <dc:creator><![CDATA[Emmanuel bolarinwa]]></dc:creator>
            <pubDate>Mon, 04 Dec 2023 22:47:26 GMT</pubDate>
            <atom:updated>2023-12-04T23:26:53.478Z</atom:updated>
            <content:encoded><![CDATA[<h3>Poetry: How to manage Package Dependencies in Python</h3><figure><img alt="" src="https://cdn-images-1.medium.com/max/300/1*8K1j4J8AQ7H6lRzBznFWNA.png" /></figure><p>Keeping track of dependencies related to a Python project can be pretty tricky, especially when doing this manually. This is where package managers come in. Package Managers help you store only the necessary libraries needed to run your project. It ensures reproducibility. There are several package managers like conda, and pipenv that exist to keep track of dependencies related to your project. In this article, we will explore using Poetry for your dependency management in Python.</p><h4>Introducing Poetry</h4><blockquote>Poetry is a tool for dependency management and packaging in Python. It allows you to declare the libraries your project depends on and it will manage (install/update) them for you.</blockquote><h4>Installation</h4><p>Poetry supports Python 3.8+ and works on Linux, Windows, and macOS. To get started with Poetry, you can install it using curl on Linux. If you don&#39;t have curl installed, you can check out <a href="https://everything.curl.dev/get">curl installation</a></p><pre>curl -sSL https://install.python-poetry.org | python3 -</pre><p>You can also check the <a href="https://python-poetry.org/docs/#installing-with-the-official-installer">official page</a> for more installation instructions for macOS and Windows. Once the installation is complete, you can confirm that the installation was successful by running the following command.</p><pre>poetry --version</pre><p>You can also view Poetry configuration by running the following command.</p><pre>poetry config  --list</pre><h4>Project Setup</h4><p>To initialize your project folder using poetry, run the following command</p><pre>poetry new new_project</pre><figure><img alt="" src="https://cdn-images-1.medium.com/max/484/1*5iuIg6_P7I9qYixA_kXgGg.png" /></figure><p>If your project folder already exists, you can change the directory into your project folder, then run the following command to initialize poetry in your project.</p><pre>poetry init</pre><p>Poetry will display a few prompts. This response will be used to create and populate a project.toml file in your project directory. It also allows you to define your dependencies independently.</p><p>Your project.toml file should be like this</p><iframe src="" width="0" height="0" frameborder="0" scrolling="no"><a href="https://medium.com/media/0914070f3b96f3bf8b988c26bb0cc6aa/href">https://medium.com/media/0914070f3b96f3bf8b988c26bb0cc6aa/href</a></iframe><h4>Virtual Environment</h4><p>Poetry also handles virtual environments as this is very important in ensuring that your project dependencies are isolated from other packages on your system.</p><p>I advise configuring poetry to store the project virtual environment in the project folder. It makes it easier to interact with your virtual environment. You can do that by running the following command.</p><pre>poetry config virtualenvs.in-project true</pre><p>You can use poetry to spin a virtual environment from the project.toml file using shell. It is easier to activate the environment using shell. To spin the virtual environment, run the following command</p><pre>poetry shell</pre><p>Alternatively, you can manually activate the virtual environment using the following command</p><pre>source {path_to_venv}/bin/activate</pre><p>To get the path to your virtual environment, run</p><pre>poetry env info --path</pre><p>To learn more about activating a virtual environment, you can check Poetry’s virtual environment documentation <a href="https://python-poetry.org/docs/basic-usage/#activating-the-virtual-environment">here</a></p><h4>Package Installation</h4><p>To install a package into your virtual environment using Poetry, run the following command</p><pre>poetry add &lt;package-name&gt;</pre><p>This automatically installs the package into your environment. It also creates a poetry.lock file similar to pipfile.lock This will ensure that anyone installing the project gets the same version of libraries. You can also install multiple packages by using the following syntax</p><pre>poetry add &lt;package-name-1&gt; &lt;package-name-2&gt; &lt;package-name-3&gt;</pre><p>If you have a requirements.txt file, then you can run</p><pre>poetry add $( cat requirements.txt )</pre><p>To view all the installed dependencies</p><pre>poetry show</pre><p>To remove a package from your environment, run the following command</p><pre>poetry remove &lt;package-name&gt;</pre><p>To deactivate the virtual environment in shell, run exit This will exit the environment. If you aren&#39;t using shell, run deactivate</p><h4>Conclusion</h4><p>Poetry is a modern tool that helps with package version management, and virtual environment creation. It automatically handles package resolution so you don’t have to worry about resolving conflicts. Poetry can also be used to build and publish your Python packages. You can check more about Poetry <a href="https://python-poetry.org/docs/">here</a>.</p><p><strong><em>If you find this article helpful, kindly give some clap and follow. Thanks!</em></strong></p><img src="https://medium.com/_/stat?event=post.clientViewed&referrerSource=full_rss&postId=6917648b8b06" width="1" height="1" alt=""><hr><p><a href="https://medium.com/data-epic/poetry-how-to-manage-package-dependencies-in-python-6917648b8b06">Poetry: How to Manage Package Dependencies in Python</a> was originally published in <a href="https://medium.com/data-epic">Data Epic</a> on Medium, where people are continuing the conversation by highlighting and responding to this story.</p>]]></content:encoded>
        </item>
    </channel>
</rss>