Skip to content

Commit 73cade8

Browse files
committed
update master
2 parents 34ffcc8 + 0cee755 commit 73cade8

17 files changed

+269
-201
lines changed

CHANGELOG.md

Lines changed: 43 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,48 @@
22

33
All notable changes to this project will be documented in this file.
44

5+
## [Unreleased]
6+
7+
### Changed
8+
- Renamed rule classes to follow `*Validation` naming convention (e.g., `NotNullAndNotNaNValidation`)
9+
- Added `_parse_table_name()` helper for table name parsing
10+
- Moved `get_schema_and_table()` to base.py for reuse
11+
- Added `create_result()` factory method in base rule class
12+
- Added default values for database connection parameters
13+
- Updated custom rule names in HTML matrix display
14+
- Updated empty tables message in reports
15+
16+
### Added
17+
- `WholeTableNotNullAndNotNaNValidation` rule for validating all columns automatically
18+
- Dynamic version display in HTML reports
19+
- Automatic rule initialization
20+
21+
### Fixed
22+
- Directory handling for validation runs
23+
- Report generation issues
24+
25+
## [1.1.1] - 2025-11-21
26+
27+
### Changed
28+
- Upgraded to Python 3.10
29+
- Renamed `dataset` parameter to `table` in rule definitions
30+
- Refactored rule initialization with centralized code
31+
- Updated dependencies for egon-data compatibility
32+
- Improved Details section in HTML report
33+
34+
### Added
35+
- Inline validation declaration support
36+
- Execution time tracking for rules
37+
- `__init__` methods to all validation classes
38+
- Logging for table count during validation
39+
- Report assets included in package distribution
40+
41+
### Fixed
42+
- Test bugs and rule discovery issues
43+
- GeoAlchemy compatibility
44+
- Coverage test calculations
45+
- Return statement handling in rules
46+
547
## [1.0.0] - 2025-09-29
648

749
### Added
@@ -41,11 +83,6 @@ All notable changes to this project will be documented in this file.
4183
- Coverage analysis for missing tables
4284
- Rule registration and discovery
4385

44-
## [Unreleased]
45-
46-
### Changed
47-
- Updated README.md structure and documentation
48-
4986
---
5087

5188
## Development History
@@ -141,4 +178,5 @@ All notable changes to this project will be documented in this file.
141178
- Add sanity rules
142179
- Initial project skeleton
143180

181+
[1.1.1]: https://github.com/yourusername/egon-validation/releases/tag/v1.1.1
144182
[1.0.0]: https://github.com/yourusername/egon-validation/releases/tag/v1.0.0

README.md

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -101,15 +101,16 @@ class CapacityRangeCheck(SqlRule):
101101

102102
| Rule | Purpose |
103103
|------|---------|
104-
| `NotNullAndNotNaN` | Validates no NULL/NaN values in one or more specified columns |
105-
| `WholeTableNotNullAndNotNaN` | Validates no NULL/NaN values in all table columns (auto-discovery) |
104+
| `NotNullAndNotNaNValidation` | Validates no NULL/NaN values in one or more specified columns |
105+
| `WholeTableNotNullAndNotNaNValidation` | Validates no NULL/NaN values in all table columns (auto-discovery) |
106106
| `DataTypeValidation` | Verifies data types for one or more columns |
107-
| `GeometryCheck` | PostGIS geometry validity |
108-
| `SRIDUniqueNonZero` | PostGIS SRID consistency |
109-
| `ReferentialIntegrityCheck` | Foreign key validation |
110-
| `RowCountCheck` | Row count boundaries |
111-
| `ValueSetCheck` | Enum/allowed values |
112-
| `ArrayCardinalityCheck` | Array length constraints |
107+
| `GeometryContainmentValidation` | PostGIS geometry validity and containment |
108+
| `SRIDUniqueNonZero` | PostGIS SRID consistency (unique, non-zero) |
109+
| `SRIDSpecificValidation` | PostGIS SRID validation against expected value |
110+
| `ReferentialIntegrityValidation` | Foreign key validation |
111+
| `RowCountValidation` | Row count boundaries |
112+
| `ValueSetValidation` | Enum/allowed values |
113+
| `ArrayCardinalityValidation` | Array length constraints |
113114

114115
## Configuration
115116

egon_validation/db.py

Lines changed: 21 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,32 @@
1313

1414
logger = get_logger("db")
1515

16+
# Database connection pool configuration
17+
# Pool size matches default ThreadPoolExecutor max_workers (6) + 1 for main thread
18+
DEFAULT_POOL_SIZE = 7
19+
# Allow temporary bursts up to 10 total connections (7 + 3)
20+
DEFAULT_MAX_OVERFLOW = 3
21+
# Recycle connections after 30 minutes to prevent stale connections
22+
POOL_RECYCLE_SECONDS = 1800
23+
1624

1725
def make_engine(db_url: str, echo: bool = False) -> Engine:
18-
"""Create SQLAlchemy engine with connection pooling."""
26+
"""Create SQLAlchemy engine with connection pooling.
27+
28+
Args:
29+
db_url: Database connection URL
30+
echo: If True, log all SQL statements
31+
32+
Returns:
33+
Configured SQLAlchemy Engine with connection pooling
34+
"""
1935
return create_engine(
2036
db_url,
2137
echo=echo,
22-
pool_size=7,
23-
max_overflow=3,
24-
pool_pre_ping=True,
25-
pool_recycle=1800,
38+
pool_size=DEFAULT_POOL_SIZE,
39+
max_overflow=DEFAULT_MAX_OVERFLOW,
40+
pool_pre_ping=True, # Verify connection health before using
41+
pool_recycle=POOL_RECYCLE_SECONDS,
2642
)
2743

2844

egon_validation/report/assets/report.js

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,6 +184,17 @@
184184
return ruleName.substring(0, 10);
185185
}
186186

187+
// Function to create abbreviation for custom check names (underscore-separated)
188+
function createCustomCheckAbbreviation(name) {
189+
const words = name.split('_');
190+
if (words.length > 1) {
191+
// Take first letter of each word part
192+
return words.map(w => w[0]).join('').toUpperCase();
193+
}
194+
// If no underscores, take first 4 characters
195+
return name.substring(0, 4).toUpperCase();
196+
}
197+
187198
const thead = document.createElement('thead'); const hr = document.createElement('tr');
188199
hr.innerHTML = '<th>Schema.Table \\\\ Rule</th>' +
189200
rules.map(r => `<th title="${r}">${createAbbreviation(r)}</th>`).join('') +
@@ -206,7 +217,7 @@
206217
rowHtml += `<td>${icon}</td>`;
207218
}
208219
const customs = (coverage.custom_checks && coverage.custom_checks[d]) ? coverage.custom_checks[d] : [];
209-
const customHtml = customs.length ? customs.map(name => `<span class="tag has-tooltip clickable" title="Custom check: ${name}" data-dataset="${d}" data-rule="${name}">${name}</span>`).join('') : '<span class="badge empty">—</span>';
220+
const customHtml = customs.length ? customs.map(name => `<span class="tag has-tooltip clickable" title="${name}" data-dataset="${d}" data-rule="${name}">${createCustomCheckAbbreviation(name)}</span>`).join('') : '<span class="badge empty">—</span>';
210221
rowHtml += `<td class="custom-cell">${customHtml}</td>`;
211222
tr.innerHTML = rowHtml; tbody.appendChild(tr);
212223
}

0 commit comments

Comments
 (0)