Skip to content

Commit

Permalink
fix: Quality check fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
tomasfarias committed Jun 18, 2024
1 parent c56d169 commit 086d98f
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 18 deletions.
4 changes: 2 additions & 2 deletions posthog/temporal/batch_exports/redshift_batch_export.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def get_redshift_fields_from_record_schema(


async def insert_records_to_redshift(
records: collections.abc.AsyncGenerator[dict[str, typing.Any]],
records: collections.abc.AsyncGenerator[dict[str, typing.Any], None],
redshift_connection: psycopg.AsyncConnection,
schema: str | None,
table: str,
Expand Down Expand Up @@ -382,7 +382,7 @@ def map_to_record(row: dict) -> dict:

return record

async def record_generator() -> collections.abc.AsyncGenerator[dict[str, typing.Any]]:
async def record_generator() -> collections.abc.AsyncGenerator[dict[str, typing.Any], None]:
async for record_batch in record_iterator:
for record in record_batch.to_pylist():
yield map_to_record(record)
Expand Down
2 changes: 1 addition & 1 deletion posthog/temporal/common/asyncpa.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ class AsyncRecordBatchReader:

def __init__(self, bytes_iter: typing.AsyncIterator[bytes]) -> None:
self._reader = AsyncMessageReader(bytes_iter)
self._schema = None
self._schema: None | pa.Schema = None

def __aiter__(self) -> "AsyncRecordBatchReader":
return self
Expand Down
15 changes: 0 additions & 15 deletions posthog/temporal/tests/batch_exports/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@
import pytest_asyncio
from psycopg import sql

from posthog.batch_exports.service import BatchExportModel


@pytest.fixture
def interval(request) -> str:
Expand Down Expand Up @@ -59,19 +57,6 @@ def batch_export_schema(request) -> dict | None:
return None


@pytest.fixture
def batch_export_model(request) -> BatchExportModel | None:
"""A parametrizable fixture to configure a batch export schema.
By decorating a test function with @pytest.mark.parametrize("batch_export_model", ..., indirect=True)
it's possible to set the batch_export_schema that will be used to create a BatchExport.
"""
try:
return request.param
except AttributeError:
return BatchExportModel(name="events")


@pytest_asyncio.fixture
async def setup_postgres_test_db(postgres_config):
"""Fixture to manage a database for Redshift and Postgres export testing.
Expand Down

0 comments on commit 086d98f

Please sign in to comment.