Skip to content

store table data cleaning and standardization#71

Merged
Ritik574-coder merged 1 commit into
mainfrom
dbt_branch
May 22, 2026
Merged

store table data cleaning and standardization#71
Ritik574-coder merged 1 commit into
mainfrom
dbt_branch

Conversation

@Ritik574-coder

@Ritik574-coder Ritik574-coder commented May 22, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • New Features

    • Added data profiling, validation, and standardization for store information
  • Bug Fixes

    • Removed query result limits to enable access to complete datasets
  • Documentation

    • Reorganized database documentation structure and section headers for clarity

Review Change Stack

@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@coderabbitai

coderabbitai Bot commented May 22, 2026

Copy link
Copy Markdown
📝 Walkthrough

Walkthrough

Three data exploration scripts are updated: reviews section headers clarify table overview and clean data stages; employees removes the TOP (1000) row limiter from final results; stores adds comprehensive profiling, validation, and standardization logic for store_id, store_name, store_type, and address, culminating in a unified clean data output with normalized values.

Changes

Data Exploration Scripts Maintenance

Layer / File(s) Summary
Review and Employee documentation/limit updates
explore_database/reviews/reviews.sql, explore_database/employees/employees.sql
Reviews script section headers renamed to clarify "REVIEW DATA" table overview and "REVIEW CLEAN DATA" stages; employees script removes TOP (1000) row limiter from the final "EMPLOYEE CLEAN DATA" SELECT.
Stores data profiling and validation
explore_database/stores/stores.sql
Initial query reformatted; new profiling sections added for store_id, store_name, store_type, and address columns, including type validation via TRY_CONVERT, null/empty checks, duplicate detection, and standardization rules mapping invalid values to Unknown with dbo.TitleCase normalization.
Stores clean data standardization pipeline
explore_database/stores/stores.sql
"STORES CLEAN DATA" SELECT pipeline reads the full column set from bronze.stores and applies CASE expressions to standardize store_name, store_type, and address (invalid → Unknown, valid → TRIM(dbo.TitleCase(...))), passing through all other store attributes unchanged.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related PRs

Suggested reviewers

  • ritsky-project

Poem

🐰 A rabbit hops through stores so neat,
Profiling each data row and beat,
No limits now on employees clear,
Clean, standardized data here,
Reviews renamed, all in sight!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'store table data cleaning and standardization' accurately reflects the primary change in the changeset: significant expansion of stores.sql with data cleaning and standardization logic, while also including minor updates to employees.sql and reviews.sql.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
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.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dbt_branch

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

@Ritik574-coder Ritik574-coder left a comment

Copy link
Copy Markdown
Owner Author

Choose a reason for hiding this comment

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

stores table data transformation

@github-actions

Copy link
Copy Markdown

Failed to generate code suggestions for PR

@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: 2

🤖 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 `@explore_database/stores/stores.sql`:
- Line 77: Replace the ineffective self-comparisons used in the profiling
filters — change "store_name != store_name" and "store_type != store_type" to
explicit NULL/empty checks (e.g., "store_name IS NULL OR store_name = ''" and
"store_type IS NULL OR store_type = ''") or, if you intend to compare to another
column, use "IS DISTINCT FROM"; update occurrences for the symbols store_name
and store_type (also replace the same predicates at the other location
referenced around lines 121).
- Line 30: Remove the stray leading dot from the multipart table references;
replace occurrences like "FROM .[bronze].[stores]" and "FROM
.[bronze].[sales_transactions]" with valid identifiers such as "FROM
[bronze].[stores]" (or the full three-part name "[database].[bronze].[stores]"
if a database qualifier is intended) so the T‑SQL multipart identifier is
syntactically correct; update the instances in the stores SQL and transactions
SQL (the lines containing ".\[bronze\].\[stores\]" and
".\[bronze\].\[sales_transactions\]") accordingly.
🪄 Autofix (Beta)

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: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: e4b93632-f2ff-4b07-8eed-a3d51c08a742

📥 Commits

