diff --git a/posthog/api/property_definition.py b/posthog/api/property_definition.py index 983b49c1ff0e0..751b804c8e9fb 100644 --- a/posthog/api/property_definition.py +++ b/posthog/api/property_definition.py @@ -143,7 +143,7 @@ def with_properties_to_filter(self, properties_to_filter: Optional[str]) -> "Que return dataclasses.replace( self, name_filter="AND name = ANY(%(names)s)", - params={**self.params, "names": tuple(properties_to_filter.split(","))}, + params={**self.params, "names": properties_to_filter.split(",")}, ) else: return self @@ -227,7 +227,7 @@ def with_event_property_filter( event_name_join_filter=event_name_join_filter, event_name_filter=event_name_filter, event_property_join_type="INNER JOIN" if filter_by_event_names else "LEFT JOIN", - params={**self.params, "event_names": tuple(event_names or [])}, + params={**self.params, "event_names": event_names or []}, ) def with_search(self, search_query: str, search_kwargs: Dict) -> "QueryContext": @@ -241,7 +241,7 @@ def with_excluded_properties(self, excluded_properties: Optional[str], type: str if excluded_properties: excluded_properties = json.loads(excluded_properties) - excluded_list = tuple( + excluded_list = list( set.union( set(excluded_properties or []), EVENTS_HIDDEN_PROPERTY_DEFINITIONS if type == "event" else [], diff --git a/posthog/tasks/usage_report.py b/posthog/tasks/usage_report.py index a9a06ecbff7c5..d43b20e9c98af 100644 --- a/posthog/tasks/usage_report.py +++ b/posthog/tasks/usage_report.py @@ -23,7 +23,7 @@ from django.db import connection from django.db.models import Count, Q from posthoganalytics.client import Client -from psycopg2 import sql +from psycopg import sql from sentry_sdk import capture_exception from posthog import version_requirement diff --git a/posthog/temporal/tests/test_squash_person_overrides_workflow.py b/posthog/temporal/tests/test_squash_person_overrides_workflow.py index 8cde17ccb42d1..bb463e6f20627 100644 --- a/posthog/temporal/tests/test_squash_person_overrides_workflow.py +++ b/posthog/temporal/tests/test_squash_person_overrides_workflow.py @@ -5,7 +5,7 @@ from typing import TypedDict from uuid import UUID, uuid4 -import psycopg2 +import psycopg import pytest from django.conf import settings from freezegun.api import freeze_time @@ -794,8 +794,8 @@ def django_db_setup_fixture(): @pytest.fixture def pg_connection(): - """Manage a Postgres connection with psycopg2.""" - conn = psycopg2.connect( + """Manage a Postgres connection with psycopg.""" + conn = psycopg.connect( dbname=settings.DATABASES["default"]["NAME"], user=settings.DATABASES["default"]["USER"], password=settings.DATABASES["default"]["PASSWORD"], diff --git a/posthog/temporal/workflows/squash_person_overrides.py b/posthog/temporal/workflows/squash_person_overrides.py index 1386964339589..3b97cbe298bca 100644 --- a/posthog/temporal/workflows/squash_person_overrides.py +++ b/posthog/temporal/workflows/squash_person_overrides.py @@ -6,7 +6,7 @@ from typing import AsyncIterator, Iterable, NamedTuple from uuid import UUID -import psycopg2 +import psycopg from temporalio import activity, workflow from temporalio.common import RetryPolicy @@ -446,7 +446,7 @@ async def delete_squashed_person_overrides_from_postgres(inputs: QueryInputs) -> from django.conf import settings activity.logger.info("Deleting squashed persons from Postgres") - with psycopg2.connect( + with psycopg.connect( dbname=settings.DATABASES["default"]["NAME"], user=settings.DATABASES["default"]["USER"], password=settings.DATABASES["default"]["PASSWORD"],