Skip to content

feat: add new granularities to gooddata-dbt and gooddata-pipelines - #1714

Open
okrcmaGD wants to merge 1 commit into
gooddata:masterfrom
okrcmaGD:okrc/cq-2783
Open

feat: add new granularities to gooddata-dbt and gooddata-pipelines#1714
okrcmaGD wants to merge 1 commit into
gooddata:masterfrom
okrcmaGD:okrc/cq-2783

Conversation

@okrcmaGD

@okrcmaGD okrcmaGD commented Aug 5, 2026

Copy link
Copy Markdown
Contributor

JIRA: CQ-2783
risk: low

Summary by CodeRabbit

  • New Features

    • Added optional second-level and minute/day timestamp granularities for date datasets.
    • Added configuration options for enabling second-based granularities through LDM Extension Manager and dbt deployment workflows.
    • The option remains disabled by default and requires the corresponding platform feature flag.
  • Documentation

    • Documented configuration and feature-flag requirements in the LDM Extension and dbt guides.
  • Tests

    • Added coverage for default and enabled second-level date granularities.

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

This change adds optional second-based date granularities to LDM extension and dbt workflows. The option is disabled by default and requires the organization feature flag. Documentation and tests cover both modes.

Changes

Second-based date granularities

Layer / File(s) Summary
LDM extension option propagation
packages/gooddata-pipelines/src/gooddata_pipelines/ldm_extension/*, packages/gooddata-pipelines/tests/test_ldm_extension/*, docs/content/en/latest/pipelines/ldm_extension/_index.md
LdmExtensionManager accepts and forwards enable_second_granularities. LdmExtensionDataProcessor selects standard or second-based granularities. Tests and documentation cover both modes.
dbt granularity generation
packages/gooddata-dbt/src/gooddata_dbt/dbt/*, packages/gooddata-dbt/src/gooddata_dbt/args.py, packages/gooddata-dbt/src/gooddata_dbt/dbt_plugin.py, packages/gooddata-dbt/tests/test_tables.py, packages/gooddata-dbt/README.md
The deploy_ldm option flows into DbtModelTables. Timestamp datasets receive second-based granularities when enabled. DATE columns keep their existing granularity set. Tests and documentation cover the option.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Sequence Diagram(s)

sequenceDiagram
  participant LdmExtensionManager
  participant LdmExtensionDataProcessor
  participant DateDatasetBuilder
  LdmExtensionManager->>LdmExtensionDataProcessor: Pass enable_second_granularities
  LdmExtensionDataProcessor->>DateDatasetBuilder: Use configured date granularities
  DateDatasetBuilder-->>LdmExtensionDataProcessor: Build date datasets
Loading
sequenceDiagram
  participant deploy_ldm
  participant DbtModelTables
  participant TimestampDateDataset
  deploy_ldm->>DbtModelTables: Pass CLI option
  DbtModelTables->>TimestampDateDataset: Add second timestamp granularities
  TimestampDateDataset-->>DbtModelTables: Return generated dataset
Loading

Possibly related PRs

Suggested reviewers: lupko, pcerny, hkad98

Poem

A rabbit checks each timestamp line,
From date to second, all align.
The flag stays off by default,
Then finer datasets are output.
Tests confirm the setting works.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 20.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: adding second-level granularities to both gooddata-dbt and gooddata-pipelines packages.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In
`@packages/gooddata-pipelines/src/gooddata_pipelines/ldm_extension/input_processor.py`:
- Line 64: Restore the public LdmExtensionDataProcessor.DATE_GRANULARITIES class
attribute as a deprecated alias referencing _DATE_GRANULARITIES, preserving
existing caller access without duplicating the granularity values.
🪄 Autofix

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: e731f3c6-6548-4baf-bbfc-5d9c6522845b

📥 Commits

Reviewing files that changed from the base of the PR and between 17bcb5c and f21fd8b.

📒 Files selected for processing (10)
  • docs/content/en/latest/pipelines/ldm_extension/_index.md
  • packages/gooddata-dbt/README.md
  • packages/gooddata-dbt/src/gooddata_dbt/args.py
  • packages/gooddata-dbt/src/gooddata_dbt/dbt/base.py
  • packages/gooddata-dbt/src/gooddata_dbt/dbt/tables.py
  • packages/gooddata-dbt/src/gooddata_dbt/dbt_plugin.py
  • packages/gooddata-dbt/tests/test_tables.py
  • packages/gooddata-pipelines/src/gooddata_pipelines/ldm_extension/input_processor.py
  • packages/gooddata-pipelines/src/gooddata_pipelines/ldm_extension/ldm_extension_manager.py
  • packages/gooddata-pipelines/tests/test_ldm_extension/test_input_processor.py

"""Create GoodData LDM from validated custom datasets and fields."""

DATE_GRANULARITIES: list[str] = [
_DATE_GRANULARITIES: list[str] = [

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

rg -n -C 2 '\bDATE_GRANULARITIES\b|\b_DATE_GRANULARITIES\b' packages docs

Repository: gooddata/gooddata-python-sdk

Length of output: 6156


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- input_processor.py outline ---'
ast-grep outline packages/gooddata-pipelines/src/gooddata_pipelines/ldm_extension/input_processor.py

printf '%s\n' '--- relevant source ---'
sed -n '1,180p' packages/gooddata-pipelines/src/gooddata_pipelines/ldm_extension/input_processor.py

printf '%s\n' '--- package exports and public references ---'
rg -n -C 2 'InputProcessor|input_processor|DATE_GRANULARITIES|_DATE_GRANULARITIES' \
  packages/gooddata-pipelines README.md docs 2>/dev/null || true

printf '%s\n' '--- package metadata ---'
fd -H -i 'pyproject.toml|setup.py|__init__.py|README*|CHANGELOG*' packages/gooddata-pipelines \
  --exec sh -c 'echo "--- $1"; sed -n "1,220p" "$1"' sh {}

Repository: gooddata/gooddata-python-sdk

Length of output: 47817


🏁 Script executed:

#!/bin/bash
set -euo pipefail

path='packages/gooddata-pipelines/src/gooddata_pipelines/ldm_extension/input_processor.py'

printf '%s\n' '--- current and parent declarations ---'
printf '%s\n' 'Current:'
git show "HEAD:${path}" | sed -n '55,105p'
printf '%s\n' 'Parent:'
git show "HEAD^:${path}" | sed -n '55,105p'

printf '%s\n' '--- history summary for the target file ---'
git log --oneline -8 -- "$path"

printf '%s\n' '--- imports of the processor module or constant ---'
rg -n 'from gooddata_pipelines\.ldm_extension\.input_processor|import gooddata_pipelines\.ldm_extension\.input_processor|DATE_GRANULARITIES' \
  --glob '*.py' --glob '*.md' --glob '*.rst' .

Repository: gooddata/gooddata-python-sdk

Length of output: 6583


Keep LdmExtensionDataProcessor.DATE_GRANULARITIES as a deprecated alias for _DATE_GRANULARITIES. Existing callers can access this public class attribute, and removing it causes AttributeError.

🧰 Tools
🪛 Ruff (0.16.1)

[warning] 64-83: Mutable default value for class attribute

(RUF012)

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@packages/gooddata-pipelines/src/gooddata_pipelines/ldm_extension/input_processor.py`
at line 64, Restore the public LdmExtensionDataProcessor.DATE_GRANULARITIES
class attribute as a deprecated alias referencing _DATE_GRANULARITIES,
preserving existing caller access without duplicating the granularity values.

@codecov

codecov Bot commented Aug 5, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 63.15789% with 7 lines in your changes missing coverage. Please review.
✅ Project coverage is 78.39%. Comparing base (acfcc1a) to head (1f3a106).
⚠️ Report is 4 commits behind head on master.

Files with missing lines Patch % Lines
packages/gooddata-dbt/src/gooddata_dbt/args.py 0.00% 3 Missing ⚠️
...a_pipelines/ldm_extension/ldm_extension_manager.py 60.00% 2 Missing ⚠️
...ckages/gooddata-dbt/src/gooddata_dbt/dbt/tables.py 83.33% 1 Missing ⚠️
...ckages/gooddata-dbt/src/gooddata_dbt/dbt_plugin.py 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1714      +/-   ##
==========================================
+ Coverage   78.30%   78.39%   +0.09%     
==========================================
  Files         271      271              
  Lines       18689    18748      +59     
==========================================
+ Hits        14634    14698      +64     
+ Misses       4055     4050       -5     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@coderabbitai

coderabbitai Bot commented Aug 5, 2026

Copy link
Copy Markdown

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
packages/gooddata-pipelines/src/gooddata_pipelines/ldm_extension/input_processor.py (1)

85-99: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Avoid sharing mutable granularity lists.

CatalogDeclarativeDateDataset retains the supplied list, and _date_from_field passes the same list to every dataset. Copy _date_granularities in __init__ and when constructing each dataset. Add ClassVar annotations if Ruff RUF012 is enabled.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In
`@packages/gooddata-pipelines/src/gooddata_pipelines/ldm_extension/input_processor.py`
around lines 85 - 99, Prevent shared mutable granularity lists by copying
_date_granularities in CatalogDeclarativeDateDataset.__init__ and copying it
again when _date_from_field constructs each dataset. Annotate class-level
mutable granularity constants with ClassVar if required by Ruff RUF012.

Source: Linters/SAST tools

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In
`@packages/gooddata-pipelines/src/gooddata_pipelines/ldm_extension/input_processor.py`:
- Around line 85-99: Prevent shared mutable granularity lists by copying
_date_granularities in CatalogDeclarativeDateDataset.__init__ and copying it
again when _date_from_field constructs each dataset. Annotate class-level
mutable granularity constants with ClassVar if required by Ruff RUF012.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 54f40155-b3eb-4148-bdd9-7d4e0953a987

📥 Commits

Reviewing files that changed from the base of the PR and between 17bcb5c and 1f3a106.

📒 Files selected for processing (10)
  • docs/content/en/latest/pipelines/ldm_extension/_index.md
  • packages/gooddata-dbt/README.md
  • packages/gooddata-dbt/src/gooddata_dbt/args.py
  • packages/gooddata-dbt/src/gooddata_dbt/dbt/base.py
  • packages/gooddata-dbt/src/gooddata_dbt/dbt/tables.py
  • packages/gooddata-dbt/src/gooddata_dbt/dbt_plugin.py
  • packages/gooddata-dbt/tests/test_tables.py
  • packages/gooddata-pipelines/src/gooddata_pipelines/ldm_extension/input_processor.py
  • packages/gooddata-pipelines/src/gooddata_pipelines/ldm_extension/ldm_extension_manager.py
  • packages/gooddata-pipelines/tests/test_ldm_extension/test_input_processor.py
🚧 Files skipped from review as they are similar to previous changes (8)
  • docs/content/en/latest/pipelines/ldm_extension/_index.md
  • packages/gooddata-dbt/README.md
  • packages/gooddata-dbt/src/gooddata_dbt/args.py
  • packages/gooddata-pipelines/tests/test_ldm_extension/test_input_processor.py
  • packages/gooddata-pipelines/src/gooddata_pipelines/ldm_extension/ldm_extension_manager.py
  • packages/gooddata-dbt/src/gooddata_dbt/dbt_plugin.py
  • packages/gooddata-dbt/tests/test_tables.py
  • packages/gooddata-dbt/src/gooddata_dbt/dbt/base.py

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.

1 participant