Skip to content

Conversation

@vistart
Copy link
Contributor

@vistart vistart commented May 3, 2025

This pull request implements Common Table Expressions (CTEs) functionality and related backend improvements. The changes include:

New Features

  • Added support for Common Table Expressions (CTEs) in queries
  • Implemented various CTE types including basic, multiple, and recursive CTEs
  • Added materialization hints support for databases that support it
  • Enhanced query capabilities with chainable method calls for building complex queries

Code Changes

  • Created new CTE implementation in src/rhosocial/activerecord/query/cte.py
  • Modified relational query functionality in src/rhosocial/activerecord/query/relational.py
  • Updated relation descriptors in src/rhosocial/activerecord/relation/descriptors.py

Testing

  • Added comprehensive test suite for CTE functionality:
    • Basic CTE tests
    • Multiple CTEs in a single query
    • Recursive CTEs
    • Advanced aggregate operations with CTEs
  • Added SQLite-specific backend tests
  • Created test fixtures and SQL schema files for testing

Documentation

  • Added documentation for CTE functionality in both English and Chinese
  • Updated existing documentation to reference new features

These changes enhance the query capabilities of the ActiveRecord implementation, allowing for more complex and efficient database operations through the use of Common Table Expressions.

@sonarqubecloud
Copy link

sonarqubecloud bot commented May 3, 2025

Quality Gate Failed Quality Gate failed

Failed conditions
5.2% Duplication on New Code (required ≤ 3%)
C Reliability Rating on New Code (required ≥ A)

See analysis details on SonarQube Cloud

Catch issues before they fail your Quality Gate with our IDE extension SonarQube for IDE

@codecov
Copy link

codecov bot commented May 3, 2025

Codecov Report

Attention: Patch coverage is 69.53642% with 230 lines in your changes missing coverage. Please review.

Project coverage is 76.11%. Comparing base (47b90bc) to head (edec4fb).
Report is 8 commits behind head on main.

Files with missing lines Patch % Lines
src/rhosocial/activerecord/query/cte.py 80.15% 29 Missing and 21 partials ⚠️
...ocial/activerecord/backend/basic_type_converter.py 31.42% 40 Missing and 8 partials ⚠️
src/rhosocial/activerecord/query/relational.py 75.00% 28 Missing and 10 partials ⚠️
src/rhosocial/activerecord/query/aggregate.py 41.30% 21 Missing and 6 partials ⚠️
...ctiverecord/backend/impl/sqlite/type_converters.py 42.85% 16 Missing and 4 partials ⚠️
src/rhosocial/activerecord/query/base.py 66.66% 12 Missing and 4 partials ⚠️
src/rhosocial/activerecord/backend/base.py 33.33% 11 Missing and 1 partial ⚠️
src/rhosocial/activerecord/backend/dialect.py 78.37% 8 Missing ⚠️
...social/activerecord/backend/impl/sqlite/backend.py 80.00% 6 Missing and 2 partials ⚠️
...social/activerecord/backend/impl/sqlite/dialect.py 97.72% 1 Missing ⚠️
... and 2 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #11      +/-   ##
==========================================
+ Coverage   75.65%   76.11%   +0.46%     
==========================================
  Files          45       46       +1     
  Lines        4527     5163     +636     
  Branches      812      940     +128     
==========================================
+ Hits         3425     3930     +505     
- Misses        853      929      +76     
- Partials      249      304      +55     
Flag Coverage Δ
python-3.10 75.93% <69.53%> (?)
python-3.11 75.93% <69.53%> (?)
python-3.12 75.93% <69.53%> (?)
python-3.13 75.93% <69.53%> (+0.50%) ⬆️
python-3.8 76.04% <69.53%> (+0.47%) ⬆️
python-3.9 75.91% <69.53%> (?)
unittests 76.09% <69.53%> (+0.46%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ 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.

@vistart vistart merged commit df6cfcb into main May 3, 2025
7 of 9 checks passed
@vistart vistart deleted the backend branch May 3, 2025 05:59
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