Skip to content

Conversation

@andrewjmcgehee
Copy link
Contributor

@andrewjmcgehee andrewjmcgehee commented Nov 1, 2025

Problem

Supabase is low hanging fruit as a source since it's basically postgres.

Changes

Adds supabase as a beta source behind an ff.

Successful sync against test project db:
2025-11-01 15 15 20 localhost 41200fb496d7

How did you test this code?

Ran locally and ran a sync job against a test supabase project and db.

  • still need to update the existing "query supabase" docs link so its up to date. will add a PR here when thats done.

Changelog: (features only) Is this feature complete?

No

@posthog-bot posthog-bot requested a review from a team November 1, 2025 20:19
Copy link
Contributor

@greptile-apps greptile-apps bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

11 files reviewed, 3 comments

Edit Code Review Agent Settings | Greptile

from posthog.temporal.data_imports.sources.postgres.source import PostgresSource
from posthog.warehouse.types import ExternalDataSourceType

postgres = PostgresSource()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

logic: module-level instance will use PostgresSource.source_name ("Postgres") in error messages instead of "Supabase"

When validate_credentials is called via postgres.validate_credentials(), errors will say "Could not connect to Postgres" rather than "Could not connect to Supabase" because postgres is an instance of PostgresSource with source_name = "Postgres".

Either:

  1. Override methods to pass correct source name to error messages
  2. Make PostgresSource.source_name overridable via constructor
  3. Call PostgresSource methods statically if possible
Prompt To Fix With AI
This is a comment left during a code review.
Path: posthog/temporal/data_imports/sources/supabase/source.py
Line: 15:15

Comment:
**logic:** module-level instance will use `PostgresSource.source_name` ("Postgres") in error messages instead of "Supabase"

When `validate_credentials` is called via `postgres.validate_credentials()`, errors will say "Could not connect to Postgres" rather than "Could not connect to Supabase" because `postgres` is an instance of `PostgresSource` with `source_name = "Postgres"`.

Either:
1. Override methods to pass correct source name to error messages
2. Make `PostgresSource.source_name` overridable via constructor
3. Call `PostgresSource` methods statically if possible

How can I resolve this? If you propose a fix, please make it concise.

@SourceRegistry.register
class PostgresSource(BaseSource[PostgresSourceConfig], SSHTunnelMixin, ValidateDatabaseHostMixin):
source_name = "Postgres"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: source_name should be overridable to support inheritance patterns like SupabaseSource

Consider allowing source_name to be set via constructor:

Suggested change
source_name = "Postgres"
def __init__(self, source_name: str = "Postgres"):
super().__init__()
self.source_name = source_name
Prompt To Fix With AI
This is a comment left during a code review.
Path: posthog/temporal/data_imports/sources/postgres/source.py
Line: 40:40

Comment:
**style:** `source_name` should be overridable to support inheritance patterns like `SupabaseSource`

Consider allowing `source_name` to be set via constructor:

```suggestion
    def __init__(self, source_name: str = "Postgres"):
        super().__init__()
        self.source_name = source_name
```

How can I resolve this? If you propose a fix, please make it concise.


class ExternalDataSourceType(StrEnum):
SUPABASE = "Supabase"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

style: verify this change was generated by pnpm run schema:build

posthog/schema.py is autogenerated and should not be manually modified. Verify this was generated via the build command and not manually edited.

Context Used: Rule from dashboard - Do not manually modify the posthog/schema.py file as it is autogenerated by the `pnpm run schema:b... (source)

Prompt To Fix With AI
This is a comment left during a code review.
Path: posthog/schema.py
Line: 1347:1347

Comment:
**style:** verify this change was generated by `pnpm run schema:build`

`posthog/schema.py` is autogenerated and should not be manually modified. Verify this was generated via the build command and not manually edited.

**Context Used:** Rule from `dashboard` - Do not manually modify the `posthog/schema.py` file as it is autogenerated by the `pnpm run schema:b... ([source](https://app.greptile.com/review/custom-context?memory=192de143-59d7-412f-bd71-fe5cb8f161dd))

How can I resolve this? If you propose a fix, please make it concise.
@github-actions
Copy link
Contributor

github-actions bot commented Nov 1, 2025

Size Change: +39 B (0%)

Total Size: 3.34 MB

ℹ️ View Unchanged
Filename Size Change
frontend/dist/toolbar.js 3.34 MB +39 B (0%)

compressed-size-action

@github-actions
Copy link
Contributor

github-actions bot commented Nov 1, 2025

Migration SQL Changes

Hey 👋, we've detected some migrations on this PR. Here's the SQL output for each migration, make sure they make sense:

posthog/migrations/0897_alter_externaldatasource_source_type.py

BEGIN;
--
-- Alter field source_type on externaldatasource
--
-- (no-op)
COMMIT;
@github-actions
Copy link
Contributor

github-actions bot commented Nov 1, 2025

🔍 Migration Risk Analysis

We've analyzed your migrations for potential risks.

Summary: ⚠️ Missing migrations detected

Migrations for 'error_tracking':
  products/error_tracking/backend/migrations/0007_remove_errortrackingassignmentrule_user_group_and_more.py
    - Remove field user_group from errortrackingassignmentrule
    - Remove field external_id from errortrackingexternalreference
    - Remove field provider from errortrackingexternalreference
    - Remove field user_group from errortrackinggroupingrule
    - Remove field user_group from errortrackingissueassignment
Migrations for 'posthog':
  posthog/migrations/0898_remove_annotation_is_emoji_and_more.py
    - Remove field is_emoji from annotation
    - Remove field recording_id from annotation
    - Remove field sync_frequency from externaldataschema
    - Remove field funnel from insight
    - Remove field type from insight
    - Remove field value from personalapikey
    - Remove field is_publicly_shareable from survey
    - Alter field source_type on externaldatasource

Run python manage.py makemigrations to create them.

Summary: 0 Safe | 1 Needs Review | 0 Blocked

⚠️ Needs Review

May have performance impact

posthog.0897_alter_externaldatasource_source_type
  └─ #1 ⚠️ AlterField
     Field alteration may cause table locks or data loss (check if changing type or constraints)
     model: externaldatasource, field: source_type, field_type: CharField
@github-actions
Copy link
Contributor

github-actions bot commented Nov 1, 2025

⚠️ Flapping Screenshots Detected

The following screenshots have been updated multiple times by the bot, indicating test instability:

  • playwright/__snapshots__/pageview-trends-insight.png

What this means:

  • These screenshots are changing on each test run (timing issues, rendering differences, etc.)
  • This prevents reliable verification and blocks auto-merge
  • Human intervention is required

How to fix:

  1. Investigate flakiness: Check test timing, wait for elements, stabilize animations
  2. Fix the underlying issue: Don't just update snapshots repeatedly
  3. Verify locally: Run tests multiple times to ensure stability
  4. Push your fix: This will reset the flap counter

If you need to proceed anyway:

  • Fix the test flakiness first (recommended)
  • Or manually verify snapshots are acceptable and revert the bot commits, then push a fix

The workflow has been failed to prevent merging unstable tests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants