Skip to content

Commit e19cc27

Browse files
committed
apache pinot support
1 parent a1ad1d7 commit e19cc27

33 files changed

+1302
-9
lines changed

.github/workflows/test-pinot.yml

+63
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
name: test-pinot
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
branches:
9+
- main
10+
11+
jobs:
12+
13+
14+
15+
test:
16+
runs-on: ubuntu-latest
17+
strategy:
18+
matrix:
19+
python-version: [ '3.9', '3.10', '3.11', '3.12', '3.13' ]
20+
21+
22+
steps:
23+
- name: checkout
24+
uses: actions/checkout@v4
25+
26+
- name: set up python
27+
uses: actions/setup-python@v4
28+
with:
29+
python-version: ${{ matrix.python-version }}
30+
31+
- name: install poetry
32+
env:
33+
POETRY_VERSION: "2.0.1"
34+
run: |
35+
curl -sSL https://install.python-poetry.org | python -
36+
poetry config virtualenvs.create false
37+
38+
- name: cache poetry.lock dependencies
39+
id: cache-poetry-deps
40+
uses: actions/cache@v4
41+
with:
42+
path: ${{ env.pythonLocation }}
43+
key: ${{ runner.os }}-${{ env.pythonLocation }}-${{ hashFiles('poetry.lock') }}-test-pinot
44+
45+
- name: install dependencies
46+
if: steps.cache-poetry-deps.outputs.cache-hit != 'true'
47+
run: poetry install -E pinotdb
48+
49+
# we only have to start the cluster - no tables needed in ci bc http table queries are recorded w/ vcr
50+
- name: start pinot cluster
51+
run: make startpinot
52+
53+
- name: test
54+
env:
55+
PYTHON_VERSION: ${{ matrix.python-version }}
56+
run: |
57+
poetry run pytest -m "pinot" --cov=. --cov-branch -v --durations=25 --cov-report=xml
58+
59+
- uses: codecov/codecov-action@v5
60+
with:
61+
fail_ci_if_error: true
62+
flags: ${{ matrix.python-version}}-mssql
63+
token: ${{ secrets.CODECOV_TOKEN }}

Makefile

+42
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,45 @@ resetlock: ## reset the poetry lock file from main
7171
rm poetry.lock
7272
git checkout main poetry.lock
7373
poetry lock --no-update
74+
75+
waitforpinot:
76+
@echo "Waiting for Pinot container to be healthy..."
77+
@timeout=60; \
78+
while [ $$timeout -gt 0 ]; do \
79+
status=$$(docker inspect -f '{{.State.Health.Status}}' pinot-quickstart); \
80+
if [ "$$status" = "healthy" ]; then \
81+
echo "Pinot container is healthy and ready!"; \
82+
exit 0; \
83+
elif [ "$$status" = "unhealthy" ]; then \
84+
echo "ERROR: Pinot container became unhealthy."; \
85+
exit 1; \
86+
fi; \
87+
echo "Waiting for container to be healthy... ($$timeout seconds left)"; \
88+
sleep 2; \
89+
timeout=$$((timeout - 2)); \
90+
done; \
91+
echo "ERROR: Pinot container did not become healthy within the timeout period."; \
92+
exit 1
93+
94+
pinottables:
95+
@poetry run python scripts/seed_pinot.py
96+
echo "Pinot successfully started and seeded!"
97+
98+
startpinot: # starts apache pinot batch processing quick start
99+
@echo "Staring apache pinot"
100+
@docker run -d --name pinot-quickstart -p 9000:9000 \
101+
-p 8099:8000 \
102+
--health-cmd="curl -f http://localhost:9000/health || exit 1" \
103+
--health-interval=10s \
104+
--health-timeout=5s \
105+
--health-retries=3 \
106+
--health-start-period=5s \
107+
apachepinot/pinot:latest QuickStart -type empty
108+
109+
stoppinot:
110+
@docker stop pinot-quickstart
111+
@docker rm pinot-quickstart
112+
113+
pinot: startpinot waitforpinot pinottables
114+
115+
resetpinot: stoppinot pinot

poetry.lock

+185-6
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pydapper/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
from .main import using_async
88
from .mssql import PymssqlCommands as _PymssqlCommands
99
from .mysql import MySqlConnectorPythonCommands as _MySqlConnectorPythonCommands
10+
from .pinot import PinotDbCommands as _PinotDbCommands
1011
from .postgresql import AiopgCommands as _AioPgCommand
1112
from .postgresql import Psycopg2Commands as _Psycopg2Commands
1213
from .postgresql import Psycopg3Commands as _Psycopg3Commands

pydapper/dsn_parser.py

+1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
"mysql": "mysql",
1111
"oracle": "oracledb",
1212
"bigquery": "google",
13+
"pinot": "pinotdb",
1314
}
1415

1516

pydapper/pinot/__init__.py

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
from .pinotdb import PinotDbCommands

0 commit comments

Comments
 (0)