Skip to content

Conversation

rafaeelaudibert
Copy link
Member

Testing queries against data warehouse tables is extremely hard right now. We're doing it in different ways in different places. Let's standardize it by providing a common interface we can use everywhere: CSV files + a single function to create tables, sources, credentials, etc.

Extracted from #30895

Testing queries against data warehouse tables is extremely hard right now. We're doing it in different ways in different places. Let's standardize it by providing a common interface we can use everywhere: CSV files + single function to handle creating tables, sources, credentials, etc.

Extracted from #30895
We're storing our data warehouse data inside `objectstorage` locally but that's not properly resolved by default because we didn't add it to `/etc/hosts`. There are 2 solutions to it:

- run tests inside docker
- expose that outside docker via `/etc/hosts`

We're doing the latter :)

I've also fixed the script slightly. We were previously only appending that to the hosts file if running on an interactive shell, but that's not right, we should always run it
@rafaeelaudibert rafaeelaudibert requested review from andehen, EDsCODE and a team April 7, 2025 21:23
@rafaeelaudibert rafaeelaudibert changed the title feat: Introduce new create_data_warehouse_table_from_csv helper feat: Introduce new create_data_warehouse_table_from_csv helper Apr 7, 2025
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.

PR Summary

This PR standardizes data warehouse table creation in tests by introducing a new CSV-based helper and refactoring existing test setups for consistency and easier cleanup.

  • In /posthog/hogql_queries/experiments/test/experiment_query_runner/base.py, replaced duplicated S3 logic with the new helper, dynamically assigning cleanup functions.
  • In /posthog/hogql_queries/experiments/test/experiment_query_runner/utils.py, removed DW table creation code and external dependencies.
  • In /posthog/hogql_queries/experiments/test/test_experiment_trends_query_runner.py, integrated the helper for payments, usage, subscriptions, and customer tables.
  • Added the helper in /posthog/warehouse/test/utils.py to centralize CSV ingestion and cleanup logic.

6 file(s) reviewed, 1 comment(s)
Edit PR Review Bot Settings | Greptile

@rafaeelaudibert rafaeelaudibert force-pushed the improve-data-warehouse-test-setup branch from 9554dfc to d73285b Compare April 7, 2025 21:58
Copy link
Collaborator

@EDsCODE EDsCODE left a comment

Choose a reason for hiding this comment

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

thanks! as long as test pass 👍

@rafaeelaudibert rafaeelaudibert merged commit 9146ced into master Apr 7, 2025
93 checks passed
@rafaeelaudibert rafaeelaudibert deleted the improve-data-warehouse-test-setup branch April 7, 2025 22:26
thmsobrmlr pushed a commit that referenced this pull request Apr 8, 2025
…0900)

Co-authored-by: github-actions <41898282+github-actions[bot]@users.noreply.github.com>
@Radu-Raicea
Copy link
Member

@rafaeelaudibert

Hey, was this line supposed to be removed from manifest.toml?

1. Spin up containers - \033[33mdocker compose -f docker-compose.dev.yml up -d\033[0m

I was setting up things locally and this is where I was blocked. Should I add it back?

@rafaeelaudibert
Copy link
Member Author

Hey @Radu-Raicea, welcome! 🫡

It's unusual you're the first person hit by this in 4 months, and we've had way over 20 people onboarding that time, so... sounds like we dont really need it?

If it blocked you tho, yeah, let's just add it back. PRs > issues :)

@rafaeelaudibert
Copy link
Member Author

And no, I dont remember why I removed it. So... happy to just have it back

1 similar comment
@rafaeelaudibert
Copy link
Member Author

And no, I dont remember why I removed it. So... happy to just have it back

@Radu-Raicea
Copy link
Member

@rafaeelaudibert

There you go! #35324

Maybe we all hit it but none decided to put a sign!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants