:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.
Python ab-testingai-analyticsanalyticscdpdata-warehouseexperimentsfeature-flagsjavascriptproduct-analyticspythonreactsession-replaysurveystypescriptweb-analytics
from __future__ import annotations
from datetime import timedelta
from typing import TYPE_CHECKING
from django.db import models
from posthog.models.utils import CreatedMetaFields, UpdatedMetaFields, UUIDModel
if TYPE_CHECKING:
from posthog.models import Team
DEFAULT_DAG_NAME = "Default"
class DAG(UUIDModel, CreatedMetaFields, UpdatedMetaFields):
team = models.ForeignKey("posthog.Team", on_delete=models.CASCADE, related_name="+")
team_id: int
name = models.TextField(max_length=2048, db_index=True)
description = models.TextField(blank=True, default="")
source_control_path = models.TextField(
blank=True, default="", help_text="Directory path in the source control repository for synced DAGs"
)
sync_frequency_interval = models.DurationField(default=timedelta(days=1), null=True, blank=True)
@classmethod
def get_or_create_default(cls, team: Team) -> DAG:
dag, _ = cls.objects.get_or_create(team=team, name=DEFAULT_DAG_NAME)
return dag
class Meta:
db_table = "posthog_datamodelingdag"
constraints = [
models.UniqueConstraint(
name="name_unique_within_team",
fields=["team", "name"],
),
]