Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(data-warehouse): assume timestamp type when defining expression #21084

Merged
merged 7 commits into from
Mar 22, 2024

Conversation

EDsCODE
Copy link
Member

@EDsCODE EDsCODE commented Mar 21, 2024

Problem

Changes

  • when creating the proxy table for data warehouse table on insights, assume timestamp field is a datetime already. This should become the default eventually. right now this will only work with stripe

👉 Stay up-to-date with PostHog coding conventions for a smoother review.

Does this work well for both Cloud and self-hosted?

How did you test this code?

@EDsCODE EDsCODE requested a review from Gilbert09 March 21, 2024 18:14
@@ -211,7 +210,7 @@ def create_hogql_database(
if "timestamp" not in tables[warehouse_modifier.table_name].fields.keys():
tables[warehouse_modifier.table_name].fields["timestamp"] = ExpressionField(
name="timestamp",
expr=ast.Call(name="toDateTime", args=[ast.Field(chain=[warehouse_modifier.timestamp_field])]),
expr=ast.Field(chain=[warehouse_modifier.timestamp_field]),
Copy link
Member

Choose a reason for hiding this comment

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

We can check the type of the timestamp field and conditionally wrap it in a toDateTime if its not already a DateTime database field

@EDsCODE EDsCODE merged commit 36d1dd0 into master Mar 22, 2024
86 checks passed
@EDsCODE EDsCODE deleted the dw-assume-schema-timestamp branch March 22, 2024 21:54
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.

2 participants