model2data 0.1.0__tar.gz → 0.2.1__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.
Files changed (31) hide show
  1. {model2data-0.1.0 → model2data-0.2.1}/PKG-INFO +10 -3
  2. {model2data-0.1.0 → model2data-0.2.1}/README.md +2 -2
  3. model2data-0.2.1/model2data/__init__.py +3 -0
  4. {model2data-0.1.0 → model2data-0.2.1}/model2data/cli.py +7 -18
  5. {model2data-0.1.0 → model2data-0.2.1}/model2data/utils.py +2 -1
  6. {model2data-0.1.0 → model2data-0.2.1}/model2data.egg-info/PKG-INFO +10 -3
  7. {model2data-0.1.0 → model2data-0.2.1}/model2data.egg-info/SOURCES.txt +4 -6
  8. {model2data-0.1.0 → model2data-0.2.1}/model2data.egg-info/requires.txt +7 -0
  9. model2data-0.2.1/pyproject.toml +74 -0
  10. model2data-0.2.1/tests/test_cli.py +493 -0
  11. model2data-0.2.1/tests/test_coverage_gaps.py +233 -0
  12. model2data-0.2.1/tests/test_dbml_parser.py +929 -0
  13. model2data-0.2.1/tests/test_dbt_project.py +276 -0
  14. model2data-0.2.1/tests/test_dbt_tests.py +63 -0
  15. model2data-0.2.1/tests/test_generation.py +367 -0
  16. model2data-0.1.0/model2data/dbt/project.py +0 -74
  17. model2data-0.1.0/model2data/generate/core.py +0 -171
  18. model2data-0.1.0/model2data/generate/faker.py +0 -113
  19. model2data-0.1.0/model2data/generate/relationships.py +0 -49
  20. model2data-0.1.0/model2data/parse/dbml.py +0 -162
  21. model2data-0.1.0/pyproject.toml +0 -31
  22. model2data-0.1.0/tests/test_cli_smoke.py +0 -41
  23. model2data-0.1.0/tests/test_dbml_parser.py +0 -29
  24. model2data-0.1.0/tests/test_dbt_tests.py +0 -31
  25. model2data-0.1.0/tests/test_generation.py +0 -47
  26. {model2data-0.1.0 → model2data-0.2.1}/LICENSE +0 -0
  27. {model2data-0.1.0 → model2data-0.2.1}/model2data.egg-info/dependency_links.txt +0 -0
  28. {model2data-0.1.0 → model2data-0.2.1}/model2data.egg-info/entry_points.txt +0 -0
  29. {model2data-0.1.0 → model2data-0.2.1}/model2data.egg-info/top_level.txt +0 -0
  30. {model2data-0.1.0 → model2data-0.2.1}/setup.cfg +0 -0
  31. {model2data-0.1.0 → model2data-0.2.1}/tests/test_dbt_naming.py +1 -1
@@ -1,8 +1,8 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: model2data
3
- Version: 0.1.0
3
+ Version: 0.2.1
4
4
  Summary: Generate analytics-ready datasets from DBML models
5
- Requires-Python: >=3.9
5
+ Requires-Python: >=3.10
6
6
  Description-Content-Type: text/markdown
7
7
  License-File: LICENSE
8
8
  Requires-Dist: dbt-core>=1.5.0
@@ -13,6 +13,13 @@ Requires-Dist: pyyaml>=6.0.3
13
13
  Requires-Dist: typer>=0.20.0
14
14
  Provides-Extra: dev
15
15
  Requires-Dist: pytest; extra == "dev"
16
+ Requires-Dist: pytest-cov; extra == "dev"
17
+ Requires-Dist: pre-commit; extra == "dev"
18
+ Requires-Dist: ruff>=0.1.0; extra == "dev"
19
+ Requires-Dist: black>=23.0.0; extra == "dev"
20
+ Requires-Dist: ty>=0.0.4; extra == "dev"
21
+ Requires-Dist: types-pyyaml; extra == "dev"
22
+ Requires-Dist: poethepoet>=0.38.0; extra == "dev"
16
23
  Dynamic: license-file
17
24
 
18
25
  # model2data
