data-contract-validator 1.0.4__tar.gz → 1.0.4a0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {data_contract_validator-1.0.4/data_contract_validator.egg-info → data_contract_validator-1.0.4a0}/PKG-INFO +1 -1
- {data_contract_validator-1.0.4 → data_contract_validator-1.0.4a0}/data_contract_validator/cli.py +39 -12
- {data_contract_validator-1.0.4 → data_contract_validator-1.0.4a0}/data_contract_validator/extractors/dbt.py +2 -1
- {data_contract_validator-1.0.4 → data_contract_validator-1.0.4a0/data_contract_validator.egg-info}/PKG-INFO +1 -1
- {data_contract_validator-1.0.4 → data_contract_validator-1.0.4a0}/pyproject.toml +1 -1
- {data_contract_validator-1.0.4 → data_contract_validator-1.0.4a0}/CHANGELOG.md +0 -0
- {data_contract_validator-1.0.4 → data_contract_validator-1.0.4a0}/LICENSE +0 -0
- {data_contract_validator-1.0.4 → data_contract_validator-1.0.4a0}/MANIFEST.in +0 -0
- {data_contract_validator-1.0.4 → data_contract_validator-1.0.4a0}/README.md +0 -0
- {data_contract_validator-1.0.4 → data_contract_validator-1.0.4a0}/data_contract_validator/__init__.py +0 -0
- {data_contract_validator-1.0.4 → data_contract_validator-1.0.4a0}/data_contract_validator/core/__init__.py +0 -0
- {data_contract_validator-1.0.4 → data_contract_validator-1.0.4a0}/data_contract_validator/core/models.py +0 -0
- {data_contract_validator-1.0.4 → data_contract_validator-1.0.4a0}/data_contract_validator/core/validator.py +0 -0
- {data_contract_validator-1.0.4 → data_contract_validator-1.0.4a0}/data_contract_validator/extractors/__init__.py +0 -0
- {data_contract_validator-1.0.4 → data_contract_validator-1.0.4a0}/data_contract_validator/extractors/base.py +0 -0
- {data_contract_validator-1.0.4 → data_contract_validator-1.0.4a0}/data_contract_validator/extractors/fastapi.py +0 -0
- {data_contract_validator-1.0.4 → data_contract_validator-1.0.4a0}/data_contract_validator/integrations/__init__.py +0 -0
- {data_contract_validator-1.0.4 → data_contract_validator-1.0.4a0}/data_contract_validator/py.typed +0 -0
- {data_contract_validator-1.0.4 → data_contract_validator-1.0.4a0}/data_contract_validator/templates/github-actions-template.yml +0 -0
- {data_contract_validator-1.0.4 → data_contract_validator-1.0.4a0}/data_contract_validator.egg-info/SOURCES.txt +0 -0
- {data_contract_validator-1.0.4 → data_contract_validator-1.0.4a0}/data_contract_validator.egg-info/dependency_links.txt +0 -0
- {data_contract_validator-1.0.4 → data_contract_validator-1.0.4a0}/data_contract_validator.egg-info/entry_points.txt +0 -0
- {data_contract_validator-1.0.4 → data_contract_validator-1.0.4a0}/data_contract_validator.egg-info/requires.txt +0 -0
- {data_contract_validator-1.0.4 → data_contract_validator-1.0.4a0}/data_contract_validator.egg-info/top_level.txt +0 -0
- {data_contract_validator-1.0.4 → data_contract_validator-1.0.4a0}/requirements.txt +0 -0
- {data_contract_validator-1.0.4 → data_contract_validator-1.0.4a0}/setup.cfg +0 -0
{data_contract_validator-1.0.4 → data_contract_validator-1.0.4a0}/data_contract_validator/cli.py
RENAMED
|
@@ -163,23 +163,37 @@ def _interactive_setup() -> Dict[str, Any]:
|
|
|
163
163
|
if not click.confirm(" Continue anyway?"):
|
|
164
164
|
sys.exit(1)
|
|
165
165
|
|
|
166
|
+
# New question about manifest parsing
|
|
167
|
+
click.echo()
|
|
168
|
+
disable_manifest = click.confirm(
|
|
169
|
+
"4️⃣ Disable manifest.json parsing? (recommended if you have CTE-based models)",
|
|
170
|
+
default=True
|
|
171
|
+
)
|
|
172
|
+
|
|
173
|
+
if disable_manifest:
|
|
174
|
+
click.echo(" 📄 Will use SQL file parsing (better for complex models)")
|
|
175
|
+
else:
|
|
176
|
+
click.echo(" 📋 Will try manifest.json first, fallback to SQL parsing")
|
|
177
|
+
|
|
166
178
|
return {
|
|
167
179
|
"version": "1.0",
|
|
168
180
|
"name": f"contracts-{Path.cwd().name}",
|
|
169
|
-
"description": "Auto-generated data contract validation",
|
|
170
181
|
"source": {
|
|
171
|
-
"dbt": {
|
|
182
|
+
"dbt": {
|
|
183
|
+
"project_path": dbt_path,
|
|
184
|
+
"auto_compile": True,
|
|
185
|
+
"disable_manifest": disable_manifest # NEW
|
|
186
|
+
}
|
|
172
187
|
},
|
|
173
188
|
"target": {framework: api_config},
|
|
174
189
|
"validation": {
|
|
175
190
|
"fail_on": ["missing_tables", "missing_required_columns"],
|
|
176
|
-
"warn_on": ["type_mismatches"
|
|
177
|
-
"mode": "strict",
|
|
191
|
+
"warn_on": ["type_mismatches"]
|
|
178
192
|
},
|
|
179
|
-
"output": {"format": "terminal", "show_suggestions": True, "max_issues": 20},
|
|
180
193
|
}
|
|
181
194
|
|
|
182
195
|
|
|
196
|
+
|
|
183
197
|
def _quick_setup(framework: str, dbt_path: str) -> Dict[str, Any]:
|
|
184
198
|
"""Quick non-interactive setup with smart defaults."""
|
|
185
199
|
|
|
@@ -487,6 +501,7 @@ def _test_setup(config_file: Path) -> bool:
|
|
|
487
501
|
default="app/models",
|
|
488
502
|
help="Path in FastAPI repo (file or directory)",
|
|
489
503
|
)
|
|
504
|
+
@click.option("--disable-manifest", is_flag=True, help="Force SQL parsing, ignore manifest.json")
|
|
490
505
|
def validate(
|
|
491
506
|
config: str,
|
|
492
507
|
dry_run: bool,
|
|
@@ -496,6 +511,7 @@ def validate(
|
|
|
496
511
|
fastapi_directory: str,
|
|
497
512
|
fastapi_repo: str,
|
|
498
513
|
fastapi_path: str,
|
|
514
|
+
disable_manifest: bool,
|
|
499
515
|
):
|
|
500
516
|
"""🔍 Validate data contracts (prevents production breaks)."""
|
|
501
517
|
|
|
@@ -518,7 +534,7 @@ def validate(
|
|
|
518
534
|
if dry_run:
|
|
519
535
|
click.echo("🧪 Dry run - testing configuration only")
|
|
520
536
|
_test_configuration(
|
|
521
|
-
config_data, dbt_project, fastapi_local, fastapi_directory, fastapi_repo
|
|
537
|
+
config_data, dbt_project, fastapi_local, fastapi_directory, fastapi_repo, disable_manifest
|
|
522
538
|
)
|
|
523
539
|
return
|
|
524
540
|
|
|
@@ -567,29 +583,40 @@ def _run_validation(
|
|
|
567
583
|
output: str,
|
|
568
584
|
dbt_project: str,
|
|
569
585
|
fastapi_local: str,
|
|
570
|
-
fastapi_directory: str,
|
|
571
586
|
fastapi_repo: str,
|
|
572
587
|
fastapi_path: str,
|
|
588
|
+
disable_manifest: bool = False,
|
|
573
589
|
):
|
|
574
|
-
"""Run the actual validation with
|
|
590
|
+
"""Run the actual validation with manifest disable option."""
|
|
575
591
|
|
|
576
592
|
# Get DBT project path
|
|
577
593
|
dbt_path = dbt_project or config_data.get("source", {}).get("dbt", {}).get(
|
|
578
594
|
"project_path", "."
|
|
579
595
|
)
|
|
580
596
|
|
|
581
|
-
#
|
|
597
|
+
# Get disable_manifest from config file OR command line flag
|
|
598
|
+
config_disable_manifest = config_data.get("source", {}).get("dbt", {}).get("disable_manifest", False)
|
|
599
|
+
use_disable_manifest = disable_manifest or config_disable_manifest # CLI flag takes precedence
|
|
600
|
+
|
|
601
|
+
if use_disable_manifest:
|
|
602
|
+
click.echo("📄 Manifest parsing disabled")
|
|
603
|
+
if disable_manifest:
|
|
604
|
+
click.echo(" (via --disable-manifest flag)")
|
|
605
|
+
else:
|
|
606
|
+
click.echo(" (via .retl-validator.yml config)")
|
|
607
|
+
|
|
608
|
+
# Initialize DBT extractor with disable_manifest option
|
|
582
609
|
try:
|
|
583
|
-
dbt_extractor = DBTExtractor(dbt_path)
|
|
610
|
+
dbt_extractor = DBTExtractor(dbt_path, disable_manifest=use_disable_manifest)
|
|
584
611
|
except Exception as e:
|
|
585
612
|
click.echo(f"❌ Error initializing DBT extractor: {e}")
|
|
586
613
|
sys.exit(1)
|
|
587
614
|
|
|
588
615
|
# Initialize FastAPI extractor with directory support
|
|
589
616
|
try:
|
|
590
|
-
if fastapi_local
|
|
617
|
+
if fastapi_local:
|
|
591
618
|
# Use local path (file or directory)
|
|
592
|
-
local_path = fastapi_local
|
|
619
|
+
local_path = fastapi_local
|
|
593
620
|
|
|
594
621
|
# Auto-detect if it's a file or directory
|
|
595
622
|
path = Path(local_path)
|
|
@@ -16,11 +16,12 @@ from ..core.models import Schema
|
|
|
16
16
|
class DBTExtractor(BaseExtractor):
|
|
17
17
|
"""Extract schemas from DBT projects."""
|
|
18
18
|
|
|
19
|
-
def __init__(self, project_path: str = "."):
|
|
19
|
+
def __init__(self, project_path: str = ".", disable_manifest: bool = False):
|
|
20
20
|
self.project_path = Path(project_path)
|
|
21
21
|
self.target_dir = self.project_path / "target"
|
|
22
22
|
self.manifest_path = self.target_dir / "manifest.json"
|
|
23
23
|
self.models_path = self.project_path / "models"
|
|
24
|
+
self.disable_manifest = disable_manifest
|
|
24
25
|
|
|
25
26
|
def extract_schemas(self) -> Dict[str, Schema]:
|
|
26
27
|
"""Extract schemas from DBT project."""
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{data_contract_validator-1.0.4 → data_contract_validator-1.0.4a0}/data_contract_validator/py.typed
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|