Repository navigation
chore: Release v1.0.0.dev10 - #28
Merged
Merged
Conversation
…ort (#23) * feat(postgres): add row-level lock enhancement and advisory lock support Row-level lock enhancement: - FOR SHARE: Shared lock, allows reads but blocks updates (PG 9.0+) - FOR NO KEY UPDATE: Weaker exclusive lock (PG 9.0+) - FOR KEY SHARE: Weakest shared lock (PG 9.3+) - Add LockStrength enum in core query_parts - Extend ForUpdateClause to support different lock strengths - Add capability detection methods in PostgreSQLDialect Advisory lock support: - Session-level locks: pg_advisory_lock, pg_advisory_lock_shared - Transaction-level locks: pg_advisory_xact_lock, pg_advisory_xact_lock_shared - Non-blocking try variants: pg_try_advisory_lock, pg_try_advisory_lock_shared - Unlock functions: pg_advisory_unlock, pg_advisory_unlock_all - Context manager support for automatic lock release - Support for both single-key and two-key variants Implementation: - Add PostgreSQLAdvisoryLockSupport protocol - Add AdvisoryLockMixin for backend methods - Add expression classes in core advisory module - Implement format_for_update_clause with lock strength - Add version-aware capability detection Tests: - test_row_level_locks.py: Row-level lock strength tests - test_advisory_lock.py: Advisory lock functionality tests - Both sync and async versions covered Official Documentation: - Row-level locks: https://www.postgresql.org/docs/current/explicit-locking.html - Advisory locks: https://www.postgresql.org/docs/current/functions-admin.html#FUNCTIONS-ADVISORY-LOCKS * refactor(postgres): migrate advisory lock and lock strength to extension package - Move advisory lock expressions from core to postgres/expression/advisory/ - Define LockStrength enum and PostgresForUpdateClause in postgres/expression/ - PostgresForUpdateClause.to_sql() handles PostgreSQL-specific lock strengths - Update import paths in backend, mixin, and protocol files - Reorganize test directory: move activerecord_test/ to activerecord_postgres_test/ - Add postgres_dialect fixture to backend conftest.py - Add .claude/tmp/ to .gitignore Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * ci: update dependency sources to Git branches - rhosocial-activerecord: git+https@release/v1.0.0.dev23 - rhosocial-activerecord-testsuite: git+https@release/v1.0.0.dev10 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: add changelog fragment for PR #23 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
* refactor: migrate functions from types to functions modules Split responsibilities between types and functions modules for text search and XML: **Text Search** - Create: functions/text_search.py with SQL generation functions - Moved functions (14 total): - to_tsvector, to_tsquery, plainto_tsquery, phraseto_tsquery, websearch_to_tsquery - ts_matches, ts_matches_expr, ts_rank, ts_rank_cd, ts_headline - tsvector_concat, tsvector_strip, tsvector_setweight, tsvector_length - Retained in types/text_search.py: PostgresTsVector, PostgresTsQuery, and related classes **XML** - Create: functions/xml.py with SQL generation functions - Moved functions (4 total): xmlparse, xpath_query, xpath_exists, xml_is_well_formed - Retained in types/xml.py: PostgresXML class **Module Updates** - functions/__init__.py: Export all new text search and XML functions - types/__init__.py: Remove function exports, keep only type exports - backend/__init__.py: Update imports to use functions.text_search - test_xml_types.py: Update to import functions from functions.xml **Benefits** - Clear separation of concerns: types for data structures, functions for SQL generators - Better module organization following single responsibility principle - Easier maintenance and discoverability of SQL generation utilities Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: add changelog fragment for PR #24 --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
* feat(postgres): add math enhanced functions with proper naming - round_ (round is Python builtin) - pow, power (POWER alias) - sqrt, mod, ceil, floor, trunc - max_, min_ (GREATEST/LEAST for scalar, MAX/MIN for aggregate) - avg (AVG aggregate) Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * chore: add changelog fragment for PR #25 Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
… network, UUID, hstore, range) (#26) * feat(postgres): add array, network, UUID functions and fix range constructors New function modules: - array.py: 17 array functions (array_agg, array_append, etc.) - network.py: 15 network functions (inet_client_addr, inet_merge, etc.) - uuid.py: 7 UUID functions (uuid_generate_v1, uuid_generate_v4, etc.) Fix range constructors to use sentinel pattern for bounds parameter: - int4range, int8range, numrange, tsrange, tstzrange, daterange - Omit bounds when using default inclusive '[]', include when explicitly specified Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat(postgres): add comprehensive hstore function support Add PostgreSQL hstore extension functions including: - Constructors: hstore_from_record, hstore_from_key_value - Key/Value extraction: akeys, skeys, avals, svals, each - Conversion: hstore_to_array, hstore_to_matrix, hstore_to_json, hstore_to_jsonb, hstore_to_json_loose, hstore_to_jsonb_loose - Existence: hstore_exist, hstore_defined - Delete: hstore_delete, hstore_delete_keys, hstore_delete_pairs - Record: hstore_populate_record - Operators: hstore_get_value, hstore_get_values, hstore_concat, hstore_key_exists, hstore_all_keys_exist, hstore_any_key_exists, hstore_contains, hstore_contained_by, hstore_subtract_*, hstore_to_array_operator, hstore_to_matrix_operator, hstore_record_update - Subscript: hstore_subscript_get, hstore_subscript_set Note: Generic function names (exist, delete, defined, slice, populate_record, record_update) are prefixed with hstore_ to avoid confusion with unrelated functionality. * refactor(postgres): rename hstore extraction functions with hstore_ prefix Rename generic function names to avoid confusion: - akeys → hstore_akeys - skeys → hstore_skeys - avals → hstore_avals - svals → hstore_svals - each → hstore_each All hstore functions now consistently use the hstore_ prefix. * chore: add changelog fragment for PR #26 * test(postgres): add hstore function tests for full coverage --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
* feat(postgres): add constraint DDL support with EXCLUDE and NOT VALID Add PostgreSQL-specific constraint DDL formatting directly in PostgresDialect (not via mixin override, due to Python C3 MRO placing SQLDialectBase before mixins): - EXCLUDE constraint support with USING, elements, WHERE, DEFERRABLE - NOT VALID suffix for skipping validation of existing rows - format_add_table_constraint_action overrides base class for PG extensions - PostgresConstraintMixin retained as organizational placeholder Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com> * feat(backend): add PostgreSQL constraint support protocol - Add PostgresConstraintSupport protocol for PostgreSQL-proprietary constraint features (NOT VALID, EXCLUDE constraints) - Implement supports_constraint_enforced() returning False (PostgreSQL uses NOT VALID instead of ENFORCED/NOT ENFORCED) - Add supports_constraint_novalidate() and supports_exclude_constraint() to PostgresConstraintMixin * chore: add changelog fragment for PR #27 --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
- Add DDL documentation covering PostgreSQL-specific DDL operations - Add BackendGroup documentation for connection management - Add worker_isolation examples demonstrating connection sharing anti-pattern - Fix schema to include order_number column
…Python 3.8 Instantiate WindowsSelectorEventLoopPolicy before passing to set_event_loop_policy() to avoid assertion failure when the policy argument is not an AbstractEventLoopPolicy instance.
- Add WindowsSelectorEventLoopPolicy setup for Windows async workers - Add Windows test results to README.md - Fixes Psycopg ProactorEventLoop compatibility error on Windows
… en_US) Add comprehensive Section 9 with: - Test environment details (macOS Tahoe 26, Windows 11) - Test results for exp1-exp5 - Platform-specific notes for Windows event loop - Cross-platform conclusions
Add detailed experimental data from Python 3.8.10 environment: - macOS arm64 shows stable 1.0x speedup with sync multiprocess - Async exp2 triggered deadlock (SQLSTATE 40P01) due to small dataset - Updated test environment details with exact version numbers - Added notes on PostgreSQL deadlock behavior in concurrent testing
- Add exp6_backend_group_pool.py to compare BackendGroup vs BackendPool - Add chapter_10_fastapi/ with complete FastAPI async example - Update parallel_workers.md (zh_CN + en_US) with exp6 results - Document BackendPool as recommended approach for PostgreSQL - Document connection pooling best practices for FastAPI Key findings from exp6: - BackendPool (20/20 success) outperforms BackendGroup for thread safety - PostgreSQL (threadsafety=2) supports connection pooling - BackendPool is recommended for FastAPI + PostgreSQL - Connection pooling provides efficient connection reuse
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #28 +/- ##
==========================================
+ Coverage 72.45% 72.51% +0.05%
==========================================
Files 113 128 +15
Lines 6632 7261 +629
Branches 1103 1194 +91
==========================================
+ Hits 4805 5265 +460
- Misses 1445 1565 +120
- Partials 382 431 +49
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.



Description
This PR merges the
release/v1.0.0.dev10branch intomain, delivering PostgreSQL backend enhancements including row-level locking, comprehensive PostgreSQL function support, and constraint support protocol.Release/Hotfix Details
v1.0.0.dev10Included Changes
New Features
Bug Fixes
Other Updates
Related Issues/PRs
Breaking Change
Applicable
rhosocial-activerecordVersion Range: >=1.0.0.dev10Testing
release/v1.0.0.dev10orhotfix/ar-XXX).Test Plan: Full test suite execution on release branch
Checklist
CHANGELOG.mdusingtowncrier build(for releases).Additional Notes
This is a development release (dev10) containing PostgreSQL backend improvements. The changelog will be built using towncrier after CI verification.