repo
stringclasses
454 values
file_path
stringlengths
5
201
extension
stringclasses
1 value
content
stringlengths
8
509k
num_lines
int64
3
16.9k
size_bytes
int64
8
511k
posthog
posthog/hogql/database/postgres_utils.py
.py
from __future__ import annotations import dataclasses from collections.abc import Sequence from typing import TYPE_CHECKING, Any, Protocol from posthog.hogql.database.direct_sql_table import DirectSQLTable from posthog.hogql.database.lazy_join_tags import FOREIGN_KEY from posthog.hogql.database.models import LazyJoin...
293
9,938
posthog
posthog/hogql/database/argmax.py
.py
from collections.abc import Callable from typing import Optional from posthog.hogql.ast import SelectQuery from posthog.hogql.parser import parse_expr def argmax_select( table_name: str, select_fields: dict[str, list[str | int]], group_fields: list[str], argmax_field: str, deleted_field: Optional...
86
3,202
posthog
posthog/hogql/database/models.py
.py
import datetime from dataclasses import dataclass, field from typing import TYPE_CHECKING, Any, Literal, Optional, cast from pydantic import ( BaseModel, ConfigDict, Field as PydanticField, ) from posthog.hogql.base import Expr from posthog.hogql.constants import HogQLQuerySettings from posthog.hogql.erro...
549
18,513
posthog
posthog/hogql/database/direct_motherduck_table.py
.py
from posthog.hogql.database.direct_sql_table import DirectSQLTable from posthog.hogql.database.models import FieldOrTable from posthog.hogql.errors import QueryError from posthog.hogql.escape_sql import escape_duckdb_identifier class DirectMotherDuckTable(DirectSQLTable): motherduck_database: str motherduck_s...
48
1,970
posthog
posthog/hogql/database/direct_clickhouse_table.py
.py
from posthog.hogql.database.direct_sql_table import DirectSQLTable from posthog.hogql.errors import QueryError from posthog.hogql.escape_sql import escape_clickhouse_identifier class DirectClickHouseTable(DirectSQLTable): # ClickHouse namespaces a table as database.table (there is no separate catalog level). ...
26
1,249
posthog
posthog/hogql/database/postgres_table.py
.py
from functools import cache from typing import Optional, cast from django.conf import settings from psycopg.conninfo import conninfo_to_dict from posthog.hogql.base import Expr from posthog.hogql.context import HogQLContext from posthog.hogql.database.models import FunctionCallTable from posthog.hogql.escape_sql imp...
142
6,749
posthog
posthog/hogql/database/s3_table.py
.py
import re from dataclasses import dataclass from pathlib import PurePosixPath from typing import Literal, Optional from urllib.parse import urlparse, urlunparse from django.conf import settings from posthog.hogql.context import HogQLContext from posthog.hogql.database.models import FunctionCallTable from posthog.hogq...
319
11,130
posthog
posthog/hogql/database/direct_snowflake_table.py
.py
from posthog.hogql.database.direct_sql_table import DirectSQLTable from posthog.hogql.database.models import FieldOrTable from posthog.hogql.errors import QueryError from posthog.hogql.escape_sql import escape_snowflake_identifier class DirectSnowflakeTable(DirectSQLTable): snowflake_catalog: str | None = None ...
52
2,140
posthog
posthog/hogql/database/database.py
.py
from __future__ import annotations import io import copy import pickle import threading import dataclasses import pickletools from collections import defaultdict from collections.abc import Callable, Mapping, Sequence from datetime import UTC, datetime from functools import cache from types import MappingProxyType fro...
2,926
147,849
posthog
posthog/hogql/database/warehouse_usage.py
.py
from dataclasses import dataclass from typing import Optional from posthog.hogql import ast from posthog.hogql.database.direct_postgres_table import DirectPostgresTable from posthog.hogql.database.s3_table import S3Table from posthog.hogql.resolver_utils import extract_base_table_types @dataclass(frozen=True) class ...
46
1,724
posthog
posthog/hogql/database/direct_postgres_table.py
.py
from posthog.hogql.database.direct_sql_table import DirectSQLTable from posthog.hogql.errors import QueryError from posthog.hogql.escape_sql import escape_postgres_identifier class DirectPostgresTable(DirectSQLTable): postgres_catalog: str | None = None postgres_schema: str postgres_table_name: str so...
35
1,434
posthog
posthog/hogql/database/direct_mysql_table.py
.py
from posthog.hogql.database.direct_sql_table import DirectSQLTable from posthog.hogql.errors import QueryError from posthog.hogql.escape_sql import escape_mysql_identifier class DirectMySQLTable(DirectSQLTable): # In MySQL a "schema" and a "database" are the same namespace; this holds the # database the table...
27
1,010
posthog
posthog/hogql/database/direct_redshift_table.py
.py
from posthog.hogql.database.direct_postgres_table import DirectPostgresTable class DirectRedshiftTable(DirectPostgresTable): """A table queried live against Amazon Redshift. Redshift is a fork of Postgres and shares its table-reference syntax (``"schema"."table"``, optionally catalog-qualified, double-qu...
15
787
posthog
posthog/hogql/database/lazy_join_registry.py
.py
from collections.abc import Callable from typing import TYPE_CHECKING from posthog.hogql.database import lazy_join_tags as tags from posthog.hogql.database.schema.error_tracking_fingerprint_issue_state import ( join_with_error_tracking_fingerprint_issue_state_table, ) from posthog.hogql.database.schema.error_track...
97
5,217
posthog
posthog/hogql/database/test/test_s3_table_duckdb.py
.py
import pytest from parameterized import parameterized from posthog.hogql.context import HogQLContext from posthog.hogql.database.s3_table import DuckDBS3Source, S3Table, parse_duckdb_s3_source from posthog.hogql.errors import ExposedHogQLError class TestParseDuckDBS3Source: @parameterized.expand( [ ...
167
6,125
posthog
posthog/hogql/database/test/test_database.py
.py
import io import json import pickle import dataclasses from typing import Any, cast import pytest from posthog.test.base import BaseTest, FuzzyInt, QueryMatchingTest, snapshot_postgres_queries from unittest import TestCase from unittest.mock import patch from django.conf import settings from django.test import overri...
3,848
162,804
posthog
posthog/hogql/database/test/tables.py
.py
from posthog.hogql.database.models import ( DateDatabaseField, FieldOrTable, FloatDatabaseField, IntegerDatabaseField, SavedQuery, ) from posthog.hogql.database.s3_table import DataWarehouseTable fields: dict[str, FieldOrTable] = { "Date": DateDatabaseField(name="Date"), "Open": FloatDataba...
55
1,515
posthog
posthog/hogql/database/test/test_argmax.py
.py
from posthog.test.base import BaseTest from posthog.hogql import ast from posthog.hogql.database.argmax import argmax_select class TestArgmax(BaseTest): def test_argmax_select(self): response = argmax_select( table_name="raw_persons", select_fields={"moo": ["properties", "moo"], "...
101
3,954
posthog
posthog/hogql/database/test/test_s3_table.py
.py
from typing import Literal from posthog.test.base import BaseTest from unittest import mock from django.conf import settings from django.test import override_settings from posthog.hogql.constants import MAX_SELECT_RETURNED_ROWS from posthog.hogql.context import HogQLContext from posthog.hogql.database.database impor...
465
21,150
posthog
posthog/hogql/database/test/test_warehouse_usage.py
.py
from posthog.test.base import BaseTest from django.contrib.auth.models import AnonymousUser from parameterized import parameterized from posthog.hogql.context import HogQLContext from posthog.hogql.database.database import Database from posthog.hogql.database.warehouse_usage import WarehouseSourceUsage, extract_ware...
141
5,737
posthog
posthog/hogql/database/test/test_s3_table_clickhouse.py
.py
"""Integration tests for S3/Parquet queries via ClickHouse.""" import uuid import datetime from posthog.test.base import BaseTest, ClickhouseTestMixin import boto3 import pyarrow as pa import pyarrow.parquet as pq from botocore.config import Config from botocore.exceptions import ClientError from posthog.clickhouse...
162
6,165
posthog
posthog/hogql/database/test/test_lazy_join_resolvers.py
.py
import json from collections.abc import Iterator from posthog.test.base import BaseTest from django.test import SimpleTestCase from parameterized import parameterized from posthog.schema import HogQLQueryModifiers, PersonsOnEventsMode, SessionTableVersion from posthog.hogql import ast from posthog.hogql.context im...
243
10,327
posthog
posthog/hogql/database/test/test_postgres_table.py
.py
from functools import lru_cache from typing import Literal from posthog.test.base import BaseTest from django.apps import apps from django.db.models import ForeignKey, Model from django.test import SimpleTestCase from django.urls import get_resolver from parameterized import parameterized from posthog.hogql.context...
584
31,840
posthog
posthog/hogql/database/test/test_database_schema_payload.py
.py
import json import time from posthog.test.base import BaseTest from posthog.hogql.context import HogQLContext from posthog.hogql.database.database import Database from products.warehouse_sources.backend.facade.models import DataWarehouseCredential, DataWarehouseTable TABLE_COUNT = 40 COLUMN_COUNT = 120 class Test...
65
2,912
posthog
posthog/hogql/database/test/test_view.py
.py
from typing import Literal from posthog.test.base import BaseTest from django.test import override_settings from posthog.hogql.context import HogQLContext from posthog.hogql.database.database import Database from posthog.hogql.database.models import TableNode from posthog.hogql.database.test.tables import ( crea...
110
4,642
posthog
posthog/hogql/database/schema/session_replay_features.py
.py
from posthog.hogql.database.models import ( DatabaseField, DateTimeDatabaseField, FieldOrTable, FloatDatabaseField, IntegerDatabaseField, StringDatabaseField, Table, ) class SessionReplayFeaturesTable(Table): description: str = ( "Per-session behavioural feature aggregates deri...
120
6,931
posthog
posthog/hogql/database/schema/traffic_type.py
.py
from typing import Optional from posthog.hogql import ast from posthog.hogql.database.models import ExpressionField def user_agent_expr(properties_path: Optional[list[str]] = None) -> ast.Expr: # Intentionally no fallback to properties.$user_agent: that property has no materialized # column, so referencing i...
66
2,668
posthog
posthog/hogql/database/schema/sessions_v1.py
.py
import re from typing import TYPE_CHECKING, Optional, cast from posthog.hogql import ast from posthog.hogql.context import HogQLContext from posthog.hogql.database.models import ( BooleanDatabaseField, DatabaseField, DateTimeDatabaseField, FieldOrTable, FloatDatabaseField, IntegerDatabaseField,...
576
25,921
posthog
posthog/hogql/database/schema/person_distinct_id_overrides.py
.py
from posthog.hogql.ast import SelectQuery from posthog.hogql.constants import HogQLQuerySettings from posthog.hogql.context import HogQLContext from posthog.hogql.database.argmax import argmax_select from posthog.hogql.database.lazy_join_tags import PERSONS from posthog.hogql.database.models import ( BooleanDatabas...
117
4,223
posthog
posthog/hogql/database/schema/web_goals_preaggregated.py
.py
from pydantic import Field from posthog.hogql.constants import HogQLQuerySettings from posthog.hogql.database.models import ( DateTimeDatabaseField, FieldOrTable, IntegerDatabaseField, StringDatabaseField, Table, UnknownDatabaseField, ) from posthog.clickhouse.preaggregation.web_goals_preaggre...
54
2,319
posthog
posthog/hogql/database/schema/channel_type.py
.py
from dataclasses import dataclass from functools import cache from typing import TYPE_CHECKING, Optional, Union from posthog.schema_enums import CustomChannelField, CustomChannelOperator, DefaultChannelTypes if TYPE_CHECKING: from posthog.schema import CustomChannelRule from posthog.hogql import ast from posthog...
385
14,058
posthog
posthog/hogql/database/schema/logs.py
.py
from posthog.hogql.database.models import ( DANGEROUS_NoTeamIdCheckTable, DateTimeDatabaseField, FieldOrTable, IntegerDatabaseField, MapStringDatabaseField, StringDatabaseField, StringJSONDatabaseField, Table, ) from posthog.clickhouse.workload import Workload # 50GB - limit for user-p...
169
7,873
posthog
posthog/hogql/database/schema/marketing_touchpoints_preaggregated.py
.py
from pydantic import Field from posthog.hogql.constants import HogQLQuerySettings from posthog.hogql.database.models import ( DateDatabaseField, DateTimeDatabaseField, FieldOrTable, IntegerDatabaseField, StringDatabaseField, Table, ) from posthog.clickhouse.preaggregation.marketing_touchpoints...
62
2,364
posthog
posthog/hogql/database/schema/marketing_costs_preaggregated.py
.py
from pydantic import Field from posthog.hogql import ast from posthog.hogql.constants import HogQLQuerySettings from posthog.hogql.database.models import ( DateDatabaseField, DateTimeDatabaseField, ExpressionField, FieldOrTable, FloatDatabaseField, IntegerDatabaseField, StringDatabaseField,...
90
4,296
posthog
posthog/hogql/database/schema/query_log_archive.py
.py
from typing import Any from posthog.hogql import ast from posthog.hogql.database.models import ( BooleanDatabaseField, DatabaseField, DateDatabaseField, DateTimeDatabaseField, FieldOrTable, IntegerDatabaseField, LazyTable, LazyTableToAdd, StringDatabaseField, Table, ) QUERY_LOG...
260
12,535
posthog
posthog/hogql/database/schema/exchange_rate.py
.py
from typing import TYPE_CHECKING from posthog.hogql import ast from posthog.hogql.database.models import ( DANGEROUS_NoTeamIdCheckTable, DateDatabaseField, DecimalDatabaseField, FieldOrTable, StringDatabaseField, ) from posthog.dataclasses import frozen from posthog.exchange_rate_constants import ...
132
4,697
posthog
posthog/hogql/database/schema/cohort_membership.py
.py
from posthog.hogql.database.models import ( DateTimeDatabaseField, FieldOrTable, IntegerDatabaseField, StringDatabaseField, Table, UUIDDatabaseField, ) class CohortMembershipTable(Table): """Table tracking realtime cohort membership changes.""" description: str = ( "Realtime c...
42
1,492
posthog
posthog/hogql/database/schema/sessions_v3.py
.py
import re from typing import TYPE_CHECKING, Optional, cast from posthog.hogql import ast from posthog.hogql.context import HogQLContext from posthog.hogql.database.models import ( BooleanDatabaseField, DatabaseField, DateTimeDatabaseField, FieldOrTable, FloatDatabaseField, IntegerDatabaseField,...
654
30,448
posthog
posthog/hogql/database/schema/persons_pdi.py
.py
from typing import TYPE_CHECKING import posthoganalytics from posthog.hogql.ast import SelectQuery from posthog.hogql.constants import HogQLQuerySettings from posthog.hogql.context import HogQLContext from posthog.hogql.database.argmax import argmax_select from posthog.hogql.database.models import ( FieldOrTable,...
119
4,626
posthog
posthog/hogql/database/schema/experiment_metric_events_preaggregated.py
.py
from pydantic import Field from posthog.hogql.constants import HogQLQuerySettings from posthog.hogql.database.models import ( DateTimeDatabaseField, FieldOrTable, FloatDatabaseField, IntegerDatabaseField, StringDatabaseField, Table, ) from posthog.clickhouse.preaggregation.experiment_metric_ev...
56
2,434
posthog
posthog/hogql/database/schema/pg_embeddings.py
.py
from posthog.hogql.database.models import ( DateTimeDatabaseField, FieldOrTable, FloatArrayDatabaseField, IntegerDatabaseField, StringDatabaseField, StringJSONDatabaseField, Table, ) class PgEmbeddingsTable(Table): description: str = "General-purpose vector embeddings keyed by domain a...
48
1,847
posthog
posthog/hogql/database/schema/static_cohort_people.py
.py
from posthog.hogql.database.lazy_join_tags import PERSONS from posthog.hogql.database.models import FieldOrTable, IntegerDatabaseField, LazyJoin, StringDatabaseField, Table class StaticCohortPeople(Table): description: str = ( "Membership of static cohorts β€” fixed lists of people (e.g. CSV-imported) that ...
33
1,285
posthog
posthog/hogql/database/schema/error_tracking_issue_fingerprint_overrides.py
.py
from posthog.hogql.ast import SelectQuery from posthog.hogql.constants import HogQLQuerySettings from posthog.hogql.context import HogQLContext from posthog.hogql.database.argmax import argmax_select from posthog.hogql.database.models import ( BooleanDatabaseField, FieldOrTable, IntegerDatabaseField, La...
114
4,347
posthog
posthog/hogql/database/schema/app_metrics2.py
.py
from posthog.hogql.database.models import ( DateTimeDatabaseField, FieldOrTable, IntegerDatabaseField, StringDatabaseField, Table, ) APP_METRICS2_FIELDS: dict[str, FieldOrTable] = { "team_id": IntegerDatabaseField(name="team_id", nullable=False), "app_source": StringDatabaseField( n...
52
1,844
posthog
posthog/hogql/database/schema/web_analytics_s3.py
.py
from dataclasses import dataclass, field from posthog.hogql.database.models import FieldOrTable from posthog.hogql.database.s3_table import S3Table from posthog.hogql.database.schema.web_analytics_preaggregated import ( WEB_BOUNCES_SPECIFIC_FIELDS, web_preaggregated_base_aggregation_fields, web_preaggregat...
127
4,641
posthog
posthog/hogql/database/schema/web_stats_paths_preaggregated.py
.py
from pydantic import Field from posthog.hogql.constants import HogQLQuerySettings from posthog.hogql.database.models import ( DateTimeDatabaseField, FieldOrTable, IntegerDatabaseField, StringDatabaseField, Table, UnknownDatabaseField, ) from posthog.clickhouse.preaggregation.web_stats_paths_pr...
57
2,477
posthog
posthog/hogql/database/schema/hog_invocation_results.py
.py
from posthog.hogql.database.models import ( BooleanDatabaseField, DateTimeDatabaseField, FieldOrTable, IntegerDatabaseField, StringDatabaseField, Table, ) # One row per CDP invocation lifecycle event (start + finish, plus a row per rerun). # The underlying ClickHouse table is a sharded Replacin...
65
3,673
posthog
posthog/hogql/database/schema/precalculated_person_properties.py
.py
from posthog.hogql.database.models import ( BooleanDatabaseField, DateTimeDatabaseField, FieldOrTable, IntegerDatabaseField, StringDatabaseField, Table, UUIDDatabaseField, ) class PrecalculatedPersonPropertiesTable(Table): """Table for precalculated person properties evaluations popula...
55
2,073
posthog
posthog/hogql/database/schema/document_embeddings.py
.py
from typing import Optional from posthog.hogql import ast from posthog.hogql.context import HogQLContext from posthog.hogql.database.models import ( DateTimeDatabaseField, FieldOrTable, FloatArrayDatabaseField, IntegerDatabaseField, LazyTable, LazyTableToAdd, StringDatabaseField, String...
207
7,793
posthog
posthog/hogql/database/schema/groups_revenue_analytics.py
.py
from collections import defaultdict from posthog.hogql import ast from posthog.hogql.context import HogQLContext from posthog.hogql.database.models import ( DecimalDatabaseField, FieldOrTable, IntegerDatabaseField, LazyJoinToAdd, LazyTable, LazyTableToAdd, StringDatabaseField, ) from postho...
395
16,333
posthog
posthog/hogql/database/schema/duckdb_table_functions.py
.py
from typing import Optional from posthog.hogql.database.models import ( DANGEROUS_NoTeamIdCheckTable, FieldOrTable, FunctionCallTable, IntegerDatabaseField, UnknownDatabaseField, ) from posthog.hogql.errors import QueryError _DANGEROUS_TABLE_FUNCTION_NAMES: frozenset[str] = frozenset( { ...
153
5,137
posthog
posthog/hogql/database/schema/system.py
.py
from functools import lru_cache from posthog.hogql import ast from posthog.hogql.base import Expr from posthog.hogql.context import HogQLContext from posthog.hogql.database.lazy_join_tags import TICKET_ASSIGNMENT, TICKET_TAGS from posthog.hogql.database.models import ( BooleanDatabaseField, DANGEROUS_NoTeamIdC...
2,896
153,402
posthog
posthog/hogql/database/schema/marketing_costs_precomputed.py
.py
from typing import TYPE_CHECKING import posthoganalytics from posthog.hogql import ast from posthog.hogql.context import HogQLContext from posthog.hogql.database.models import DateTimeDatabaseField, FieldOrTable, LazyTable, LazyTableToAdd from posthog.hogql.database.schema.marketing_costs_preaggregated import Marketi...
120
5,629
posthog
posthog/hogql/database/schema/precalculated_events.py
.py
from posthog.hogql.database.models import ( DateDatabaseField, DateTimeDatabaseField, FieldOrTable, IntegerDatabaseField, StringDatabaseField, Table, UUIDDatabaseField, ) class PrecalculatedEventsTable(Table): """Table for precalculated behavioral events populated by CdpRealtimeCohorts...
57
2,225
posthog
posthog/hogql/database/schema/heatmaps.py
.py
from posthog.hogql.database.models import ( BooleanDatabaseField, DateTimeDatabaseField, FieldOrTable, IntegerDatabaseField, StringDatabaseField, Table, ) class HeatmapsTable(Table): description: str = ( "Individual heatmap interactions (clicks, rage clicks, mouse moves, scrolls) c...
68
2,783
posthog
posthog/hogql/database/schema/information_schema.py
.py
"""HogQL `information_schema`: a self-describing, queryable view of the database catalog. Nested under the `system` namespace, these virtual tables let agents (and humans) discover what tables, columns, data types, relationships, and descriptions are available without leaving HogQL: SELECT * FROM system.informati...
1,700
78,632
posthog
posthog/hogql/database/schema/event_sessions.py
.py
from copy import deepcopy from typing import Optional from posthog.hogql import ast from posthog.hogql.context import HogQLContext from posthog.hogql.database.models import ( FieldOrTable, IntegerDatabaseField, LazyJoinToAdd, StringDatabaseField, VirtualTable, ) from posthog.hogql.parser import par...
211
7,165
posthog
posthog/hogql/database/schema/session_replay_events.py
.py
from datetime import datetime from posthog.hogql.ast import JoinExpr, SelectQuery from posthog.hogql.context import HogQLContext from posthog.hogql.database.lazy_join_tags import ( PERSON_DISTINCT_IDS, REPLAY_TO_CONSOLE_LOGS, REPLAY_TO_EVENTS, REPLAY_TO_SESSIONS_V1, ) from posthog.hogql.database.models...
408
17,484
posthog
posthog/hogql/database/schema/spans.py
.py
from posthog.hogql.database.models import ( BooleanDatabaseField, DateTimeDatabaseField, FieldOrTable, IntegerDatabaseField, MapStringDatabaseField, StringDatabaseField, Table, ) from posthog.clickhouse.workload import Workload class TraceSpansTable(Table): description: str = "OpenTel...
121
5,494
posthog
posthog/hogql/database/schema/groups.py
.py
from typing import cast from posthog.hogql import ast from posthog.hogql.ast import SelectQuery from posthog.hogql.context import HogQLContext from posthog.hogql.database.argmax import argmax_select from posthog.hogql.database.lazy_join_tags import GROUPS_REVENUE_ANALYTICS from posthog.hogql.database.models import ( ...
349
14,022
posthog
posthog/hogql/database/schema/table_descriptions.py
.py
"""Unified table/column description resolution shared across schema surfaces. Descriptions live in three places, resolved here in priority order per table/column: 1. the static ``FieldOrTable.description`` set on native table definitions; 2. ``WarehouseColumnAnnotation`` for physical data warehouse tables (keyed ...
140
7,246
posthog
posthog/hogql/database/schema/metrics.py
.py
from posthog.hogql.database.models import ( BooleanDatabaseField, DANGEROUS_NoTeamIdCheckTable, DateTimeDatabaseField, FieldOrTable, FloatDatabaseField, IntegerDatabaseField, MapStringDatabaseField, StringDatabaseField, StringJSONDatabaseField, Table, ) from posthog.clickhouse.w...
266
11,698
posthog
posthog/hogql/database/schema/cohort_people.py
.py
from posthog.hogql.database.lazy_join_tags import PERSONS from posthog.hogql.database.models import ( FieldOrTable, IntegerDatabaseField, LazyJoin, LazyTable, LazyTableToAdd, StringDatabaseField, Table, ) COHORT_PEOPLE_FIELDS: dict[str, FieldOrTable] = { "person_id": StringDatabaseField...
109
3,895
posthog
posthog/hogql/database/schema/ai_events.py
.py
from posthog.hogql.database.lazy_join_tags import PERSON_DISTINCT_IDS from posthog.hogql.database.models import ( BooleanDatabaseField, DateTimeDatabaseField, FieldOrTable, FieldTraverser, FloatDatabaseField, IntegerDatabaseField, LazyJoin, StringDatabaseField, StringJSONDatabaseFiel...
212
10,590
posthog
posthog/hogql/database/schema/web_vitals_paths_preaggregated.py
.py
from pydantic import Field from posthog.hogql.constants import HogQLQuerySettings from posthog.hogql.database.models import ( DateTimeDatabaseField, FieldOrTable, IntegerDatabaseField, StringDatabaseField, Table, UnknownDatabaseField, ) from posthog.clickhouse.preaggregation.web_vitals_paths_p...
66
3,033
posthog
posthog/hogql/database/schema/web_stats_preaggregated.py
.py
from pydantic import Field from posthog.hogql.constants import HogQLQuerySettings from posthog.hogql.database.models import ( DateTimeDatabaseField, FieldOrTable, IntegerDatabaseField, StringDatabaseField, Table, UnknownDatabaseField, ) from posthog.clickhouse.preaggregation.web_stats_preaggre...
58
2,512
posthog
posthog/hogql/database/schema/marketing_conversions_preaggregated.py
.py
from pydantic import Field from posthog.hogql.constants import HogQLQuerySettings from posthog.hogql.database.models import ( DateDatabaseField, DateTimeDatabaseField, FieldOrTable, FloatDatabaseField, IntegerDatabaseField, StringDatabaseField, Table, ) from posthog.clickhouse.preaggregati...
68
2,734
posthog
posthog/hogql/database/schema/web_analytics_preaggregated.py
.py
from posthog.hogql.database.models import ( BooleanDatabaseField, DatabaseField, DateTimeDatabaseField, FieldOrTable, IntegerDatabaseField, StringDatabaseField, Table, ) DEVICE_BROWSER_FIELDS = { "browser": StringDatabaseField(name="browser", nullable=True, description="Browser name of ...
185
7,139
posthog
posthog/hogql/database/schema/persons.py
.py
from typing import TYPE_CHECKING, Optional, Self, cast import posthoganalytics from posthog.hogql import ast from posthog.hogql.ast import And, CompareOperation, CompareOperationOp, Field, JoinExpr, SelectQuery from posthog.hogql.base import Expr from posthog.hogql.constants import HogQLQuerySettings from posthog.hog...
373
15,036
posthog
posthog/hogql/database/schema/experiment_exposures_preaggregated.py
.py
from pydantic import Field from posthog.hogql.constants import HogQLQuerySettings from posthog.hogql.database.models import ( DateTimeDatabaseField, FieldOrTable, IntegerDatabaseField, StringArrayDatabaseField, StringDatabaseField, Table, ) from posthog.clickhouse.preaggregation.experiment_exp...
60
2,515
posthog
posthog/hogql/database/schema/web_overview_preaggregated.py
.py
from pydantic import Field from posthog.hogql.constants import HogQLQuerySettings from posthog.hogql.database.models import ( DateTimeDatabaseField, FieldOrTable, IntegerDatabaseField, StringDatabaseField, Table, UnknownDatabaseField, ) from posthog.clickhouse.preaggregation.web_overview_preag...
68
3,135
posthog
posthog/hogql/database/schema/error_tracking_fingerprint_issue_state.py
.py
from typing import Any, Optional from posthog.hogql.ast import SelectQuery from posthog.hogql.constants import HogQLQuerySettings from posthog.hogql.context import HogQLContext from posthog.hogql.database.models import ( BooleanDatabaseField, DateTimeDatabaseField, FieldOrTable, IntegerDatabaseField, ...
304
12,116
posthog
posthog/hogql/database/schema/person_distinct_ids.py
.py
from posthog.hogql.ast import SelectQuery from posthog.hogql.constants import HogQLQuerySettings from posthog.hogql.context import HogQLContext from posthog.hogql.database.argmax import argmax_select from posthog.hogql.database.lazy_join_tags import PERSONS from posthog.hogql.database.models import ( BooleanDatabas...
111
3,930
posthog
posthog/hogql/database/schema/log_entries.py
.py
from posthog.hogql import ast from posthog.hogql.database.models import ( DateTimeDatabaseField, FieldOrTable, IntegerDatabaseField, LazyTable, LazyTableToAdd, StringDatabaseField, Table, ) LOG_ENTRIES_FIELDS: dict[str, FieldOrTable] = { "team_id": IntegerDatabaseField(name="team_id", n...
100
3,656
posthog
posthog/hogql/database/schema/preaggregation_results.py
.py
from pydantic import Field from posthog.hogql.constants import HogQLQuerySettings from posthog.hogql.database.models import ( DatabaseField, DateTimeDatabaseField, FieldOrTable, IntegerDatabaseField, StringArrayDatabaseField, StringDatabaseField, Table, ) from posthog.clickhouse.preaggrega...
54
2,040
posthog
posthog/hogql/database/schema/sessions_v2.py
.py
import re from typing import TYPE_CHECKING, Optional, cast from posthog.hogql import ast from posthog.hogql.context import HogQLContext from posthog.hogql.database.models import ( BooleanDatabaseField, DatabaseField, DateTimeDatabaseField, FieldOrTable, FloatDatabaseField, IntegerDatabaseField,...
861
41,041
posthog
posthog/hogql/database/schema/numbers.py
.py
from typing import Optional from posthog.hogql.database.models import ( DANGEROUS_NoTeamIdCheckTable, FieldOrTable, FunctionCallTable, IntegerDatabaseField, ) NUMBERS_TABLE_FIELDS: dict[str, FieldOrTable] = { "number": IntegerDatabaseField(name="number", nullable=False, description="The generated ...
32
976
posthog
posthog/hogql/database/schema/web_stats_frustration_preaggregated.py
.py
from pydantic import Field from posthog.hogql.constants import HogQLQuerySettings from posthog.hogql.database.models import ( DateTimeDatabaseField, FieldOrTable, IntegerDatabaseField, StringDatabaseField, Table, UnknownDatabaseField, ) from posthog.clickhouse.preaggregation.web_stats_frustrat...
59
2,558
posthog
posthog/hogql/database/schema/persons_revenue_analytics.py
.py
from collections import defaultdict from posthog.hogql import ast from posthog.hogql.context import HogQLContext from posthog.hogql.database.models import ( DecimalDatabaseField, FieldOrTable, IntegerDatabaseField, LazyJoinToAdd, LazyTable, LazyTableToAdd, StringDatabaseField, ) from postho...
230
10,621
posthog
posthog/hogql/database/schema/events.py
.py
from posthog.hogql.database.lazy_join_tags import ( EVENTS_TO_SESSIONS_V1, GROUP_N, PERSON_DISTINCT_IDS, PERSONS_REVENUE_ANALYTICS, ) from posthog.hogql.database.models import ( DatabaseField, DateTimeDatabaseField, FieldOrTable, FieldTraverser, IntegerDatabaseField, LazyJoin, ...
224
9,126
posthog
posthog/hogql/database/schema/test/test_system_tables.py
.py
import uuid from typing import TYPE_CHECKING from posthog.test.base import BaseTest, NonAtomicBaseTest from django.apps import apps from django.utils import timezone from parameterized import parameterized from posthog.hogql.context import HogQLContext from posthog.hogql.database.database import Database from posth...
1,496
65,439
posthog
posthog/hogql/database/schema/test/test_table_descriptions.py
.py
from posthog.test.base import APIBaseTest from parameterized import parameterized from posthog.schema import HogQLQueryModifiers from posthog.hogql.database.models import StringDatabaseField, Table from posthog.hogql.database.schema.table_descriptions import TableDescriptions from posthog.models import Team from po...
218
10,971
posthog
posthog/hogql/database/schema/test/test_document_embeddings.py
.py
from posthog.test.base import BaseTest from parameterized import parameterized from posthog.hogql import ast from posthog.hogql.context import HogQLContext from posthog.hogql.parser import parse_select from posthog.hogql.printer import prepare_ast_for_printing class TestDocumentEmbeddingsOrderByPushdown(BaseTest): ...
110
4,208
posthog
posthog/hogql/database/schema/test/test_table_query_log.py
.py
from posthog.test.base import APIBaseTest, ClickhouseTestMixin from unittest.mock import MagicMock, patch from posthog.hogql.context import HogQLContext from posthog.hogql.database.database import Database from posthog.hogql.query import execute_hogql_query from posthog.clickhouse.client import sync_execute from post...
52
2,254
posthog
posthog/hogql/database/schema/test/test_event_sessions.py
.py
from typing import cast from posthog.test.base import BaseTest from posthog.hogql import ast from posthog.hogql.context import HogQLContext from posthog.hogql.database.database import Database from posthog.hogql.database.schema.event_sessions import CleanTableNameFromChain, WhereClauseExtractor from posthog.hogql.par...
220
7,552
posthog
posthog/hogql/database/schema/test/test_sessions_v3.py
.py
import uuid from time import time_ns import pytest from posthog.test.base import ( APIBaseTest, ClickhouseTestMixin, _create_event, _create_person, snapshot_clickhouse_queries, ) from posthog.schema import FilterLogicalOperator, HogQLQueryModifiers, SessionTableVersion from posthog.hogql import a...
830
26,746
posthog
posthog/hogql/database/schema/test/test_traffic_type.py
.py
import pytest from posthog.hogql import ast from posthog.hogql.database.models import ExpressionField from posthog.hogql.database.schema.traffic_type import ( client_ip_expr, create_bot_name_field, create_bot_operator_field, create_is_bot_field, create_traffic_category_field, create_traffic_typ...
95
3,941
posthog
posthog/hogql/database/schema/test/test_channel_type.py
.py
import uuid from urllib.parse import parse_qs, urlparse from posthog.test.base import APIBaseTest, ClickhouseTestMixin, _create_event, _create_person from parameterized import parameterized from posthog.schema import CustomChannelCondition, CustomChannelRule, FilterLogicalOperator, HogQLQueryModifiers from posthog....
929
37,373
posthog
posthog/hogql/database/schema/test/test_session_replay_features.py
.py
from posthog.test.base import BaseTest from parameterized import parameterized from posthog.hogql.context import HogQLContext from posthog.hogql.database.database import Database from posthog.hogql.database.models import ( DatabaseField, DateTimeDatabaseField, FloatDatabaseField, IntegerDatabaseField,...
96
4,531
posthog
posthog/hogql/database/schema/test/test_session_replay_events.py
.py
from datetime import timedelta from freezegun import freeze_time from posthog.test.base import ( APIBaseTest, ClickhouseTestMixin, _create_event, _create_person, flush_persons_and_events, snapshot_clickhouse_queries, ) from django.utils.timezone import now from parameterized import parameteri...
517
17,917
posthog
posthog/hogql/database/schema/test/test_cohort_people.py
.py
from posthog.test.base import APIBaseTest, ClickhouseTestMixin from posthog.hogql.parser import parse_select from posthog.hogql.query import execute_hogql_query from posthog.test.persons import create_person from products.cohorts.backend.models.cohort import Cohort class TestCohortPeopleTable(ClickhouseTestMixin, ...
83
2,934
posthog
posthog/hogql/database/schema/test/test_groups.py
.py
from datetime import datetime from posthog.test.base import APIBaseTest, ClickhouseTestMixin from parameterized import parameterized from posthog.hogql.parser import parse_select from posthog.hogql.query import execute_hogql_query from posthog.models import Team from posthog.models.group.util import create_group, r...
158
7,490
posthog
posthog/hogql/database/schema/test/test_events.py
.py
from posthog.test.base import APIBaseTest, ClickhouseTestMixin, _create_event from posthog.hogql.parser import parse_select from posthog.hogql.query import execute_hogql_query from posthog.uuidt import uuid7 class TestEvents(ClickhouseTestMixin, APIBaseTest): def test_select_star_from_events(self): sess...
31
809
posthog
posthog/hogql/database/schema/test/test_information_schema.py
.py
from posthog.test.base import APIBaseTest, ClickhouseTestMixin from parameterized import parameterized from posthog.hogql import ast from posthog.hogql.context import HogQLContext from posthog.hogql.database.database import Database from posthog.hogql.database.schema.information_schema import ( _bound_table_names...
627
29,313
posthog
posthog/hogql/database/schema/test/test_groups_join_prefilter.py
.py
from datetime import UTC, datetime from posthog.test.base import APIBaseTest from parameterized import parameterized from posthog.hogql.context import HogQLContext from posthog.hogql.database.database import Database from posthog.hogql.parser import parse_select from posthog.hogql.printer import prepare_and_print_as...
111
6,014
posthog
posthog/hogql/database/schema/test/test_groups_revenue_analytics.py
.py
from decimal import Decimal from freezegun import freeze_time from posthog.test.base import _create_event, _create_person, snapshot_clickhouse_queries from posthog.schema import ( CurrencyCode, RevenueAnalyticsEventItem, RevenueCurrencyPropertyConfig, SubscriptionDropoffMode, ) from posthog.hogql imp...
740
29,533
posthog
posthog/hogql/database/schema/test/test_ingestion_warnings.py
.py
from posthog.test.base import BaseTest from posthog.hogql.context import HogQLContext from posthog.hogql.database.database import Database from posthog.hogql.parser import parse_select from posthog.hogql.printer import prepare_and_print_ast class TestIngestionWarningsTable(BaseTest): def test_select_from_ingesti...
45
1,661
posthog
posthog/hogql/database/schema/test/test_persons.py
.py
from datetime import datetime from posthog.test.base import ( APIBaseTest, ClickhouseTestMixin, _create_event, _create_person, flush_persons_and_events, snapshot_clickhouse_queries, ) from unittest.mock import Mock, patch from parameterized import parameterized from posthog.schema import ( ...
587
25,707
posthog
posthog/hogql/database/schema/test/test_sessions_v2.py
.py
import uuid from time import time_ns from typing import cast import pytest from posthog.test.base import APIBaseTest, ClickhouseTestMixin, _create_event, _create_person from parameterized import parameterized from posthog.schema import ( BounceRatePageViewMode, FilterLogicalOperator, HogQLQueryModifiers,...
915
30,336
posthog
posthog/hogql/database/schema/test/test_web_analytics_s3.py
.py
from posthog.test.base import BaseTest from unittest.mock import patch from django.test import override_settings from posthog.hogql.database.schema.web_analytics_s3 import get_s3_function_args, get_s3_url from posthog.settings.object_storage import ( OBJECT_STORAGE_ACCESS_KEY_ID, OBJECT_STORAGE_EXTERNAL_WEB_...
83
3,292