Skip to content

Conversation

@tchow-zlai
Copy link
Collaborator

@tchow-zlai tchow-zlai commented Jul 31, 2025

Summary

Don't use vN convention in the sample, it is confusing.

Checklist

  • Added Unit Tests
  • Covered by existing CI
  • Integration tested
  • Documentation update

Summary by CodeRabbit

  • New Features

    • Added new staging query configurations for "second" and "fourth" queries.
  • Bug Fixes

    • Updated date parameter syntax in query templates for improved templating compatibility.
  • Refactor

    • Renamed staging query variables and metadata from numeric (v1–v6) to ordinal names (first–sixth) for clarity.
    • Updated dependencies and references to use new ordinal naming.
  • Chores

    • Removed obsolete staging query configurations for "v5" and "v6".

@coderabbitai
Copy link
Contributor

coderabbitai bot commented Jul 31, 2025

Walkthrough

This change renames staging query variables and metadata fields from versioned names ("v1"–"v6") to ordinal words ("first"–"sixth"), updates corresponding references in dependencies, deletes two obsolete compiled query files, adds two new ones, and adjusts SQL query parameter placeholders from single- to double-curly brace templating in both JSON and Python files.

Changes

Cohort / File(s) Change Summary
Staging Query Variable Renaming & Dependency Updates
api/python/test/canary/staging_queries/gcp/sample_staging_query.py
Renamed variables (v1v6firstsixth, terminal_v1terminal), updated dependency references, and changed SQL placeholders to double curly braces in query_hub.
Compiled Query Metadata Renames
api/python/test/canary/compiled/staging_queries/gcp/sample_staging_query.first__0,
.../sample_staging_query.third__0,
.../sample_staging_query.fourth__0,
.../sample_staging_query.fifth__0,
.../sample_staging_query.sixth__0
Renamed metadata "name" fields from versioned to ordinal names in respective JSON files.
Compiled Terminal Query Update
api/python/test/canary/compiled/staging_queries/gcp/sample_staging_query.terminal__0
Updated "name" and all table references in customJson and tableDependencies from versioned to ordinal names.
Compiled Query Placeholder Update
api/python/test/canary/compiled/staging_queries/gcp/sample_staging_query.v1_hub__0
Changed SQL query placeholders from single-braced to double-braced curly syntax for templating.
New Compiled Query Files
api/python/test/canary/compiled/staging_queries/gcp/sample_staging_query.second__0,
.../sample_staging_query.fourth__0
Added new JSON files defining staging queries with full metadata, environment, cluster, and dependency configuration.
Deleted Compiled Query Files
api/python/test/canary/compiled/staging_queries/gcp/sample_staging_query.v5__0,
.../sample_staging_query.v6__0
Deleted obsolete JSON files for versioned staging queries v5__0 and v6__0, removing their metadata and configuration.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant PythonStagingQueries
    participant CompiledJSON
    User->>PythonStagingQueries: Define staging queries (first–sixth, terminal)
    PythonStagingQueries->>CompiledJSON: Generate JSON with updated names and dependencies
    User->>PythonStagingQueries: Reference queries using new ordinal names
    PythonStagingQueries->>CompiledJSON: Use double-brace templating in SQL queries
Loading

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~8 minutes

Possibly related PRs

Suggested reviewers

  • chewy-zlai
  • david-zlai
  • sean-zlai

Poem

Six queries march in ordinal pride,
No more v1s or v6s to hide.
Double curly braces now adorn the code,
Old files deleted, new ones bestowed.
Dependencies line up in a neat array—
Query renaming saves the day!
🚀


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 4025a3d and 38d3be6.

📒 Files selected for processing (11)
  • api/python/test/canary/compiled/staging_queries/gcp/sample_staging_query.fifth__0 (1 hunks)
  • api/python/test/canary/compiled/staging_queries/gcp/sample_staging_query.first__0 (1 hunks)
  • api/python/test/canary/compiled/staging_queries/gcp/sample_staging_query.fourth__0 (1 hunks)
  • api/python/test/canary/compiled/staging_queries/gcp/sample_staging_query.second__0 (1 hunks)
  • api/python/test/canary/compiled/staging_queries/gcp/sample_staging_query.sixth__0 (1 hunks)
  • api/python/test/canary/compiled/staging_queries/gcp/sample_staging_query.terminal__0 (7 hunks)
  • api/python/test/canary/compiled/staging_queries/gcp/sample_staging_query.third__0 (1 hunks)
  • api/python/test/canary/compiled/staging_queries/gcp/sample_staging_query.v1_hub__0 (1 hunks)
  • api/python/test/canary/compiled/staging_queries/gcp/sample_staging_query.v5__0 (0 hunks)
  • api/python/test/canary/compiled/staging_queries/gcp/sample_staging_query.v6__0 (0 hunks)
  • api/python/test/canary/staging_queries/gcp/sample_staging_query.py (2 hunks)
💤 Files with no reviewable changes (2)
  • api/python/test/canary/compiled/staging_queries/gcp/sample_staging_query.v6__0
  • api/python/test/canary/compiled/staging_queries/gcp/sample_staging_query.v5__0
