semvec/pypi-packages huggingface dataset:
pytest-dbt-postgres 0.2.0
Pytest tooling to unittest DBT & Postgres models
Requires Python: <4.0,>=3.10

# PyTest DBT Postgres

This project aims to provide an easy way to validate a DBT project by enabling the
unit-testing capability.

## Dependencies

This project is based on the [pytest-postgresql](https://pypi.org/project/pytest-postgresql/) library, so we can
validate our DBT postgres project without relying on an existing database.

## Usage

The initial idea resides on pytest-postgres providing us an empty and isolated postgres where we can
validate different use-cases with our DBT code.

> If your project uses external sources, you will need to make sure they are properly defined in the yml files, since
> the project generates the DDLs from there.

```python
import unittest

from pytest_dbt_postgres import auto_inject_fixtures
from pytest_dbt_postgres.dbt_executor import DbtExecutor
from pytest_dbt_postgres.dbt_validator import DbtValidator
from pytest_dbt_postgres.postgres.connector import PostgresConnector
from pytest_dbt_postgres.postgres.sql_methods import export_credentials_to_env, get_credentials

dbt_project_dir = '...'
resources_folder = '...'


@auto_inject_fixtures("postgresql")
class TestDbtValidator(unittest.TestCase):
    def setUp(self) -> None:
        credentials = get_credentials(self.postgresql)
        self.connector = PostgresConnector(credentials)

        # SETUP
        export_credentials_to_env(credentials)
        executor = DbtExecutor(dbt_project_dir=dbt_project_dir, profiles_dir=resources_folder)
        self.validator = DbtValidator(connector=self.connector, executor=executor, resources_folder=resources_folder)

    def test_orders(self) -> None:
        # GIVEN
        sources_to_load = [
            ("external.customers", "csv/input/customers.csv"),
            ("external.orders", "csv/input/orders.csv"),
        ]
        selector = "orders"
        outputs_to_validate = [
            ("dbt_unittest.orders", "csv/output/orders.csv"),
        ]
        # THEN
        self.validator.validate(sources_to_load, selector, outputs_to_validate)
```
minedag 1.3
Mine realisation of DAG

# Mine DAG
Mine realisation of DAG


# Install

```bash
pip install minedag
```

# Usage

Initialize

```python
from minedag import MineDag

# create structure
dag = MineDag()

# add nodes
dag.add_node(1)
dag.add_node(2)
dag.add_node(3)
dag.add_node(4)

# add edges
dag.add_edge(1, 2, weight=1)
dag.add_edge(1, 3, weight=2)
dag.add_edge(2, 4, weight=3)
dag.add_edge(3, 4, weight=4)

```

Use methods (not all presented here, for more read the sources):
```python

dag.get_all_roots()  # {1}
dag.get_leaves()  # {4}

dag.get_all_srcs(2)  # {1}
dag.get_all_dsts(2)  # {4}

dag.get_layer_iterations({1}) # [{1}, {2, 3}, {4}]

dag.find_longest_way_to_any_leaf(1)  # 4, [2, 4] - (weight, path) 
```