diff --git a/posthog/temporal/tests/data_modeling/test_run_workflow.py b/posthog/temporal/tests/data_modeling/test_run_workflow.py index acf161b01a8f0..96ff4dab59d00 100644 --- a/posthog/temporal/tests/data_modeling/test_run_workflow.py +++ b/posthog/temporal/tests/data_modeling/test_run_workflow.py @@ -41,6 +41,7 @@ from posthog.warehouse.models.table import DataWarehouseTable from posthog.warehouse.models.modeling import DataWarehouseModelPath from posthog.warehouse.util import database_sync_to_async +from dlt.common.normalizers.naming.snake_case import NamingConvention pytestmark = [pytest.mark.asyncio, pytest.mark.django_db] @@ -131,6 +132,7 @@ async def test_create_table_activity(activity_environment, ateam): table = await DataWarehouseTable.objects.aget(name=saved_query.name) assert table.name == saved_query.name + assert NamingConvention().normalize_identifier(saved_query.name) in table.url_pattern @pytest.mark.parametrize( diff --git a/posthog/warehouse/models/datawarehouse_saved_query.py b/posthog/warehouse/models/datawarehouse_saved_query.py index cecff4a1889e9..cfa833e0c6719 100644 --- a/posthog/warehouse/models/datawarehouse_saved_query.py +++ b/posthog/warehouse/models/datawarehouse_saved_query.py @@ -19,6 +19,7 @@ ) from posthog.hogql.database.s3_table import S3Table from posthog.warehouse.util import database_sync_to_async +from dlt.common.normalizers.naming.snake_case import NamingConvention def validate_saved_query_name(value): @@ -137,9 +138,8 @@ def folder_path(self): @property def url_pattern(self): - return ( - f"https://{settings.AIRBYTE_BUCKET_DOMAIN}/dlt/team_{self.team.pk}_model_{self.id.hex}/modeling/{self.name}" - ) + normalized_name = NamingConvention().normalize_identifier(self.name) + return f"https://{settings.AIRBYTE_BUCKET_DOMAIN}/dlt/team_{self.team.pk}_model_{self.id.hex}/modeling/{normalized_name}" def hogql_definition(self, modifiers: Optional[HogQLQueryModifiers] = None) -> Union[SavedQuery, S3Table]: from posthog.warehouse.models.table import CLICKHOUSE_HOGQL_MAPPING