@@ -22,7 +29,7 @@ Dynamic: license-file
22
29
  [![codecov](https://codecov.io/gh/JB-Analytica/model2data/branch/main/graph/badge.svg)](https://codecov.io/gh/JB-Analytica/model2data)
23
30
  [![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
24
31
 
25
- `model2data` turns **data models into analytics-ready datasets** in seconds.
32
+ `model2data` turns **data models into analytics-ready datasets** in seconds.
26
33
 
27
34
  Given a **DBML file**, it generates synthetic but realistic data, a complete dbt project scaffold, and everything you need to start analyzing or testing data pipelines.
28
35
 
@@ -5,7 +5,7 @@
5
5
  [![codecov](https://codecov.io/gh/JB-Analytica/model2data/branch/main/graph/badge.svg)](https://codecov.io/gh/JB-Analytica/model2data)
6
6
  [![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
7
7
 
8
- `model2data` turns **data models into analytics-ready datasets** in seconds.
8
+ `model2data` turns **data models into analytics-ready datasets** in seconds.
9
9
 
10
10
  Given a **DBML file**, it generates synthetic but realistic data, a complete dbt project scaffold, and everything you need to start analyzing or testing data pipelines.
11
11
 
@@ -134,4 +134,4 @@ Please read our [Code of Conduct](CODE_OF_CONDUCT.md) to understand our communit
134
134
 
135
135
  ## License
136
136
 
137
- MIT License. See LICENSE for details.
137
+ MIT License. See LICENSE for details.
@@ -0,0 +1,3 @@
1
+ """Model2Data: Generate analytics-ready datasets from DBML models."""
2
+
3
+ __version__ = "0.1.1"
@@ -1,19 +1,19 @@
1
- from pathlib import Path
2
- from typing import Optional
3
1
  import random
4
2
  import shutil
3
+ from pathlib import Path
4
+ from typing import Optional
5
5
 
6
6
  import typer
7
7
  from faker import Faker
8
8
 
9
- from model2data.parse.dbml import parse_dbml
10
- from model2data.generate.core import generate_data_from_dbml
11
9
  from model2data.dbt.project import (
12
- create_project_scaffold,
13
10
  create_profiles_yml,
11
+ create_project_scaffold,
14
12
  create_staging_models,
15
13
  )
16
14
  from model2data.dbt.tests import generate_dbt_yml
15
+ from model2data.generate.core import generate_data_from_dbml
16
+ from model2data.parse.dbml import parse_dbml
17
17
  from model2data.utils import normalize_identifier
18
18
 
19
19
  app = typer.Typer(
@@ -30,7 +30,7 @@ app = typer.Typer(
30
30
 
31
31
  @app.command(help="Generate synthetic data and a dbt project from a DBML model.")
32
32
  def main(
33
- file: Path = typer.Option(
33
+ file: Path = typer.Option( # noqa: B008
34
34
  ...,
35
35
  "--file",
36
36
  "-f",
@@ -88,24 +88,13 @@ def main(
88
88
  typer.echo("❌ No tables found in the provided DBML file.")
89
89
  raise typer.Exit(1)
90
90
 
91
- # -------------------------
92
- # DBML → dbt name mapping
93
- # -------------------------
94
- dbt_name_map = {
95
- table_name: normalize_identifier(table_name)
96
- for table_name in tables.keys()
97
- }
98
-
99
91
  project_name = normalize_identifier(name or file.stem)
100
92
  dest = Path.cwd() / f"dbt_{project_name}"
101
93
  profile_name = f"{project_name}_profile"
102
94
 
103
95
  if dest.exists():
104
96
  if not force:
105
- typer.echo(
106
- f"❌ Destination {dest} already exists.\n"
107
- "Use --force to overwrite."
108
- )
97
+ typer.echo(f"❌ Destination {dest} already exists.\nUse --force to overwrite.")
109
98
  raise typer.Exit(1)
110
99
  shutil.rmtree(dest)
111
100
 
@@ -1,9 +1,10 @@
1
1
  import re
2
2
 
3
+
3
4
  def normalize_identifier(value: str) -> str:
4
5
  cleaned = re.sub(r"[^0-9A-Za-z]+", "_", value).strip("_").lower()
5
6
  if not cleaned:
6
7
  cleaned = "table"
7
8
  if cleaned[0].isdigit():
8
9
  cleaned = f"t_{cleaned}"
9
- return cleaned
10
+ return cleaned
@@ -1,8 +1,8 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: model2data
3
- Version: 0.1.0
3
+ Version: 0.2.1
4
4
  Summary: Generate analytics-ready datasets from DBML models
5
- Requires-Python: >=3.9
5
+ Requires-Python: >=3.10
6
6
  Description-Content-Type: text/markdown
7
7
  License-File: LICENSE
8
8
  Requires-Dist: dbt-core>=1.5.0
@@ -13,6 +13,13 @@ Requires-Dist: pyyaml>=6.0.3
13
13
  Requires-Dist: typer>=0.20.0
14
14
  Provides-Extra: dev
15
15
  Requires-Dist: pytest; extra == "dev"
16
+ Requires-Dist: pytest-cov; extra == "dev"
17
+ Requires-Dist: pre-commit; extra == "dev"
18
+ Requires-Dist: ruff>=0.1.0; extra == "dev"
19
+ Requires-Dist: black>=23.0.0; extra == "dev"
20
+ Requires-Dist: ty>=0.0.4; extra == "dev"
21
+ Requires-Dist: types-pyyaml; extra == "dev"
22
+ Requires-Dist: poethepoet>=0.38.0; extra == "dev"
16
23
  Dynamic: license-file
17
24
 
18
25
  # model2data
@@ -22,7 +29,7 @@ Dynamic: license-file
22
29
  [![codecov](https://codecov.io/gh/JB-Analytica/model2data/branch/main/graph/badge.svg)](https://codecov.io/gh/JB-Analytica/model2data)
23
30
  [![License](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
24
31
 
25
- `model2data` turns **data models into analytics-ready datasets** in seconds.
32
+ `model2data` turns **data models into analytics-ready datasets** in seconds.
26
33
 
27
34
  Given a **DBML file**, it generates synthetic but realistic data, a complete dbt project scaffold, and everything you need to start analyzing or testing data pipelines.
28
35
 
@@ -1,6 +1,7 @@
1
1
  LICENSE
2
2
  README.md
3
3
  pyproject.toml
4
+ model2data/__init__.py
4
5
  model2data/cli.py
5
6
  model2data/utils.py
6
7
  model2data.egg-info/PKG-INFO
@@ -9,13 +10,10 @@ model2data.egg-info/dependency_links.txt
9
10
  model2data.egg-info/entry_points.txt
10
11
  model2data.egg-info/requires.txt
11
12
  model2data.egg-info/top_level.txt
12
- model2data/dbt/project.py
13
- model2data/generate/core.py
14
- model2data/generate/faker.py
15
- model2data/generate/relationships.py
16
- model2data/parse/dbml.py
17
- tests/test_cli_smoke.py
13
+ tests/test_cli.py
14
+ tests/test_coverage_gaps.py
18
15
  tests/test_dbml_parser.py
19
16
  tests/test_dbt_naming.py
17
+ tests/test_dbt_project.py
20
18
  tests/test_dbt_tests.py
21
19
  tests/test_generation.py
@@ -7,3 +7,10 @@ typer>=0.20.0
7
7
 
8
8
  [dev]
9
9
  pytest
10
+ pytest-cov
11
+ pre-commit
12
+ ruff>=0.1.0
13
+ black>=23.0.0
14
+ ty>=0.0.4
15
+ types-pyyaml
16
+ poethepoet>=0.38.0
@@ -0,0 +1,74 @@
1
+ [build-system]
2
+ requires = ["setuptools", "wheel"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "model2data"
7
+ version = "0.2.1"
8
+ description = "Generate analytics-ready datasets from DBML models"
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ dependencies = [
12
+ "dbt-core>=1.5.0",
13
+ "dbt-duckdb>=1.5.0",
14
+ "faker>=37.12.0",
15
+ "pandas>=2.3.3",
16
+ "pyyaml>=6.0.3",
17
+ "typer>=0.20.0",
18
+ ]
19
+
20
+ [project.optional-dependencies]
21
+ dev = [
22
+ "pytest",
23
+ "pytest-cov",
24
+ "pre-commit",
25
+ "ruff>=0.1.0",
26
+ "black>=23.0.0",
27
+ "ty>=0.0.4",
28
+ "types-pyyaml",
29
+ "poethepoet>=0.38.0",
30
+ ]
31
+
32
+ [project.scripts]
33
+ model2data = "model2data.cli:app"
34
+
35
+ [tool.setuptools.packages.find]
36
+ include = ["model2data"]
37
+
38
+ # Ruff configuration (fast Python linter)
39
+ [tool.ruff]
40
+ target-version = "py39"
41
+ line-length = 100
42
+
43
+ [tool.ruff.lint]
44
+ select = [
45
+ "E", # pycodestyle errors
46
+ "W", # pycodestyle warnings
47
+ "F", # pyflakes
48
+ "I", # isort (import sorting)
49
+ "C", # flake8-comprehensions
50
+ "B", # flake8-bugbear
51
+ ]
52
+ ignore = [
53
+ "E501", # line too long (handled by black)
54
+ "C901", # complexity (handled with noqa when needed)
55
+ ]
56
+
57
+ [tool.ruff.lint.isort]
58
+ known-first-party = ["model2data"]
59
+
60
+ # Black configuration (code formatter)
61
+ [tool.black]
62
+ line-length = 100
63
+ target-version = ["py310", "py311", "py312"]
64
+
65
+ # ty configuration (type checker)
66
+ [tool.ty]
67
+
68
+ # Poe the Poet task runner
69
+ [tool.poe.tasks]
70
+ lint = "ruff check ."
71
+ fix = "ruff check . --fix --exit-zero"
72
+ type = "ty check"
73
+ test-quick = "pytest -q --no-header -p no:warnings --no-cov"
74
+ check = ["fix", "lint", "type", "test-quick"]