🧰 Additional context used
🧠 Learnings (1)
📚 Learning: the gcs bucket configuration `spark.chronon.table.gcs.temporary_gcs_bucket: "zl-warehouse"` should r...
Learnt from: david-zlai
PR: zipline-ai/chronon#222
File: cloud_gcp/src/main/resources/additional-confs.yaml:3-3
Timestamp: 2025-01-15T21:00:35.574Z
Learning: The GCS bucket configuration `spark.chronon.table.gcs.temporary_gcs_bucket: "zl-warehouse"` should remain in the main `additional-confs.yaml` file, not in dev-specific configs.

Applied to files:

  • api/python/test/canary/compiled/staging_queries/gcp/sample_staging_query.second__0
  • api/python/test/canary/compiled/staging_queries/gcp/sample_staging_query.fourth__0
🧬 Code Graph Analysis (1)
api/python/test/canary/staging_queries/gcp/sample_staging_query.py (2)
api/python/ai/chronon/staging_query.py (2)
  • StagingQuery (40-186)
  • TableDependency (19-38)
api/python/ai/chronon/utils.py (1)
  • get_staging_query_output_table_name (313-318)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (18)
  • GitHub Check: cloud_aws_tests
  • GitHub Check: service_commons_tests
  • GitHub Check: cloud_gcp_tests
  • GitHub Check: api_tests
  • GitHub Check: flink_tests
  • GitHub Check: service_tests
  • GitHub Check: online_tests
  • GitHub Check: aggregator_tests
  • GitHub Check: streaming_tests
  • GitHub Check: spark_tests
  • GitHub Check: scala_compile_fmt_fix
  • GitHub Check: python_tests
  • GitHub Check: batch_tests
  • GitHub Check: analyzer_tests
  • GitHub Check: fetcher_tests
  • GitHub Check: groupby_tests
  • GitHub Check: join_tests
  • GitHub Check: enforce_triggered_workflows
🔇 Additional comments (16)
api/python/test/canary/compiled/staging_queries/gcp/sample_staging_query.v1_hub__0 (2)

125-125: Templating syntax updated correctly.

Double curly braces align with the new templating standard.


3-3: Verify naming consistency across the refactoring.

This file retains "v1_hub" naming while other files moved to ordinal words. Confirm this is intentional.

api/python/test/canary/compiled/staging_queries/gcp/sample_staging_query.fourth__0 (1)

1-143: New staging query configuration looks good.

Follows ordinal naming convention and uses correct templating syntax.

api/python/test/canary/compiled/staging_queries/gcp/sample_staging_query.first__0 (1)

3-3: Clean rename from v1 to first.

Ordinal naming is more readable than versioned naming.

api/python/test/canary/compiled/staging_queries/gcp/sample_staging_query.sixth__0 (1)

3-3: Rename from v2 to sixth completed.

Ordinal naming improves clarity.

api/python/test/canary/compiled/staging_queries/gcp/sample_staging_query.fifth__0 (1)

3-3: Rename from v4 to fifth follows ordinal pattern.

The non-sequential mapping (v4→fifth) appears intentional.

api/python/test/canary/compiled/staging_queries/gcp/sample_staging_query.third__0 (2)

3-3: LGTM - consistent naming change

Metadata name updated from v3__0 to third__0 as expected.


125-125: Correct template syntax

Double brace templating {{ start_date }} and {{ end_date }} is properly used.

api/python/test/canary/compiled/staging_queries/gcp/sample_staging_query.terminal__0 (3)

3-3: LGTM - terminal query name updated

Metadata name correctly changed from terminal_v1__0 to terminal__0.


11-11: Dependencies properly updated

All Airflow dependencies correctly renamed from v1__0-v6__0 to first__0-sixth__0.


130-200: Table dependencies consistently updated

All table references properly changed to use ordinal naming (first__0 through sixth__0).

api/python/test/canary/staging_queries/gcp/sample_staging_query.py (4)

26-31: Variable names consistently updated

All staging query variables properly renamed from v1-v6 to first-sixth.


33-33: Terminal variable renamed

Terminal query variable correctly changed from terminal_v1 to terminal.


40-45: Dependencies updated to match new names

All table dependencies correctly reference the renamed variables (first through sixth).


54-54: Template syntax standardized

Query templating correctly updated from single braces to double braces.

api/python/test/canary/compiled/staging_queries/gcp/sample_staging_query.second__0 (1)

1-143: New staging query config properly structured

Complete configuration follows established patterns with correct ordinal naming (second__0) and double brace templating.

✨ Finishing Touches
  • 📝 Generate Docstrings
🧪 Generate unit tests
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch tchow/fix-sample

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai generate unit tests to generate unit tests for this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@tchow-zlai tchow-zlai merged commit fb4d0f6 into main Jul 31, 2025
21 checks passed
@tchow-zlai tchow-zlai deleted the tchow/fix-sample branch July 31, 2025 23:29
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.

4 participants