feat(data-warehouse): implement phyllo import source - #69363
Merged
Conversation
Implements the Phyllo warehouse source as a ResumableSource over the Phyllo v1 REST API (HTTP Basic auth, limit-offset pagination, tracked session). Covers work_platforms, users, accounts, profiles, and the per-account fan-out streams social_contents, income_transactions, and income_payouts. All streams are full refresh; kept behind unreleasedSource with releaseStatus alpha. Generated-By: PostHog Code Task-Id: 840abc2b-1bfb-40b4-9ea6-c79af016a14c
Contributor
|
Hey @Gilbert09! 👋 It looks like your git author email on this PR isn't your
You can fix it for this repo with: git config user.email "you@posthog.com"Or set it globally with |
Contributor
|
Reviews (1): Last reviewed commit: "feat(data-warehouse): implement phyllo i..." | Re-trigger Greptile |
Annotate the page-fixture dicts in test_phyllo.py so mypy accepts the invariant dict key type, and index account records with item["id"] in _list_account_ids so a malformed record fails the sync loudly instead of silently dropping the account's child rows. Generated-By: PostHog Code Task-Id: 840abc2b-1bfb-40b4-9ea6-c79af016a14c
Generated-By: PostHog Code Task-Id: d83a3d9b-5a75-4b6e-bb09-6665c4911a80
MarconLP
approved these changes
Jul 9, 2026
MarconLP
approved these changes
Jul 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Problem
Phyllo (a unified API for creator economy data across YouTube, Instagram, TikTok, Twitch, Spotify, etc.) was scaffolded as a warehouse source but had no sync logic, so users can't pull their creator, content, or income data into the Data warehouse.
Why: fill in the scaffolded Phyllo connector end to end so it can sync real data and move it from the Scaffolded to the Implemented list.
Changes
Implements the Phyllo source following the standard
source.py/settings.py/phyllo.pysplit:ResumableSourceover the Phyllo v1 REST API usingrequestsviamake_tracked_session(), HTTP Basic auth (client ID + secret), and limit-offset pagination with resume state saved after each yielded batch.settings.py:work_platforms,users,accounts, andprofilesare top-level listings;social_contents,income_transactions, andincome_payoutsrequire anaccount_id, so they fan out over the connected accounts (iterated in sorted order so resume checkpoints are deterministic).from_date/to_datefilters on the content and income endpoints, but I could not verify they filter server-side without live credentials, so per the conservative rule those ship as full refresh (noted insettings.py)./v1/work-platforms; 401/403 on either host are registered as non-retryable errors.Retry-Afteron 429 - the fetch path honors the header (capped) before tenacity's exponential backoff takes over.canonical_descriptions.pydocuments all seven tables and their well-known columns from the Phyllo API reference, andlists_tables_without_credentials = Trueso the public docs render the table catalog.SOURCES.md: movedphyllofrom Scaffolded to the Implemented table (HTTP / requests / tracked).unreleasedSource=TruewithreleaseStatus=alpha.Note
Endpoint verification was limited to unauthenticated probes against both hosts (reachability plus the 401 error shape) since no API credentials were available. Response envelope (
{"data": [...]}), max page size, and the requiredaccount_idparams come from the public API docs; the payload guard raises a retryable error if the envelope ever differs, and the uncertainty is noted in code comments.The user-facing doc for the posthog.com repo (
contents/docs/cdp/sources/phyllo.md, matching thedocsUrl) still needs to land there - this workspace has no posthog.com checkout, soaudit_source_docscouldn't run. Ready-to-commit content:posthog.com doc: contents/docs/cdp/sources/phyllo.md
How did you test this code?
pytest products/warehouse_sources/backend/temporal/data_imports/sources/phyllo/tests/- 61 passed.tests/test_phyllo.py(transport): guards offset advancement and short-page termination (a regression here loops forever or drops pages), resume-from-saved-state for both top-level and mid-account fan-out (including a disconnected saved account, where a leaked offset would silently skip rows), state saved only after yielding (saving before loses data on crash), 429Retry-Afterhandling, retryable vs terminal status mapping, and credential validation status mapping.tests/test_phyllo_source.py(source class): schema catalog wiring, secret field config, non-retryable error matching on both hosts (and not matching transient 429/500), argument plumbing into the transport, and the public-docs table rendering path (which exercises the placeholder-config construction).pytest products/warehouse_sources/backend/temporal/data_imports/sources/tests/- 1353 passed (registry, categories, config generation).ruff check/ruff formatclean;hogli ci:preflight --fixreports 0 failures;makemigrations --checkdetects no pending migrations.Automatic notifications
Docs update
posthog.com doc content is included above and needs a companion PR in the posthog.com repo. The source stays behind
unreleasedSource=True, so nothing user-visible changes yet.🤖 Agent context
Autonomy: Human-driven (agent-assisted)
/implementing-warehouse-sources(workflow, architecture contract, testing expectations),/documenting-warehouse-sources(doc template),/writing-tests(test value gate).secoda/huntrsources as the reference shape (ResumableSource + requests + tracked session).requestsoverrest_source.RESTClientto match the reference sources and keep the per-account fan-out with resumable checkpoints explicit.WebhookSource(Phyllo has a manageable webhooks API) but deferred it: webhook payload shapes couldn't be verified without credentials, and none of the recent reference sources ship webhook support in their initial PR. Incremental sync viafrom_datefilters was likewise deferred until the filters can be verified server-side with real credentials.generated_configs.pywas produced bygenerate_source_configs; per the known generator drift, unrelated rewrites were reverted so the diff touches onlyPhylloSourceConfig.Created with PostHog Code