0
0
mirror of https://github.com/PostHog/posthog.git synced 2024-12-01 12:21:02 +01:00
Commit Graph

179 Commits

Author SHA1 Message Date
Julian Bez
b834212bbb
fix: Fix rendering of nan and inf in JSON responses (#20302)
* Use orjson
* Fix non-str dict keys
* Handle case of characters in async results
2024-02-15 15:56:54 +00:00
Eric Duong
0b26050a13
chore(data-warehouse): async generators for dlt (#20185)
* make async

* add limiting logic back

* tests

* Update query snapshots

* Update query snapshots

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2024-02-08 14:07:18 -05:00
Julian Bez
11e4d8487e
chore(deps): Upgrade Django 4.1 (#20006)
* 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>
2024-02-07 09:19:06 +00:00
Neil Kakkar
7b66b4888f
chore: Update posthoganalytics (#20033)
* chore: Update posthoganalytics

* fix
2024-01-30 16:40:03 +00:00
David Newell
974553f84d
chore: upgrade OpenAI client (#19986) 2024-01-29 11:47:14 +00:00
Paul D'Ambra
0896f9f525
fix: api docs generation (#19935)
* fix: api docs generation

* let's catch this in future

* Update query snapshots

* split listing and checking permissions

* remove some nonsense that copilot snuck in while I wasn't looking

* obey mypy

* test the generated warnings aren't increasing

* Update query snapshots

* Update query snapshots

* Update query snapshots

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2024-01-23 22:00:06 +00:00
dependabot[bot]
0de378dfa7
chore(deps): bump pillow from 9.2.0 to 10.2.0 (#19914)
* chore(deps): bump pillow from 9.2.0 to 10.2.0

Bumps [pillow](https://github.com/python-pillow/Pillow) from 9.2.0 to 10.2.0.
- [Release notes](https://github.com/python-pillow/Pillow/releases)
- [Changelog](https://github.com/python-pillow/Pillow/blob/main/CHANGES.rst)
- [Commits](https://github.com/python-pillow/Pillow/compare/9.2.0...10.2.0)

---
updated-dependencies:
- dependency-name: pillow
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

* manually update this so everything is in sync

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Paul D'Ambra <paul@posthog.com>
2024-01-23 14:21:00 +00:00
Tom Owers
d946f661f2
feat(hogql): Allow a placeholder to be used in place of a select statement (#19767)
* Allow a placeholder to be used in place of a select statement in a union all

* Updated the hogql parser version

* Use new hogql-parser version

* Fixed tests

* Update query snapshots

* Update query snapshots

* Rejigged the g4 file

* Updated mypy

* Updated mypy

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2024-01-18 15:14:39 +00:00
Julian Bez
95fec19aaf
feat(celery): Prepare to run on multiple queues (#19157)
* Add Celery queues env file with default queues

Reasoning:
We need to configure Celery workers in several places to consume
from a specific set of queues.

* Define some queues
2024-01-17 11:54:12 +00:00
dependabot[bot]
e9b825236f
chore(deps): bump urllib3 from 1.26.13 to 1.26.18 (#19643)
* chore(deps): bump urllib3 from 1.26.13 to 1.26.18

Bumps [urllib3](https://github.com/urllib3/urllib3) from 1.26.13 to 1.26.18.
- [Release notes](https://github.com/urllib3/urllib3/releases)
- [Changelog](https://github.com/urllib3/urllib3/blob/main/CHANGES.rst)
- [Commits](https://github.com/urllib3/urllib3/compare/1.26.13...1.26.18)

---
updated-dependencies:
- dependency-name: urllib3
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <support@github.com>

* upgrade dependency using pip-compile

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Paul D'Ambra <paul@posthog.com>
2024-01-15 14:17:13 +01:00
Julian Bez
7cabe21ae3
chore: Upgrade pydantic, mypy, and others (#19660)
* Upgrade pydantic and all related
* Upgrade mypy
* Add mypy-baseline

To update baseline when you fix something (only then!) use:

    [mypy cmd] | mypy-baseline sync
2024-01-10 08:32:55 +00:00
dependabot[bot]
e74c207b31
chore(deps): bump django from 3.2.19 to 3.2.23 (#19574)
Bumps [django](https://github.com/django/django) from 3.2.19 to 3.2.23.
- [Commits](https://github.com/django/django/compare/3.2.19...3.2.23)

---
updated-dependencies:
- dependency-name: django
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2024-01-08 08:38:57 +00:00
Eric Duong
51dd5d78c9
chore(data-warehouse): make data pipeline async (#19338)
* working async

* cleanup

* update test

* remove

* add good test

* adjust env var handling

* typing
2023-12-14 22:28:09 -05:00
danielxnj
d9faf41195
Revert "chore(deps): Upgrade to Django 4.1 (#19285)" (#19337)
This reverts commit 3c399da5d2.
2023-12-14 12:57:30 -05:00
Julian Bez
3c399da5d2
chore(deps): Upgrade to Django 4.1 (#19285)
Another try for #18830
2023-12-14 15:51:38 +00:00
Julian Bez
8e8a6dcead
fix: Revert "chore(deps): Upgrade to Django 4.1" (#19258)
Revert "chore(deps): Upgrade to Django 4.1 (#18830)"

This reverts commit 580c7b1aba.
2023-12-11 09:51:20 -08:00
Julian Bez
580c7b1aba
chore(deps): Upgrade to Django 4.1 (#18830)
* Upgrade dependencies
* Fix middleware error

Among
https://docs.djangoproject.com/en/4.2/releases/4.0/#features-removed-in-4-0

* Switch TaggedItem tests to assert ValidationError

Because full_clean validates since Django 4.1, see
https://docs.djangoproject.com/en/4.2/releases/4.1/#validation-of-constraints

* Remove type: ignore comments

* Set CSRF_TRUSTED_ORIGINS

* Update access.py

Co-authored-by: Paul D'Ambra <paul@posthog.com>
2023-12-11 13:44:40 +00:00
Tomás Farías Santana
6719c54b97
fix: Bump psycopg (#18993) 2023-11-30 14:54:19 +00:00
Eric Duong
1fcd437f1d
feat(data-warehouse): migrations for data sync (#18966)
* just code for migrations

* use all timezones because update would cause common_timezones to be less inclusive

* install new dependencies

* add comment

* revert

* restore

* fix type
2023-11-29 13:30:50 -05:00
dependabot[bot]
a1f842569f
chore(deps): bump aiohttp from 3.8.6 to 3.9.0 (#18920)
* chore(deps): bump aiohttp from 3.8.6 to 3.9.0

Bumps [aiohttp](https://github.com/aio-libs/aiohttp) from 3.8.6 to 3.9.0.
- [Release notes](https://github.com/aio-libs/aiohttp/releases)
- [Changelog](https://github.com/aio-libs/aiohttp/blob/master/CHANGES.rst)
- [Commits](https://github.com/aio-libs/aiohttp/compare/v3.8.6...v3.9.0)

---
updated-dependencies:
- dependency-name: aiohttp
  dependency-type: direct:production
...

Signed-off-by: dependabot[bot] <support@github.com>

* update properly

---------

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Paul D'Ambra <paul@posthog.com>
2023-11-29 10:22:47 +01:00
Tomás Farías Santana
70970ffb52
refactor: Postgres (+ Redshift) batch exports now async (#18631)
* refactor: Postgres batch exports now async

* fix: Let's use from psycopg import sql instead

* test: Update Redshift tests

* fix: Typing issues

* fix: Main insert batch loop
2023-11-15 09:56:46 +01:00
Brett Hoerner
2aefbb32e8
refactor(batch-exports): upgrade temporalio dep and use their built i… (#18584)
* refactor(batch-exports): upgrade temporalio dep and use their built in metrics support

* fix: Remove unused imports

---------

Co-authored-by: Tomás Farías Santana <tomas@tomasfarias.dev>
2023-11-14 14:33:56 +01:00
Tomás Farías Santana
a8f6d92318
refactor: Structlog batch exports logging (#18458)
* fix: Checkout master before checking for hogql changes

* fix: But go back to branch after done

* fix: Instead just diff with origin/master

* fix: Install libantlr, what's the worst that can happen?

* fix: Install antlr the hogql-way

* fix: Let's just checkout everything

* feat(batch-exports): Add backfill model and service support

* test(batch-exports-backfills): Add Workflow test

* chore(batch-exports-backfill): Bump migration

* feat(batch-exports): Add RedshiftBatchExportWorkflow

* feat(batch-exports): Add Redshift to BatchExport destinations

* feat(batch-exports): Support properties_data_type Redshift plugin parameter

* refactor(batch-exports): Insert rows instead of using COPY

* fix: Remove unused migration

* chore: Require aiokafka

* feat: Implement new structlog batch exports logger

* refactor: Use new structlog logger everywhere

* test: Add tests, fix things

* fix: Remove old tests

* chore: Change typing of return logger

* chore: Bump structlog

* chore: Extend docstrings

* fix: Don't use async logging as it's unsupported by temporal runtime

* test: Add logger tests

* fix: Mix pytestmark lists

* fix: Remove unused imports

* fix: Cleanup  pytest warnings

* fix: Create and drop dataset for bigquery tests

* fix: Typing issue?

* fix: Let's just checkout everything

* fix: Use global event loop in tests

* fix: Blow-up cache

* fix: Truncate only if table exists

* revert-me: Skip all postgres tests

* fix: Connect to kafka in localhost

* fix: Lazily connect to Kafka

* fix: Resolve conflicts

* fix: Capture temporal context once and bind it to the logger

* fix: Make configure logger sync

* fix: Keep strong reference to background tasks

* fix: Continue consuming from log queue even if we fail to produce

* fix: Also catch the producer not starting

* fix: Remove unused await

* fix: Log kafka producer error after logger is configured
2023-11-13 16:07:35 +01:00
Michael Matloka
21c699772c
chore(hogql): Use the C++ parser in 50% of queries (#18298)
* chore(hogql): Use the C++ parser in 50% of queries

* Ensure that C++ parser is used in tests deterministically

* Align table args behavior with Python

* Bump parser version to 1.0.1

* Use new hogql-parser version

* Don't add notices for internal expressions, like in Python

* Bump parser version to 1.0.2

* Use new hogql-parser version

* Update posthog/hogql/parser.py

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2023-11-01 11:52:44 +01:00
Michael Matloka
8f62e85c9d
chore(hogql): Full error & NULL handling in C++ parser (1.0.0) (#18240)
* chore(hogql): Be defensive against NULLs in the C++ parser

* Clean up on C++ exceptions

* Add to CONTRIBUTING guide

* Revert `AllowShortFunctionsOnASingleLine` change

* Update HogQLX additions too

* Bump version to 1.0.0

* Use new hogql-parser version

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2023-10-27 13:37:15 +02:00
Marius Andra
4ea13f1c84
feat(hogqlx): nested tags (#18213) 2023-10-27 09:03:54 +02:00
Marius Andra
15e3e851ad
feat(hogql): HogQLX (#18097) 2023-10-26 14:22:22 +02:00
Xavier Vello
7ff535e3c9
feat(django): allow to enable new capture for specific teams (#18193) 2023-10-26 10:46:37 +02:00
Tom Owers
8577e13599
feat: allow placeholders in place of ratio expressions in hogql (#17973)
* Allow placeholders in place of ratio expressions in hogql

* Added C++ changes for RatioExpr

* Bump `hogql_parser` version

* Upgrade ANTLR version to align with brew latest

* Update query snapshots

* Fix parser change message body

The quotes weren't right, so the step failed instead of posting a comment.

* Revert "Update query snapshots"

This reverts commit 1302d3b24f.

* Update MD5 sum

* Bump version again

* Use new hogql-parser version

---------

Co-authored-by: Michael Matloka <michal@matloka.com>
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Michael Matloka <dev@twixes.com>
2023-10-19 15:37:32 +00:00
Michael Matloka
711f2b4ac3
perf(hogql): Fix C++ parser leaks (#18022) 2023-10-17 15:27:38 +02:00
Michael Matloka
16a71f60c9
perf: Parse HogQL with C++ for a huge speedup (#17659)
* Add partial C++ parser of HogQL

* Support all the rules and add proper error handling

* Use `AlignAfterOpenBracket: BlockIndent`

* Reuse all the parser tests for the C++ backend

* Fix relationship between headers and implementations

* Add more error handling and fix minor issues

* Build both Python and C++ parsers in the package.json script

* Update ARRAY JOIN error assertion

* Improve timeit

* Move the C extension to the top level

* Refactor `vector_to_list_string`

* Build the parser on Linux

* Build wheels for the parser

* Simplify Linux build and fix macOS

* Fix Homebrew paths on x86 and don't fail fast in CI

* Set MACOSX_DEPLOYMENT_TARGET for C++20

* Set up QEMU for Linux ARM builds

* Publish the wheels on PyPI

* Avoiding Linux ARM emulation in CI for now

* Build sdist too

* Revert Dockerfile changes

* Fix PyPI publish

* Add README and optimize sdist build

* Use setup.py directly instead of build

* Use PyPI hogql-parser instead of local

* Also revert production-unit.Dockerfile

* Fix sdist upload and add Linux ARM back

* No Linux ARM build in the end

* Fix artifact uploading

* Do try building Linux ARM

We need this for prod.

* Use `npm` in `grammar:build`

`pnpm` is not available in that job.

* Fix formatting of hogql_parser

* Build everything on macOS

* Revert "Build everything on macOS"

Not so fast actually.

* Use hogql-parser=0.1.1

* Fix dylib in macOS wheel

* Bump hogql-parser version

* Fix missing module error

* Delete timeit.py

* Make error handling robust

* Format the C++

* Use `hogql-parser==0.1.1`

* Fix reserved keyword error assertions

* Use HEAD hogql_paresr in CI

* Fix `apt` usage

* Add some sudo in CI

* Ensure package will be releasable before build

* Bump version to 0.1.3

* Cover C++ `unquote_string` with tests

* Use BuildJet ARM runners for ARM builds

* Add some instructions

* Add HogQL version check to backend CI

* Update requirements.txt

* Use `setuptools` instead of the deprecated `distutils`

* Fix working dir in backend CI

* Align ANTLR versions

* Add test for "mismatched input"

This is thrown differently than other HogQLSyntaxExceptions in C++, so might help reveal what's going on with tests failing only on Linux CI and not macOS dev

* Add types and bump version

* Comment instead of failing version check

* Automate hogql-release version bump

* Fix checkout token

* Don't build hogql-parser if there were no changes

* Update query snapshots

* Update query snapshots

* Update query snapshots

* Update query snapshots

* Improve documentation

* Use new hogql-parser version

* Fix error start and end initialization

* Note `antlr4-cpp-runtime`

Co-authored-by: Marius Andra <marius.andra@gmail.com>

* Also remove NUL chars in C++

* Check ANTLR4 runtime archive checksum for security

* Note more decrefs to add

* Add vector size checks

* Use new hogql-parser version

* Don't support the `start` arg in C++ `parse_expr`

* Use new hogql-parser version

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Marius Andra <marius.andra@gmail.com>
2023-10-13 13:58:08 +00:00
Thomas Obermüller
a914bf46a9
fix(celery): celery compatibility with importlib (#17874) 2023-10-10 10:29:51 +00:00
Neil Kakkar
b02d800047
feat(surveys): Add question html support (#17847) 2023-10-10 10:30:44 +01:00
Tomás Farías Santana
5e192a0d6f
refactor(s3-batch-exports): Swap to asyncio s3 client (#17673) 2023-09-29 10:55:24 +02:00
Paul D'Ambra
2db045910f
chore: celery 5.x (#17480) 2023-09-28 14:01:02 +01:00
James Greenhill
3e13484de1
chore: move billing celery job to use offline cluster and increase timeout from 2 minutes to 5 min (#17656)
* chore: move billing celery job to use offline cluster and increase timeout from 2 minutes to 5 min

* add retry logic

* add types for retry
2023-09-27 21:32:52 +00:00
Thomas Obermüller
ced6337c23
chore(webdriver-manager): upgrade to v4 (#17643) 2023-09-27 14:11:05 +02:00
Thomas Obermüller
26f29f11e4
chore(python): upgrade pydantic and datamodel-code-generator (#17477) 2023-09-18 15:05:46 +02:00
Tomás Farías Santana
b67bbaa7c1
chore: Bump psycopg2 (#17390) 2023-09-15 15:32:20 +02:00
Paul D'Ambra
63bc263cdf
feat: no whitenoise compression (#17367) 2023-09-13 09:30:14 +01:00
Tomás Farías Santana
6c24b22a79
feat: BigQuery destination for BatchExports (#17170)
Co-authored-by: Tiina Turban <tiina303@gmail.com>
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Ben White <ben@posthog.com>
2023-09-07 18:22:22 +02:00
Tomás Farías Santana
17c5ec1710
feat: S3 BatchExports missing features (#17233) 2023-09-01 16:19:02 +02:00
Michael Matloka
fe909cf416
chore(deps): Update loginas from 0.3.9 to 0.3.11 (#16917) 2023-08-04 20:18:01 +02:00
Tomás Farías Santana
30d7144831
feat: Stream BatchExport queries in optimized format (#16583)
Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2023-07-25 11:48:48 +02:00
Michael Matloka
d53b9d6a62
feat(hogql): Ask question, get SQL from GPT (#16396)
* feat(hogql): Add GPT

* Allow tweaking query with AI

* Add feature flag

* Fix typo in `SerialiedField`

* Improve analytics

* Update query snapshots

* Update UI snapshots for `chromium` (2)

* Update query snapshots

* Gracefully handle lack of OpenAI key on hobby instances

* Update HogQLQueryEditor.tsx

* Add token usage analytics

* Use a banner for prompt unclear error

* Add max prompt length of 400

* Update test_preflight.py

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
2023-07-07 14:26:28 +02:00
Paul D'Ambra
0e0e572b7a
chore: upgrade to Django 3.2.19 (#16193) 2023-06-22 13:45:40 +01:00
timgl
00ea8c36f2
feat(data-warehouse): Initial data warehouse setup (#16087)
* wip warehouse

* moar progress

* Update UI snapshots for `chromium` (2)

* fix types and bad logic

* make it work

* type

* update migration

* change icon

* Update UI snapshots for `chromium` (2)

* backend errors

* Update UI snapshots for `chromium` (2)

* fix tests

* remove duplicate regexp

* type

* ui

* more tests

* Update UI snapshots for `chromium` (1)

* client error

* Update query snapshots

* Update query snapshots

* Update UI snapshots for `chromium` (2)

* change api call and split out warehouse logic + restore data management tab

* Update query snapshots

* remove

* Update UI snapshots for `chromium` (1)

* Update query snapshots

* typing

* Update UI snapshots for `chromium` (2)

* Update UI snapshots for `chromium` (2)

* Update UI snapshots for `chromium` (2)

* Update UI snapshots for `webkit` (2)

* Update UI snapshots for `chromium` (2)

* Update UI snapshots for `webkit` (2)

* dummy

* remove console log

* Update UI snapshots for `chromium` (2)

* Update UI snapshots for `chromium` (2)

* encrypt

* fix migration

* fix

* tests

* add salt env var

---------

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: eric <eeoneric@gmail.com>
2023-06-20 22:38:58 -04:00
Harry Waye
440642243a
chore(batch-exports): add snowflake export workflow (#15907)
* chore(batch-exports): add snowflake export workflow

This workflow uses Snowflake internal stages to load data from
ClickHouse into a Snowflake table. We maintain the existing events table
schema as used in the existing Snowflake App.

Something I haven't done yet is:

 1. made sure e.g. we get the `elements` and `person_set` etc. data into
    Snowflake.
 2. the additional frontend to enable configuring the Snowflake
    connection.

* remove unsed var

* include excluded events in test
2023-06-09 06:59:07 +00:00
Tomás Farías Santana
ebe7388c70
feat: Implement encryption codec for Temporal (#15566)
Co-authored-by: Harry Waye <harry@posthog.com>
2023-06-08 10:57:04 +01:00
Paul D'Ambra
596248c965
revert: chore: test chunking compression (#15865)
Revert "chore: test chunking compression (#15848)"

This reverts commit b7bc7908e2.
2023-06-02 11:56:38 +01:00