{"id":24469276,"url":"https://github.com/afranzi/pytest-dbt-postgres","last_synced_at":"2026-03-11T11:38:18.906Z","repository":{"id":215115721,"uuid":"725487478","full_name":"afranzi/pytest-dbt-postgres","owner":"afranzi","description":"Unittest DBT Postgres projects","archived":false,"fork":false,"pushed_at":"2024-09-03T12:16:56.000Z","size":105,"stargazers_count":6,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-09T07:31:38.297Z","etag":null,"topics":["dbt","postgresql","test"],"latest_commit_sha":null,"homepage":"","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/afranzi.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,"zenodo":null}},"created_at":"2023-11-30T08:48:12.000Z","updated_at":"2024-12-28T16:42:58.000Z","dependencies_parsed_at":"2024-01-02T16:27:49.609Z","dependency_job_id":"2ca73264-9775-4c71-b756-95bf20858036","html_url":"https://github.com/afranzi/pytest-dbt-postgres","commit_stats":null,"previous_names":["afranzi/pytest-dbt-postgres"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/afranzi/pytest-dbt-postgres","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/afranzi%2Fpytest-dbt-postgres","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/afranzi%2Fpytest-dbt-postgres/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/afranzi%2Fpytest-dbt-postgres/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/afranzi%2Fpytest-dbt-postgres/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/afranzi","download_url":"https://codeload.github.com/afranzi/pytest-dbt-postgres/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/afranzi%2Fpytest-dbt-postgres/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30380049,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-11T06:09:32.197Z","status":"ssl_error","status_checked_at":"2026-03-11T06:09:17.086Z","response_time":84,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["dbt","postgresql","test"],"created_at":"2025-01-21T07:15:03.781Z","updated_at":"2026-03-11T11:38:18.882Z","avatar_url":"https://github.com/afranzi.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# PyTest DBT Postgres\n\nThis project aims to provide an easy way to validate a DBT project by enabling the\nunit-testing capability.\n\n## Dependencies\n\nThis project is based on the [pytest-postgresql](https://pypi.org/project/pytest-postgresql/) library, so we can\nvalidate our DBT postgres project without relying on an existing database.\n\n## Usage\n\nThe initial idea resides on pytest-postgres providing us an empty and isolated postgres where we can\nvalidate different use-cases with our DBT code.\n\n\u003e If your project uses external sources, you will need to make sure they are properly defined in the yml files, since\n\u003e the project generates the DDLs from there.\n\n```python\nimport unittest\n\nfrom pytest_dbt_postgres import auto_inject_fixtures\nfrom pytest_dbt_postgres.dbt_executor import DbtExecutor\nfrom pytest_dbt_postgres.dbt_validator import DbtValidator\nfrom pytest_dbt_postgres.postgres.connector import PostgresConnector\nfrom pytest_dbt_postgres.postgres.sql_methods import export_credentials_to_env, get_credentials\n\ndbt_project_dir = '...'\nresources_folder = '...'\n\n\n@auto_inject_fixtures(\"postgresql\")\nclass TestDbtValidator(unittest.TestCase):\n    def setUp(self) -\u003e None:\n        credentials = get_credentials(self.postgresql)\n        self.connector = PostgresConnector(credentials)\n\n        # SETUP\n        export_credentials_to_env(credentials)\n        executor = DbtExecutor(dbt_project_dir=dbt_project_dir, profiles_dir=resources_folder)\n        self.validator = DbtValidator(connector=self.connector, executor=executor, resources_folder=resources_folder)\n\n    def test_orders(self) -\u003e None:\n        # GIVEN\n        sources_to_load = [\n            (\"external.customers\", \"csv/input/customers.csv\"),\n            (\"external.orders\", \"csv/input/orders.csv\"),\n        ]\n        selector = \"orders\"\n        outputs_to_validate = [\n            (\"dbt_unittest.orders\", \"csv/output/orders.csv\"),\n        ]\n        # THEN\n        self.validator.validate(sources_to_load, selector, outputs_to_validate)\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fafranzi%2Fpytest-dbt-postgres","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fafranzi%2Fpytest-dbt-postgres","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fafranzi%2Fpytest-dbt-postgres/lists"}