{"id":27443878,"url":"https://github.com/josephmachado/socialetl","last_synced_at":"2025-04-15T02:58:03.385Z","repository":{"id":65402193,"uuid":"590692181","full_name":"josephmachado/socialetl","owner":"josephmachado","description":"Project for \"Data pipeline design patterns\" blog.","archived":false,"fork":false,"pushed_at":"2024-08-06T12:19:15.000Z","size":90,"stargazers_count":45,"open_issues_count":0,"forks_count":7,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-04-15T02:57:58.579Z","etag":null,"topics":["dataengineering","design-patterns","etl-pipeline","makefile","python","reddit","social-media-data","sqllite3"],"latest_commit_sha":null,"homepage":"https://www.startdataengineering.com/post/code-patterns/","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/josephmachado.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-01-19T01:09:58.000Z","updated_at":"2025-03-25T08:56:10.000Z","dependencies_parsed_at":"2024-08-06T14:20:58.854Z","dependency_job_id":null,"html_url":"https://github.com/josephmachado/socialetl","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/josephmachado%2Fsocialetl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/josephmachado%2Fsocialetl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/josephmachado%2Fsocialetl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/josephmachado%2Fsocialetl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/josephmachado","download_url":"https://codeload.github.com/josephmachado/socialetl/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248997095,"owners_count":21195797,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["dataengineering","design-patterns","etl-pipeline","makefile","python","reddit","social-media-data","sqllite3"],"created_at":"2025-04-15T02:58:02.883Z","updated_at":"2025-04-15T02:58:03.376Z","avatar_url":"https://github.com/josephmachado.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Project design\n\n```mermaid\nflowchart LR\n    A[API] --\u003e|Extract| B[Transform ]\n    B --\u003e|Load| C[Database]\n```\n\nWe pull data from Reddit/Twitter API, transform them using python and load them into a database.\n\n## Prerequisites\n\n1. [Python3](https://www.python.org/downloads/)\n2. [sqlite3](https://www.sqlite.org/download.html) (comes preinstalled on most os)\n3. [Reddit app](https://www.geeksforgeeks.org/how-to-get-client_id-and-client_secret-for-python-reddit-api-registration/). You'll need your reddit apps **`REDDIT_CLIENT_ID, REDDIT_CLIENT_SECRET, \u0026 REDDIT_USER_AGENT`**.\n4. [Twitter API token](https://developer.twitter.com/en/docs/twitter-api/getting-started/getting-access-to-the-twitter-api), you'll need your twitter APIs **`BEARER_TOKEN`**.\n5. [git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)\n\n```bash\ngit clone https://github.com/josephmachado/socialetl.git\ncd socialetl\n```\n\n## Setup\n\nCreate a `.env` in the project's root directory, with the following content\n```txt\nREDDIT_CLIENT_ID=replace-with-your-reddit-client-id\nREDDIT_CLIENT_SECRET=replace-with-your-reddit-client-secret\nREDDIT_USER_AGENT=replace-with-your-reddit-user-agent\nBEARER_TOKEN=replace-with-your-twitter-bearer-token\n```\n\nRun the following commands are to be run via the terminal, from your project root directory.\n\n```bash\npython3 -m venv venv # Create a venv\n. venv/bin/activate # activate venv\npip install -r requirements.txt # install requirements\nmake ci # Run tests, check linting, \u0026 format code\nmake reset-db # Creates DB schemas\nmake reddit-etl # ETL reddit data\nmake twitter-elt # ETL twitter data\nmake db # open the db to check ELT-ed data \n```\n\n```sqlite\nselect source, count(*) from social_posts group by 1;\n.exit\n```\n\nSet up git hooks. Create a pre-commit file, as shown below.\n\n```bash\necho -e '\n#!/bin/sh\nmake ci\n' \u003e .git/hooks/pre-commit\nchmod ug+x .git/hooks/*\n```\n\n## Make commands\n\nWe have some make commands to make things run better, please refer to the [Makefile](./Makefile) to see them.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjosephmachado%2Fsocialetl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjosephmachado%2Fsocialetl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjosephmachado%2Fsocialetl/lists"}