Reviewing files that changed from the base of the PR and between 036421b and b3576de.

📒 Files selected for processing (3)
  • explore_database/employees/employees.sql
  • explore_database/reviews/reviews.sql
  • explore_database/stores/stores.sql

,[has_parking]
,[has_cafe]
FROM .[bronze].[stores] No newline at end of file
FROM .[bronze].[stores]

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🔴 Critical | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Read-only check: find leading-dot schema/table references that are likely invalid in T-SQL.
rg -nP --type-add 'sql:*.sql' --type sql '^\s*(FROM|JOIN)\s+\.\[[^]]+\]\.\[[^]]+\]'

Repository: Ritik574-coder/dbt_learning_project

Length of output: 292


Fix invalid T-SQL table reference syntax (FROM .[bronze].[stores]).

The leading dot before [bronze] in FROM .[bronze].[stores] is not valid multipart identifier syntax for SQL Server and can fail execution.

Also present in:

  • explore_database/stores/stores.sql:259 (FROM .[bronze].[stores])
  • explore_database/transactions/transactions.sql:62 (FROM .[bronze].[sales_transactions])
Proposed fix
-FROM .[bronze].[stores]
+FROM [bronze].[stores]
...
-FROM .[bronze].[stores]
+FROM [bronze].[stores]
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
FROM .[bronze].[stores]
FROM [bronze].[stores]
🤖 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 `@explore_database/stores/stores.sql` at line 30, Remove the stray leading dot
from the multipart table references; replace occurrences like "FROM
.[bronze].[stores]" and "FROM .[bronze].[sales_transactions]" with valid
identifiers such as "FROM [bronze].[stores]" (or the full three-part name
"[database].[bronze].[stores]" if a database qualifier is intended) so the T‑SQL
multipart identifier is syntactically correct; update the instances in the
stores SQL and transactions SQL (the lines containing ".\[bronze\].\[stores\]"
and ".\[bronze\].\[sales_transactions\]") accordingly.

store_name
FROM bronze.stores
WHERE store_name IS NULL
OR store_name != store_name

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

⚠️ Potential issue | 🟡 Minor | ⚡ Quick win

Replace self-comparison predicates in profiling filters.

store_name != store_name and store_type != store_type are ineffective for non-NULL rows, so these checks won’t catch dirty values as intended.

Proposed fix
-WHERE store_name IS NULL
-   OR store_name != store_name
+WHERE store_name IS NULL
+   OR store_name != TRIM(store_name)
    OR store_name != dbo.TitleCase(store_name)
    OR TRIM(store_name) = ''
    OR LEN(TRIM(store_name)) < 3 ;

-WHERE store_type IS NULL 
-   OR store_type != store_type
+WHERE store_type IS NULL 
+   OR store_type != TRIM(store_type)
    OR store_type != dbo.TitleCase(store_type)
    OR TRIM(store_type) = ''
    OR LEN(TRIM(store_type)) < 3 ;

Also applies to: 121-121

🤖 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 `@explore_database/stores/stores.sql` at line 77, Replace the ineffective
self-comparisons used in the profiling filters — change "store_name !=
store_name" and "store_type != store_type" to explicit NULL/empty checks (e.g.,
"store_name IS NULL OR store_name = ''" and "store_type IS NULL OR store_type =
''") or, if you intend to compare to another column, use "IS DISTINCT FROM";
update occurrences for the symbols store_name and store_type (also replace the
same predicates at the other location referenced around lines 121).

@chatgpt-codex-connector chatgpt-codex-connector 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: b3576de50b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".



-- address cleaning and standardization
WITH clean_address AS

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Terminate prior statement before clean_address CTE

Add a statement terminator before this CTE. The preceding debug query (... where len(address) = 12) is not ended with ;, and in SQL Server a WITH CTE in the middle of a batch must follow a terminated statement. As written, this section raises a syntax error near WITH, which prevents the rest of the stores cleaning script (including the final clean-data select) from running.

Useful? React with 👍 / 👎.

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