Skip to content

Commit

Permalink
chore(deps): Upgrade Django 4.1 (#20006)
Browse files Browse the repository at this point in the history
* Upgrade to Django 4.1

* Adjust requirements

* Adjust mypy baseline

* Sync with later version

* Update query snapshots

* Update query snapshots

* Update query snapshots

* Update query snapshots

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
webjunkie and github-actions[bot] authored Feb 7, 2024
1 parent cf31c27 commit 11e4d84
Show file tree
Hide file tree
Showing 24 changed files with 177 additions and 167 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@
# ---
# name: TestOrganizationResourceAccessAPI.test_list_organization_resource_access_is_not_nplus1.11
'''
SELECT (1) AS "a"
SELECT 1 AS "a"
FROM "posthog_organizationmembership"
WHERE ("posthog_organizationmembership"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid
AND "posthog_organizationmembership"."user_id" = 2)
Expand Down Expand Up @@ -148,7 +148,7 @@
# ---
# name: TestOrganizationResourceAccessAPI.test_list_organization_resource_access_is_not_nplus1.3
'''
SELECT (1) AS "a"
SELECT 1 AS "a"
FROM "posthog_organizationmembership"
WHERE ("posthog_organizationmembership"."organization_id" = '00000000-0000-0000-0000-000000000000'::uuid
AND "posthog_organizationmembership"."user_id" = 2)
Expand Down
24 changes: 23 additions & 1 deletion mypy-baseline.txt
Original file line number Diff line number Diff line change
Expand Up @@ -255,6 +255,9 @@ posthog/hogql/resolver.py:0: error: Argument 1 to "get_child" of "Type" has inco
posthog/hogql/resolver.py:0: error: Incompatible types in assignment (expression has type "Expr", variable has type "Alias") [assignment]
posthog/hogql/resolver.py:0: error: Argument "alias" to "Alias" has incompatible type "str | int"; expected "str" [arg-type]
posthog/hogql/resolver.py:0: error: Argument 1 to "join" of "str" has incompatible type "list[str | int]"; expected "Iterable[str]" [arg-type]
posthog/temporal/data_imports/external_data_job.py:0: error: Argument "team_id" has incompatible type "int"; expected "str" [arg-type]
posthog/temporal/data_imports/external_data_job.py:0: error: Unused "type: ignore" comment [unused-ignore]
posthog/temporal/data_imports/external_data_job.py:0: error: Argument "team_id" has incompatible type "int"; expected "str" [arg-type]
posthog/temporal/data_imports/external_data_job.py:0: error: Argument 2 to "DataImportPipeline" has incompatible type "DltSource"; expected "DltResource" [arg-type]
posthog/hogql/transforms/lazy_tables.py:0: error: Incompatible default for argument "context" (default has type "None", argument has type "HogQLContext") [assignment]
posthog/hogql/transforms/lazy_tables.py:0: note: PEP 484 prohibits implicit Optional. Accordingly, mypy has changed its default to no_implicit_optional=True
Expand Down Expand Up @@ -404,8 +407,19 @@ posthog/api/person.py:0: error: Argument 1 to "loads" has incompatible type "str
posthog/api/person.py:0: error: Argument "user" to "log_activity" has incompatible type "User | AnonymousUser"; expected "User | None" [arg-type]
posthog/api/person.py:0: error: Argument "user" to "log_activity" has incompatible type "User | AnonymousUser"; expected "User | None" [arg-type]
posthog/hogql_queries/web_analytics/web_analytics_query_runner.py:0: error: Argument 1 to "append" of "list" has incompatible type "EventPropertyFilter"; expected "Expr" [arg-type]
posthog/hogql_queries/insights/trends/trends_query_runner.py:0: error: Unused "type: ignore" comment [unused-ignore]
posthog/hogql_queries/insights/trends/trends_query_runner.py:0: error: Return type "list[SelectQuery | SelectUnionQuery]" of "to_query" incompatible with return type "SelectQuery | SelectUnionQuery" in supertype "QueryRunner" [override]
posthog/hogql_queries/insights/trends/trends_query_runner.py:0: error: Signature of "to_actors_query" incompatible with supertype "QueryRunner" [override]
posthog/hogql_queries/insights/trends/trends_query_runner.py:0: note: Superclass:
posthog/hogql_queries/insights/trends/trends_query_runner.py:0: note: def to_actors_query(self) -> SelectQuery | SelectUnionQuery
posthog/hogql_queries/insights/trends/trends_query_runner.py:0: note: Subclass:
posthog/hogql_queries/insights/trends/trends_query_runner.py:0: note: def to_actors_query(self, time_frame: str | int | None, series_index: int, breakdown_value: str | int | None = ..., compare: Compare | None = ...) -> SelectQuery | SelectUnionQuery
posthog/hogql_queries/insights/trends/trends_query_runner.py:0: note: Superclass:
posthog/hogql_queries/insights/trends/trends_query_runner.py:0: note: def to_actors_query(self) -> SelectQuery | SelectUnionQuery
posthog/hogql_queries/insights/trends/trends_query_runner.py:0: note: Subclass:
posthog/hogql_queries/insights/trends/trends_query_runner.py:0: note: def to_actors_query(self, time_frame: str | int | None, series_index: int, breakdown_value: str | int | None = ..., compare: Compare | None = ...) -> SelectQuery | SelectUnionQuery
posthog/hogql_queries/insights/trends/trends_query_runner.py:0: error: Statement is unreachable [unreachable]
posthog/hogql_queries/insights/trends/trends_query_runner.py:0: error: List item 0 has incompatible type "str | float | None"; expected "str | float" [list-item]
posthog/hogql_queries/insights/trends/trends_query_runner.py:0: error: Item "None" of "BreakdownFilter | None" has no attribute "breakdown" [union-attr]
posthog/hogql_queries/insights/trends/trends_query_runner.py:0: error: Argument 1 to "FormulaAST" has incompatible type "map[Any]"; expected "list[list[float]]" [arg-type]
posthog/hogql_queries/insights/trends/trends_query_runner.py:0: error: Argument 1 to "FormulaAST" has incompatible type "map[Any]"; expected "list[list[float]]" [arg-type]
posthog/hogql_queries/insights/trends/trends_query_runner.py:0: error: Argument 1 to "_event_property" of "TrendsQueryRunner" has incompatible type "str | float | list[str | float] | None"; expected "str" [arg-type]
Expand Down Expand Up @@ -782,6 +796,14 @@ posthog/api/property_definition.py:0: error: Incompatible types in assignment (e
posthog/api/property_definition.py:0: error: Item "AnonymousUser" of "User | AnonymousUser" has no attribute "organization" [union-attr]
posthog/api/property_definition.py:0: error: Item "None" of "Organization | Any | None" has no attribute "is_feature_available" [union-attr]
posthog/api/dashboards/dashboard_templates.py:0: error: Metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases [misc]
posthog/temporal/tests/batch_exports/test_run_updates.py:0: error: Unused "type: ignore" comment [unused-ignore]
posthog/temporal/tests/batch_exports/test_run_updates.py:0: error: Unused "type: ignore" comment [unused-ignore]
posthog/temporal/tests/batch_exports/test_run_updates.py:0: error: Item "None" of "BatchExportRun | None" has no attribute "data_interval_start" [union-attr]
posthog/temporal/tests/batch_exports/test_run_updates.py:0: error: Item "None" of "BatchExportRun | None" has no attribute "data_interval_end" [union-attr]
posthog/temporal/tests/batch_exports/test_run_updates.py:0: error: Unused "type: ignore" comment [unused-ignore]
posthog/temporal/tests/batch_exports/test_run_updates.py:0: error: Item "None" of "BatchExportRun | None" has no attribute "status" [union-attr]
posthog/temporal/tests/batch_exports/test_run_updates.py:0: error: Unused "type: ignore" comment [unused-ignore]
posthog/temporal/tests/batch_exports/test_run_updates.py:0: error: Item "None" of "BatchExportRun | None" has no attribute "status" [union-attr]
posthog/temporal/tests/batch_exports/test_batch_exports.py:0: error: TypedDict key must be a string literal; expected one of ("_timestamp", "created_at", "distinct_id", "elements", "elements_chain", ...) [literal-required]
posthog/queries/app_metrics/test/test_app_metrics.py:0: error: Argument 3 to "AppMetricsErrorDetailsQuery" has incompatible type "AppMetricsRequestSerializer"; expected "AppMetricsErrorsRequestSerializer" [arg-type]
posthog/queries/app_metrics/test/test_app_metrics.py:0: error: Argument 3 to "AppMetricsErrorDetailsQuery" has incompatible type "AppMetricsRequestSerializer"; expected "AppMetricsErrorsRequestSerializer" [arg-type]
Expand Down
18 changes: 1 addition & 17 deletions posthog/api/test/__snapshots__/test_decide.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -89,22 +89,6 @@
LIMIT 21 /*controller='team-detail',route='api/projects/%28%3FP%3Cid%3E%5B%5E/.%5D%2B%29/%3F%24'*/
'''
# ---
# name: TestDecide.test_decide_doesnt_error_out_when_database_is_down.10
'''
SELECT "posthog_pluginconfig"."id",
"posthog_pluginconfig"."web_token",
"posthog_pluginsourcefile"."updated_at",
"posthog_plugin"."updated_at",
"posthog_pluginconfig"."updated_at"
FROM "posthog_pluginconfig"
INNER JOIN "posthog_plugin" ON ("posthog_pluginconfig"."plugin_id" = "posthog_plugin"."id")
INNER JOIN "posthog_pluginsourcefile" ON ("posthog_plugin"."id" = "posthog_pluginsourcefile"."plugin_id")
WHERE ("posthog_pluginconfig"."enabled"
AND "posthog_pluginsourcefile"."filename" = 'site.ts'
AND "posthog_pluginsourcefile"."status" = 'TRANSPILED'
AND "posthog_pluginconfig"."team_id" = 2)
'''
# ---
# name: TestDecide.test_decide_doesnt_error_out_when_database_is_down.2
'''
SELECT "posthog_organizationmembership"."id",
Expand Down Expand Up @@ -137,7 +121,7 @@
# ---
# name: TestDecide.test_decide_doesnt_error_out_when_database_is_down.3
'''
SELECT (1) AS "a"
SELECT 1 AS "a"
FROM "posthog_grouptypemapping"
WHERE "posthog_grouptypemapping"."team_id" = 2
LIMIT 1 /*controller='team-detail',route='api/projects/%28%3FP%3Cid%3E%5B%5E/.%5D%2B%29/%3F%24'*/
Expand Down
66 changes: 33 additions & 33 deletions posthog/api/test/__snapshots__/test_feature_flag.ambr
Original file line number Diff line number Diff line change
Expand Up @@ -415,7 +415,7 @@
WHERE ("posthog_persondistinctid"."id" IN
(SELECT U0."id"
FROM "posthog_persondistinctid" U0
WHERE U0."person_id" = "posthog_persondistinctid"."person_id"
WHERE U0."person_id" = ("posthog_persondistinctid"."person_id")
LIMIT 3)
AND "posthog_persondistinctid"."person_id" IN (1,
2,
Expand All @@ -432,10 +432,10 @@
AND "posthog_person"."uuid" IN ('00000000-0000-0000-0000-000000000000'::uuid,
'00000000-0000-0000-0000-000000000001'::uuid /* ... */)
AND NOT (EXISTS
(SELECT (1) AS "a"
(SELECT 1 AS "a"
FROM "posthog_cohortpeople" U1
WHERE (U1."cohort_id" = 2
AND U1."person_id" = "posthog_person"."id")
AND U1."person_id" = ("posthog_person"."id"))
LIMIT 1)))
'''
# ---
Expand Down Expand Up @@ -531,7 +531,7 @@
WHERE ("posthog_persondistinctid"."id" IN
(SELECT U0."id"
FROM "posthog_persondistinctid" U0
WHERE U0."person_id" = "posthog_persondistinctid"."person_id"
WHERE U0."person_id" = ("posthog_persondistinctid"."person_id")
LIMIT 3)
AND "posthog_persondistinctid"."person_id" IN (1,
2,
Expand Down Expand Up @@ -570,10 +570,10 @@
AND "posthog_person"."uuid" IN ('00000000-0000-0000-0000-000000000000'::uuid,
'00000000-0000-0000-0000-000000000001'::uuid /* ... */)
AND NOT (EXISTS
(SELECT (1) AS "a"
(SELECT 1 AS "a"
FROM "posthog_cohortpeople" U1
WHERE (U1."cohort_id" = 2
AND U1."person_id" = "posthog_person"."id")
AND U1."person_id" = ("posthog_person"."id"))
LIMIT 1)))
'''
# ---
Expand Down Expand Up @@ -633,10 +633,10 @@
AND "posthog_person"."uuid" IN ('00000000-0000-0000-0000-000000000000'::uuid,
'00000000-0000-0000-0000-000000000001'::uuid /* ... */)
AND NOT (EXISTS
(SELECT (1) AS "a"
(SELECT 1 AS "a"
FROM "posthog_cohortpeople" U1
WHERE (U1."cohort_id" = 2
AND U1."person_id" = "posthog_person"."id")
AND U1."person_id" = ("posthog_person"."id"))
LIMIT 1)))
'''
# ---
Expand Down Expand Up @@ -746,11 +746,11 @@
AND "posthog_person"."properties" ? 'group2'
AND NOT (("posthog_person"."properties" -> 'group2') = 'null'))
OR EXISTS
(SELECT (1) AS "a"
(SELECT 1 AS "a"
FROM "posthog_cohortpeople" U0
WHERE (U0."cohort_id" = 2
AND U0."cohort_id" = 2
AND U0."person_id" = "posthog_person"."id")
AND U0."person_id" = ("posthog_person"."id"))
LIMIT 1)
OR (("posthog_person"."properties" -> 'does-not-exist') = '"none"'
AND "posthog_person"."properties" ? 'does-not-exist'
Expand All @@ -773,7 +773,7 @@
WHERE ("posthog_persondistinctid"."id" IN
(SELECT U0."id"
FROM "posthog_persondistinctid" U0
WHERE U0."person_id" = "posthog_persondistinctid"."person_id"
WHERE U0."person_id" = ("posthog_persondistinctid"."person_id")
LIMIT 3)
AND "posthog_persondistinctid"."person_id" IN (1,
2,
Expand All @@ -787,11 +787,11 @@
SELECT ("posthog_person"."id" IS NULL
OR "posthog_person"."id" IS NULL
OR EXISTS
(SELECT (1) AS "a"
(SELECT 1 AS "a"
FROM "posthog_cohortpeople" U0
WHERE (U0."cohort_id" = 2
AND U0."cohort_id" = 2
AND U0."person_id" = "posthog_person"."id")
AND U0."person_id" = ("posthog_person"."id"))
LIMIT 1)
OR "posthog_person"."id" IS NULL) AS "flag_X_condition_0"
FROM "posthog_person"
Expand All @@ -806,11 +806,11 @@
SELECT ("posthog_person"."id" IS NOT NULL
OR "posthog_person"."id" IS NULL
OR EXISTS
(SELECT (1) AS "a"
(SELECT 1 AS "a"
FROM "posthog_cohortpeople" U0
WHERE (U0."cohort_id" = 2
AND U0."cohort_id" = 2
AND U0."person_id" = "posthog_person"."id")
AND U0."person_id" = ("posthog_person"."id"))
LIMIT 1)
OR "posthog_person"."id" IS NULL) AS "flag_X_condition_0"
FROM "posthog_person"
Expand All @@ -825,11 +825,11 @@
SELECT ("posthog_person"."id" IS NULL
OR "posthog_person"."id" IS NOT NULL
OR EXISTS
(SELECT (1) AS "a"
(SELECT 1 AS "a"
FROM "posthog_cohortpeople" U0
WHERE (U0."cohort_id" = 2
AND U0."cohort_id" = 2
AND U0."person_id" = "posthog_person"."id")
AND U0."person_id" = ("posthog_person"."id"))
LIMIT 1)
OR "posthog_person"."id" IS NULL) AS "flag_X_condition_0"
FROM "posthog_person"
Expand All @@ -844,11 +844,11 @@
SELECT ("posthog_person"."id" IS NULL
OR "posthog_person"."id" IS NULL
OR EXISTS
(SELECT (1) AS "a"
(SELECT 1 AS "a"
FROM "posthog_cohortpeople" U0
WHERE (U0."cohort_id" = 2
AND U0."cohort_id" = 2
AND U0."person_id" = "posthog_person"."id")
AND U0."person_id" = ("posthog_person"."id"))
LIMIT 1)
OR "posthog_person"."id" IS NULL) AS "flag_X_condition_0"
FROM "posthog_person"
Expand Down Expand Up @@ -881,11 +881,11 @@
AND "posthog_person"."properties" ? 'group2'
AND NOT (("posthog_person"."properties" -> 'group2') = 'null'))
OR EXISTS
(SELECT (1) AS "a"
(SELECT 1 AS "a"
FROM "posthog_cohortpeople" U0
WHERE (U0."cohort_id" = 2
AND U0."cohort_id" = 2
AND U0."person_id" = "posthog_person"."id")
AND U0."person_id" = ("posthog_person"."id"))
LIMIT 1)
OR (("posthog_person"."properties" -> 'does-not-exist') = '"none"'
AND "posthog_person"."properties" ? 'does-not-exist'
Expand Down Expand Up @@ -957,7 +957,7 @@
WHERE ("posthog_persondistinctid"."id" IN
(SELECT U0."id"
FROM "posthog_persondistinctid" U0
WHERE U0."person_id" = "posthog_persondistinctid"."person_id"
WHERE U0."person_id" = ("posthog_persondistinctid"."person_id")
LIMIT 3)
AND "posthog_persondistinctid"."person_id" IN (1,
2,
Expand Down Expand Up @@ -994,10 +994,10 @@
AND "posthog_person"."uuid" IN ('00000000-0000-0000-0000-000000000000'::uuid,
'00000000-0000-0000-0000-000000000001'::uuid /* ... */)
AND NOT (EXISTS
(SELECT (1) AS "a"
(SELECT 1 AS "a"
FROM "posthog_cohortpeople" U1
WHERE (U1."cohort_id" = 2
AND U1."person_id" = "posthog_person"."id")
AND U1."person_id" = ("posthog_person"."id"))
LIMIT 1)))
'''
# ---
Expand Down Expand Up @@ -1092,7 +1092,7 @@
WHERE ("posthog_persondistinctid"."id" IN
(SELECT U0."id"
FROM "posthog_persondistinctid" U0
WHERE U0."person_id" = "posthog_persondistinctid"."person_id"
WHERE U0."person_id" = ("posthog_persondistinctid"."person_id")
LIMIT 3)
AND "posthog_persondistinctid"."person_id" IN (1,
2,
Expand Down Expand Up @@ -1131,10 +1131,10 @@
AND "posthog_person"."uuid" IN ('00000000-0000-0000-0000-000000000000'::uuid,
'00000000-0000-0000-0000-000000000001'::uuid /* ... */)
AND NOT (EXISTS
(SELECT (1) AS "a"
(SELECT 1 AS "a"
FROM "posthog_cohortpeople" U1
WHERE (U1."cohort_id" = 2
AND U1."person_id" = "posthog_person"."id")
AND U1."person_id" = ("posthog_person"."id"))
LIMIT 1)))
'''
# ---
Expand Down Expand Up @@ -1344,7 +1344,7 @@
WHERE ("posthog_persondistinctid"."id" IN
(SELECT U0."id"
FROM "posthog_persondistinctid" U0
WHERE U0."person_id" = "posthog_persondistinctid"."person_id"
WHERE U0."person_id" = ("posthog_persondistinctid"."person_id")
LIMIT 3)
AND "posthog_persondistinctid"."person_id" IN (1,
2,
Expand Down Expand Up @@ -1425,10 +1425,10 @@
AND "posthog_person"."uuid" IN ('00000000-0000-0000-0000-000000000000'::uuid,
'00000000-0000-0000-0000-000000000001'::uuid /* ... */)
AND NOT (EXISTS
(SELECT (1) AS "a"
(SELECT 1 AS "a"
FROM "posthog_cohortpeople" U1
WHERE (U1."cohort_id" = 2
AND U1."person_id" = "posthog_person"."id")
AND U1."person_id" = ("posthog_person"."id"))
LIMIT 1)))
'''
# ---
Expand Down Expand Up @@ -1585,7 +1585,7 @@
WHERE ("posthog_persondistinctid"."id" IN
(SELECT U0."id"
FROM "posthog_persondistinctid" U0
WHERE U0."person_id" = "posthog_persondistinctid"."person_id"
WHERE U0."person_id" = ("posthog_persondistinctid"."person_id")
LIMIT 3)
AND "posthog_persondistinctid"."person_id" IN (1,
2,
Expand Down Expand Up @@ -1624,10 +1624,10 @@
AND "posthog_person"."uuid" IN ('00000000-0000-0000-0000-000000000000'::uuid,
'00000000-0000-0000-0000-000000000001'::uuid /* ... */)
AND NOT (EXISTS
(SELECT (1) AS "a"
(SELECT 1 AS "a"
FROM "posthog_cohortpeople" U1
WHERE (U1."cohort_id" = 2
AND U1."person_id" = "posthog_person"."id")
AND U1."person_id" = ("posthog_person"."id"))
LIMIT 1))) /*controller='project_feature_flags-create-static-cohort-for-flag',route='api/projects/%28%3FP%3Cparent_lookup_team_id%3E%5B%5E/.%5D%2B%29/feature_flags/%28%3FP%3Cpk%3E%5B%5E/.%5D%2B%29/create_static_cohort_for_flag/%3F%24'*/
'''
# ---
Expand Down
Loading

0 comments on commit 11e4d84

Please sign in to comment.