{"id":27443888,"url":"https://github.com/josephmachado/simple_dbt_project","last_synced_at":"2025-04-15T02:58:05.457Z","repository":{"id":46687120,"uuid":"258843752","full_name":"josephmachado/simple_dbt_project","owner":"josephmachado","description":"Code for dbt tutorial","archived":false,"fork":false,"pushed_at":"2024-05-31T19:16:35.000Z","size":45527,"stargazers_count":156,"open_issues_count":1,"forks_count":82,"subscribers_count":4,"default_branch":"master","last_synced_at":"2025-04-15T02:58:01.395Z","etag":null,"topics":["analytics","datawarehouse","dbt","postgres","tutorial"],"latest_commit_sha":null,"homepage":"https://www.startdataengineering.com/post/dbt-data-build-tool-tutorial","language":null,"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":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-04-25T18:17:21.000Z","updated_at":"2025-04-11T00:16:33.000Z","dependencies_parsed_at":"2024-01-15T22:48:26.775Z","dependency_job_id":"73541a9a-f909-49e7-9d66-f1c847271e17","html_url":"https://github.com/josephmachado/simple_dbt_project","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%2Fsimple_dbt_project","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/josephmachado%2Fsimple_dbt_project/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/josephmachado%2Fsimple_dbt_project/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/josephmachado%2Fsimple_dbt_project/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/josephmachado","download_url":"https://codeload.github.com/josephmachado/simple_dbt_project/tar.gz/refs/heads/master","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":["analytics","datawarehouse","dbt","postgres","tutorial"],"created_at":"2025-04-15T02:58:04.924Z","updated_at":"2025-04-15T02:58:05.439Z","avatar_url":"https://github.com/josephmachado.png","language":null,"funding_links":[],"categories":[],"sub_categories":[],"readme":"Repository for the following blogs\n\n1. [dbt(data build tool) Tutorial](https://www.startdataengineering.com/post/dbt-data-build-tool-tutorial/)\n\n# Setup\n\n## Prerequisites\n\n1. [python ^3.11](https://www.python.org/downloads/)\n2. [git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git)\n\nIn addition to the tools, you would also need to know what dbt is, you can learn about it here: [dbt tutorial](https://www.startdataengineering.com/post/dbt-data-build-tool-tutorial/).\n\nClone the git repo as shown below:\n\n```bash\ngit clone https://github.com/josephmachado/simple_dbt_project.git\ncd simple_dbt_project\n```\n\n## Demo on CodeSpaces\n\nHere is a demo of how to run this on CodeSpaces:\n\n[![dbt on codespaces demo](https://img.youtube.com/vi/UEVuIKmx5X0/maxresdefault.jpg)](https://youtu.be/UEVuIKmx5X0)\n\nSetup python virtual environment as shown below:\n\n```bash\nrm -rf myenv\n# set up venv and run dbt\npython -m venv myenv\nsource myenv/bin/activate\npip install -r requirements.txt\n```\n\n# Run dbt \n\nRun dbt commands as shown below:\n\n```bash\ndbt clean\ndbt deps\ndbt snapshot\ndbt run \ndbt test\ndbt docs generate\ndbt docs serve\n```\n\nGo to [http://localhost:8080](http://localhost:8080) to see the dbt documentation. If you are running this on GitHub CodeSpaces, follow [this section]() to expose port 8080 for access from your browser.\n\nPress Ctrl + c to stop the document server.\n\n# Create snapshots\n\nLet's do some testing, Insert some data into source customer table(in our case the new_customer data is appended into customers.csv), to demonstrate dbt snapshots. Since we are using duckdb and the base table is essentially data at [customer.csv](./raw_data/customer.csv) we have to append new data to this customer.csv file as shown below:\n\n```bash\n# Remove header from ./raw_data/customers_new.csv\n# and append it to ./raw_data/customers.csv\necho \"\" \u003e\u003e ./raw_data/customers.csv\ntail -n +2 ./raw_data/customer_new.csv \u003e\u003e ./raw_data/customers.csv\n\n# NOTE: Windows users need to do this manually or via powershell as\n```\n\nRun snapshot and create models again.\n\n```bash\ndbt snapshot \ndbt run \n```\n\n```bash\n# reset customers.csv\nhead -n -5 ./raw_data/customers.csv \u003e temp\ncat temp \u003e ./raw_data/customers.csv \nrm temp\n```\n\nLet's open a python REPL and check our data, as shown below:\n\n```python\nimport duckdb\ncon = duckdb.connect(\"dbt.duckdb\")\nresults = con.execute(\"select * from snapshots.customers_snapshot where customer_id = 82\").fetchall()\nfor row in results:\n    print(row)\n# NOTE: You will see 2 rows printed\nexit()\n```\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjosephmachado%2Fsimple_dbt_project","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjosephmachado%2Fsimple_dbt_project","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjosephmachado%2Fsimple_dbt_project/lists"}