Skip to content

fix: use .values("id").distinct().count() in platform_hub for Oracle compatibility#7041

Merged
gagantrivedi merged 1 commit intomainfrom
fix/platform-hub-oracle-distinct
Mar 25, 2026
Merged

fix: use .values("id").distinct().count() in platform_hub for Oracle compatibility#7041
gagantrivedi merged 1 commit intomainfrom
fix/platform-hub-oracle-distinct

Conversation

@gagantrivedi
Copy link
Member

Thanks for submitting a PR! Please check the boxes below:

  • I have read the Contributing Guide.
  • I have added information to docs/ if required so people know about the feature.
  • I have filled in the "Changes" section below.
  • I have filled in the "How did you test this code" section below.

Changes

Fix three distinct().count() queries in platform_hub/services.py that fail on Oracle with ORA-00932: inconsistent datatypes: expected - got NCLOB.

FFAdminUser has TextField columns (e.g. onboarding_data) which Oracle maps to NCLOB — Oracle cannot perform SELECT DISTINCT on NCLOB columns. Using .values("id").distinct().count() generates SELECT DISTINCT "id" instead of SELECT DISTINCT *, avoiding the NCLOB column while producing identical results since id is the primary key.

How did you test this code?

  • Oracle unit tests pass in flagsmith-ee CI (all 7 previously failing platform_hub tests now green)
  • Postgres unit tests pass locally and in CI
  • MySQL unit tests pass in CI

The three distinct().count() queries in get_summary() fail on Oracle
with ORA-00932 because FFAdminUser has TextField columns that Oracle
maps to NCLOB, which cannot be used in SELECT DISTINCT. Using
.values("id").distinct().count() generates SELECT DISTINCT on just
the PK column, avoiding the NCLOB issue while producing identical
results.
@gagantrivedi gagantrivedi requested a review from a team as a code owner March 25, 2026 10:05
@gagantrivedi gagantrivedi requested review from emyller and removed request for a team March 25, 2026 10:05
Copy link

@claude claude bot left a comment

Choose a reason for hiding this comment

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

⚠️ Code review skipped — your organization's overage spend limit has been reached.

Code review is billed via overage credits. To resume reviews, an organization admin can raise the monthly limit in Settings → Usage.

Once credits are available, reopen this pull request to trigger a review.

@vercel
Copy link

vercel bot commented Mar 25, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

3 Skipped Deployments
Project Deployment Actions Updated (UTC)
docs Ignored Ignored Mar 25, 2026 10:05am
flagsmith-frontend-preview Ignored Ignored Mar 25, 2026 10:05am
flagsmith-frontend-staging Ignored Ignored Mar 25, 2026 10:05am

Request Review

@github-actions github-actions bot added api Issue related to the REST API fix labels Mar 25, 2026
@github-actions
Copy link
Contributor

github-actions bot commented Mar 25, 2026

Docker builds report

Image Build Status Security report
ghcr.io/flagsmith/flagsmith-e2e:pr-7041 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-frontend:pr-7041 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-api-test:pr-7041 Finished ✅ Skipped
ghcr.io/flagsmith/flagsmith-api:pr-7041 Finished ✅ Results
ghcr.io/flagsmith/flagsmith:pr-7041 Finished ✅ Results
ghcr.io/flagsmith/flagsmith-private-cloud:pr-7041 Finished ✅ Results

@codecov
Copy link

codecov bot commented Mar 25, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 98.33%. Comparing base (7b37e2e) to head (4e681a6).
⚠️ Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #7041   +/-   ##
=======================================
  Coverage   98.33%   98.33%           
=======================================
  Files        1337     1337           
  Lines       50010    50010           
=======================================
  Hits        49178    49178           
  Misses        832      832           

☔ View full report in Codecov by Sentry.
📢 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.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@github-actions
Copy link
Contributor

github-actions bot commented Mar 25, 2026

Playwright Test Results (oss - depot-ubuntu-latest-16)

passed  10 passed

Details

stats  10 tests across 7 suites
duration  46.2 seconds
commit  4e681a6
info  🔄 Run: #15490 (attempt 1)

Playwright Test Results (oss - depot-ubuntu-latest-arm-16)

passed  10 passed

Details

stats  10 tests across 7 suites
duration  27.6 seconds
commit  4e681a6
info  🔄 Run: #15490 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  53.6 seconds
commit  4e681a6
info  🔄 Run: #15490 (attempt 1)

Playwright Test Results (private-cloud - depot-ubuntu-latest-arm-16)

passed  1 passed

Details

stats  1 test across 1 suite
duration  1 minute, 1 second
commit  4e681a6
info  🔄 Run: #15490 (attempt 1)

@gagantrivedi gagantrivedi merged commit 3f71f16 into main Mar 25, 2026
33 checks passed
@gagantrivedi gagantrivedi deleted the fix/platform-hub-oracle-distinct branch March 25, 2026 10:16
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

api Issue related to the REST API fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants