Skip to content

Commit

Permalink
Add poetry tests group and add IBM DB2 instructions
Browse files Browse the repository at this point in the history
  • Loading branch information
NMAC427 committed Jul 18, 2023
1 parent 764208a commit 3b47de8
Show file tree
Hide file tree
Showing 5 changed files with 117 additions and 44 deletions.
3 changes: 3 additions & 0 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ jobs:
uses: ./.github/actions/setup
with:
python-version: ${{ matrix.python-version }}
poetry-flags: --all-extras --with=tests

- name: Start Docker Compose
uses: isbang/compose-action@v1.4.1
Expand All @@ -60,3 +61,5 @@ jobs:
- name: Run Tests
uses: ./.github/actions/test
with:
arguments: --postgres
28 changes: 28 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,3 +54,31 @@ Conda-forge packages are updated via:
- update `recipe/meta.yaml`
- test meta.yaml in transform repo: `conda-build build ../pydiverse-transform-feedstock/recipe/meta.yaml`
- commit `recipe/meta.yaml` to branch of fork and submit PR

## Testing more database backends

To facilitate easy testing, we provide a Docker Compose file to start all required servers.
Just run `docker compose up` in the root directory of the project to start everything, and then run `pytest` in a new tab.

Afterwards you can run:

```bash
poetry run pytest --postgres --mssql
```

## Testing db2 functionality

For running @pytest.mark.ibm_db2 tests, you need to spin up a docker container without `docker compose` since it needs
the `--priviledged` option which `docker compose` does not offer.

```bash
docker run -h db2server --name db2server --restart=always --detach --privileged=true -p 50000:50000 --env-file docker_db2.env_list -v /Docker:/database ibmcom/db2
```

Then check `docker logs db2server | grep -i completed` until you see `(*) Setup has completed.`.

Afterwards you can run:

```bash
poetry run pytest --ibm_db2
```
109 changes: 67 additions & 42 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

14 changes: 12 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,21 @@ black = { version = "23.3.0", extras = ["d"] }
ruff = "^0.0.270"
pre-commit = ">=2.20.0"

psycopg2 = ">=2.9.3"
pyodbc = "^4.0.34"
duckdb = "^0.8.1"
duckdb-engine = "^0.9.1"

[tool.poetry.group.tests]
optional = true

[tool.poetry.group.tests.dependencies]
# Postgres
psycopg2 = ">=2.9.3"
# MSSQL
pyodbc = ">=4.0.35"
# IBM DB2
ibm-db = { version = ">=3.1.4", markers="platform_machine == 'x86_64'" }
ibm-db-sa = { version = ">=0.3.8", markers="platform_machine == 'x86_64'" }

[tool.poetry.group.docs]
optional = true

Expand Down
7 changes: 7 additions & 0 deletions src/pydiverse/transform/core/ops/window.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,10 @@ class RowNumber(Window, Nullary):
signatures = [
"-> int",
]


class Rank(Window, Nullary):
name = "rank"
signatures = [
"-> int",
]

0 comments on commit 3b47de8

Please sign in to comment.