nesso-cli 0.12.0__tar.gz → 0.13.0__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 (140) hide show
  1. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/.github/workflows/build.yml +8 -10
  2. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/.secrets.baseline +2 -2
  3. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/PKG-INFO +2 -2
  4. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/docs/tutorials/create_tutorial_tables.py +2 -2
  5. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/examples/nesso_models/create_tutorial_tables.py +2 -2
  6. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/pyproject.toml +4 -4
  7. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/src/nesso_cli/models/common.py +7 -0
  8. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/src/nesso_cli/models/init.py +3 -1
  9. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/src/nesso_cli/models/models.py +18 -6
  10. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/src/nesso_cli/models/resources.py +1 -1
  11. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/src/nesso_cli/models/source.py +4 -3
  12. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/src/nesso_cli/models/tests/conftest.py +37 -32
  13. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/src/nesso_cli/models/tests/functional/test_da_workflow.py +45 -27
  14. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/src/nesso_cli/models/tests/test_base_model.py +12 -4
  15. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/src/nesso_cli/models/tests/test_common.py +7 -5
  16. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/src/nesso_cli/models/tests/test_config.py +1 -0
  17. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/src/nesso_cli/models/tests/test_init.py +9 -7
  18. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/src/nesso_cli/models/tests/test_main.py +5 -1
  19. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/src/nesso_cli/models/tests/test_metadata.py +1 -0
  20. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/src/nesso_cli/models/tests/test_models.py +4 -2
  21. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/src/nesso_cli/models/tests/test_resources.py +6 -5
  22. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/src/nesso_cli/models/tests/test_seed.py +11 -5
  23. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/src/nesso_cli/models/tests/test_source.py +121 -7
  24. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/src/nesso_cli/models/tests/test_update.py +13 -10
  25. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/src/nesso_cli/models/tests/validate_tables.py +2 -1
  26. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/uv.lock +1038 -947
  27. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/.github/workflows/cd.yml +0 -0
  28. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/.github/workflows/ci.yml +0 -0
  29. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/.github/workflows/notify-labeled-devops.yml +0 -0
  30. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/.github/workflows/static-site-prepare.yml +0 -0
  31. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/.gitignore +0 -0
  32. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/.pre-commit-config.yaml +0 -0
  33. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/.prettierignore +0 -0
  34. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/.python-version +0 -0
  35. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/.vscode/extensions.list +0 -0
  36. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/.vscode/install_extensions.sh +0 -0
  37. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/.vscode/launch.json +0 -0
  38. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/.vscode/settings.json +0 -0
  39. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/CHANGELOG.md +0 -0
  40. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/CONTRIBUTING.md +0 -0
  41. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/README.md +0 -0
  42. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/coverage/coverage-badge.svg +0 -0
  43. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/coverage/docstring_coverage.svg +0 -0
  44. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/docs/_static/data_architecture_vision_copied_from_nesso_docs.drawio.png +0 -0
  45. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/docs/_static/logo.png +0 -0
  46. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/docs/_static/where_nesso_cli_fits.png +0 -0
  47. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/docs/advanced_usage/introduction.md +0 -0
  48. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/docs/advanced_usage/scheduling.md +0 -0
  49. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/docs/advanced_usage/seeds.md +0 -0
  50. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/docs/architecture/architecture.md +0 -0
  51. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/docs/getting_started/getting_started.md +0 -0
  52. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/docs/index.md +0 -0
  53. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/docs/integrations/luma.md +0 -0
  54. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/docs/overrides/main.html +0 -0
  55. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/docs/reference/glossary.md +0 -0
  56. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/docs/reference/introduction.md +0 -0
  57. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/docs/reference/reference.md +0 -0
  58. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/docs/reference/security.md +0 -0
  59. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/docs/reference/supported_dbs.md +0 -0
  60. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/docs/tutorials/creating_a_nesso_models_project.ipynb +0 -0
  61. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/docs/tutorials/nesso_models.ipynb +0 -0
  62. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/docs/tutorials/nesso_project_user_onboarding.ipynb +0 -0
  63. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/docs/user_guide/base_models.md +0 -0
  64. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/docs/user_guide/dbt_adapters_nesso_features.md +0 -0
  65. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/docs/user_guide/introduction.md +0 -0
  66. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/docs/user_guide/model_maintenance.md +0 -0
  67. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/docs/user_guide/models.md +0 -0
  68. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/docs/user_guide/sources.md +0 -0
  69. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/docs/user_guide/workflows.md +0 -0
  70. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/docs/workflows/data_analyst.md +0 -0
  71. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/docs/workflows/data_engineer.md +0 -0
  72. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/examples/nesso_models/.gitignore +0 -0
  73. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/examples/nesso_models/.nesso/config.yml +0 -0
  74. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/examples/nesso_models/README.md +0 -0
  75. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/examples/nesso_models/dbt_project.yml +0 -0
  76. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/examples/nesso_models/install.sh +0 -0
  77. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/examples/nesso_models/models/sources/staging/staging.yml +0 -0
  78. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/examples/nesso_models/packages.yml +0 -0
  79. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/examples/nesso_models/profiles.yml +0 -0
  80. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/examples/nesso_models/requirements.txt +0 -0
  81. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/mkdocs.yml +0 -0
  82. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/src/nesso_cli/__init__.py +0 -0
  83. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/src/nesso_cli/jobs/.gitkeep +0 -0
  84. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/src/nesso_cli/jobs/main.py +0 -0
  85. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/src/nesso_cli/models/__init__.py +0 -0
  86. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/src/nesso_cli/models/base_model.py +0 -0
  87. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/src/nesso_cli/models/config.py +0 -0
  88. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/src/nesso_cli/models/context.py +0 -0
  89. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/src/nesso_cli/models/main.py +0 -0
  90. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/src/nesso_cli/models/metadata.py +0 -0
  91. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/src/nesso_cli/models/model.py +0 -0
  92. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/src/nesso_cli/models/nesso_macros/dbt_project.yml +0 -0
  93. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/src/nesso_cli/models/nesso_macros/macros/codegen_helpers.sql +0 -0
  94. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/src/nesso_cli/models/nesso_macros/macros/create_description_markdown.sql +0 -0
  95. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/src/nesso_cli/models/nesso_macros/macros/dbt_profiler.sql +0 -0
  96. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/src/nesso_cli/models/nesso_macros/macros/generate_base_model.sql +0 -0
  97. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/src/nesso_cli/models/nesso_macros/macros/generate_model_yaml_boilerplate.sql +0 -0
  98. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/src/nesso_cli/models/nesso_macros/macros/generate_seed_yaml_boilerplate.sql +0 -0
  99. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/src/nesso_cli/models/nesso_macros/macros/generate_source_yaml_boilerplate.sql +0 -0
  100. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/src/nesso_cli/models/nesso_macros/macros/get_custom_schema.sql +0 -0
  101. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/src/nesso_cli/models/nesso_macros/macros/get_source_pii_columns.sql +0 -0
  102. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/src/nesso_cli/models/nesso_macros/macros/get_table_columns.sql +0 -0
  103. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/src/nesso_cli/models/nesso_macros/macros/hash_column.sql +0 -0
  104. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/src/nesso_cli/models/nesso_macros/macros/hash_source_pii_columns.sql +0 -0
  105. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/src/nesso_cli/models/nesso_macros/macros/redshift_external_tables_fix.sql +0 -0
  106. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/src/nesso_cli/models/seed.py +0 -0
  107. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/src/nesso_cli/models/templates/.gitignore +0 -0
  108. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/src/nesso_cli/models/templates/.vscode/extensions.list +0 -0
  109. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/src/nesso_cli/models/templates/.vscode/install_extensions.sh +0 -0
  110. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/src/nesso_cli/models/templates/.vscode/settings.json +0 -0
  111. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/src/nesso_cli/models/templates/CONTRIBUTING.md +0 -0
  112. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/src/nesso_cli/models/templates/README.md +0 -0
  113. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/src/nesso_cli/models/templates/config.yml.j2 +0 -0
  114. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/src/nesso_cli/models/templates/dbt_project.yml.j2 +0 -0
  115. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/src/nesso_cli/models/templates/packages.yml.j2 +0 -0
  116. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/src/nesso_cli/models/templates/prepare.sh +0 -0
  117. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/src/nesso_cli/models/templates/requirements.txt +0 -0
  118. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/src/nesso_cli/models/templates/{{ bronze_schema }}.yml.j2 +0 -0
  119. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/src/nesso_cli/models/tests/dbt_projects/duckdb/.nesso/config.yml +0 -0
  120. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/src/nesso_cli/models/tests/dbt_projects/duckdb/dbt_project.yml +0 -0
  121. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/src/nesso_cli/models/tests/dbt_projects/duckdb/macros/test_macros.sql +0 -0
  122. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/src/nesso_cli/models/tests/dbt_projects/duckdb/package-lock.yml +0 -0
  123. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/src/nesso_cli/models/tests/dbt_projects/duckdb/packages.yml +0 -0
  124. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/src/nesso_cli/models/tests/dbt_projects/duckdb/profiles.yml +0 -0
  125. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/src/nesso_cli/models/tests/dbt_projects/duckdb/seeds/average salary test.xlsx +0 -0
  126. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/src/nesso_cli/models/tests/dbt_projects/duckdb/seeds/countries_example.csv +0 -0
  127. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/src/nesso_cli/models/tests/dbt_projects/postgres/.nesso/config.yml +0 -0
  128. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/src/nesso_cli/models/tests/dbt_projects/postgres/dbt_project.yml +0 -0
  129. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/src/nesso_cli/models/tests/dbt_projects/postgres/packages.yml +0 -0
  130. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/src/nesso_cli/models/tests/dbt_projects/postgres/profiles.yml +0 -0
  131. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/src/nesso_cli/models/tests/dbt_projects/postgres/seeds/average salary test.xlsx +0 -0
  132. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/src/nesso_cli/models/tests/dbt_projects/postgres/seeds/countries_example.csv +0 -0
  133. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/src/nesso_cli/models/tests/dbt_projects/trino/dbt_project.yml +0 -0
  134. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/src/nesso_cli/models/tests/dbt_projects/trino/packages.yml +0 -0
  135. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/src/nesso_cli/models/tests/dbt_projects/trino/profiles.yml +0 -0
  136. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/src/nesso_cli/models/tests/pytest.ini +0 -0
  137. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/src/nesso_cli/models/tests/test_model.py +1 -1
  138. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/src/nesso_cli/models/update.py +0 -0
  139. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/src/nesso_cli/nesso_cli.py +0 -0
  140. {nesso_cli-0.12.0 → nesso_cli-0.13.0}/src/nesso_cli/py.typed +0 -0
@@ -16,10 +16,15 @@ jobs:
16
16
  steps:
17
17
  - uses: actions/checkout@v4
18
18
  - uses: fregante/setup-git-user@v2
19
- - name: Set up Python ${{ matrix.python-version }}
20
- uses: actions/setup-python@v5
19
+ - name: Install uv
20
+ uses: astral-sh/setup-uv@v7
21
21
  with:
22
- python-version: ${{ matrix.python-version }}
22
+ version: "0.8.22"
23
+ activate-environment: true
24
+ enable-cache: true
25
+
26
+ - name: Install Python dependencies
27
+ run: uv sync --group test
23
28
 
24
29
  # - name: Generate a token
25
30
  # id: generate_token
@@ -28,13 +33,6 @@ jobs:
28
33
  # app-id: 403853
29
34
  # private-key: ${{ secrets.LUDOVICO_BOT_PRIVATE_KEY }}
30
35
 
31
- - name: Install dependencies
32
- run: |
33
- python -m pip install --upgrade pip
34
- pip install .[test]
35
- # Ensure the availability of the Typer version with built-in CLI (added in v0.12.0).
36
- pip install typer==0.12.3
37
-
38
36
  - name: Set up git environment
39
37
  run: git checkout -b build_action_branch
40
38
 
@@ -169,9 +169,9 @@
169
169
  "filename": "src/nesso_cli/models/tests/test_init.py",
170
170
  "hashed_secret": "9fb7fe1217aed442b04c0f5e43b5d5a7d3287097",
171
171
  "is_verified": false,
172
- "line_number": 261
172
+ "line_number": 263
173
173
  }
174
174
  ]
175
175
  },
176
- "generated_at": "2026-01-14T16:12:34Z"
176
+ "generated_at": "2026-01-16T17:40:29Z"
177
177
  }
@@ -1,13 +1,13 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: nesso_cli
3
- Version: 0.12.0
3
+ Version: 0.13.0
4
4
  Summary: A CLI tool for managing data models.
5
5
  Author-email: Michał Zawadzki <mzawadzki@dyvenia.com>
6
6
  Keywords: cli,data,dbt,dyvenia,models,nesso
7
7
  Requires-Python: >=3.10
8
8
  Requires-Dist: dbt-core-interface>=1.1.5
9
9
  Requires-Dist: loguru>=0.7.2
10
- Requires-Dist: pydantic<2,>=1.10.11
10
+ Requires-Dist: pydantic<3,>=2.0
11
11
  Requires-Dist: python-dotenv>=1.0.0
12
12
  Requires-Dist: ruamel-yaml==0.18.9
13
13
  Requires-Dist: typer>=0.9.0
@@ -44,8 +44,8 @@ contacts = []
44
44
  accounts = []
45
45
 
46
46
  for i in range(1, test_tables_nrows + 1):
47
- contacts.append(Contact(Id=i).dict(by_alias=True))
48
- accounts.append(Account(id=i).dict(by_alias=True))
47
+ contacts.append(Contact(Id=i).model_dump(by_alias=True))
48
+ accounts.append(Account(id=i).model_dump(by_alias=True))
49
49
 
50
50
  contacts_df = pd.DataFrame(contacts)
51
51
  accounts_df = pd.DataFrame(accounts)
@@ -44,8 +44,8 @@ contacts = []
44
44
  accounts = []
45
45
 
46
46
  for i in range(1, test_tables_nrows + 1):
47
- contacts.append(Contact(Id=i).dict(by_alias=True))
48
- accounts.append(Account(id=i).dict(by_alias=True))
47
+ contacts.append(Contact(Id=i).model_dump(by_alias=True))
48
+ accounts.append(Account(id=i).model_dump(by_alias=True))
49
49
 
50
50
  contacts_df = pd.DataFrame(contacts)
51
51
  accounts_df = pd.DataFrame(accounts)
@@ -2,7 +2,7 @@
2
2
  name = "nesso_cli"
3
3
  description = "A CLI tool for managing data models."
4
4
  readme = "README.md"
5
- version = "0.12.0"
5
+ version = "0.13.0"
6
6
  authors = [{ name = "Michał Zawadzki", email = "mzawadzki@dyvenia.com" }]
7
7
  classifiers = []
8
8
  keywords = ["cli", "dbt", "dyvenia", "data", "nesso", "models"]
@@ -11,7 +11,7 @@ dependencies = [
11
11
  "loguru>=0.7.2",
12
12
  "python-dotenv>=1.0.0",
13
13
  "ruamel.yaml==0.18.9",
14
- "pydantic>=1.10.11,<2",
14
+ "pydantic>=2.0,<3",
15
15
  "typer>=0.9.0",
16
16
  # Below fork of the dbt-core-interface is vendored till https://github.com/z3z1ma/dbt-core-interface/pull/117 is merged.
17
17
  # "dbt-core-interface @ git+https://github.com/trymzet/dbt-core-interface",
@@ -42,10 +42,10 @@ test = [
42
42
  "coverage==7.3.2",
43
43
  "black==22.12.0",
44
44
  "mypy==1.7.0",
45
- "sqlalchemy==1.4.50",
45
+ "sqlalchemy>=2.0.46",
46
46
  "faker==20.1.0",
47
47
  "getkey==0.6.5",
48
- "pandas>=1.5.3,<2.0.0",
48
+ "pandas>=2.2.3",
49
49
  "mock==5.1.0",
50
50
  "genbadge[coverage]==1.1.0",
51
51
  "flake8==6.1.0",
@@ -89,6 +89,13 @@ options = SimpleNamespace(
89
89
  ),
90
90
  ],
91
91
  force=force,
92
+ source=Annotated[
93
+ str,
94
+ typer.Option(
95
+ "--source",
96
+ help="The name of the source (defined in source properties file in sources/).",
97
+ ),
98
+ ],
92
99
  )
93
100
 
94
101
 
@@ -133,7 +133,9 @@ def create_profiles_yml_template(
133
133
  path_trimmed = path.relative_to(path.parent.parent)
134
134
  rprint(f"File '{path_trimmed}' already exists. Overwriting...")
135
135
 
136
- model = NessoDBTConfig(database_type=database_type, project_name=project_name).dict( # type: ignore[attr-defined]
136
+ model = NessoDBTConfig(
137
+ database_type=database_type, project_name=project_name
138
+ ).model_dump( # type: ignore[attr-defined]
137
139
  by_alias=True
138
140
  )
139
141
  profile_name = next(iter(model.keys()))
@@ -20,15 +20,24 @@ class BaseNessoModel(BaseModel):
20
20
  Excluding Nones is required as dbt >= 1.5 doesn't accept None in the
21
21
  `data_tests` field.
22
22
  """
23
- return self.dict(exclude_none=True, by_alias=True)
23
+ return self.model_dump(exclude_none=True, by_alias=True)
24
24
 
25
25
 
26
26
  class ColumnMeta(BaseNessoModel):
27
+ """Metadata for a column in a DBT source or model.
28
+
29
+ Data tests can be of the form:
30
+ - A simple string representing a test name, e.g., "not_null"
31
+ - A dictionary representing a test with arguments, e.g.,
32
+ {"dbt_utils.expression_is_true": {"arguments": {"expression": "LIKE '%@
33
+ %'"}}}
34
+ """
35
+
27
36
  name: str
28
37
  data_type: str
29
38
  description: str = ""
30
39
  quote: bool = True
31
- data_tests: list[str | dict[str, dict[str, Any]]] | None = None
40
+ data_tests: list[str | dict[str, dict[str, dict[str, Any]]]] | None = None
32
41
  tags: list[str] = Field(default_factory=list)
33
42
 
34
43
 
@@ -192,7 +201,7 @@ class ModelColumnsMetadata(BaseModel):
192
201
  data_type: str
193
202
  description: str | None
194
203
  quote: bool
195
- data_tests: list[str | dict[str, dict[str, Any]]] | None
204
+ data_tests: list[str | dict[str, dict[str, dict[str, Any]]]] | None = None
196
205
  tags: list[str]
197
206
 
198
207
 
@@ -290,7 +299,7 @@ class DBTProperties(dict):
290
299
  del column_metadata["name"]
291
300
  # Verifies if metadata types align with those specified in
292
301
  # ModelColumnsMetadata.
293
- ModelColumnsMetadata.validate(column_metadata)
302
+ ModelColumnsMetadata.model_validate(column_metadata)
294
303
  return column_metadata
295
304
 
296
305
  columns_dict_metadata = {}
@@ -306,8 +315,11 @@ class DBTProperties(dict):
306
315
  {column["name"]: column_metadata}
307
316
  )
308
317
 
309
- elif self.resource_type == DBTResourceType.MODEL.value:
310
- for column in content["columns"]:
318
+ elif (
319
+ self.resource_type == DBTResourceType.MODEL.value
320
+ and content.get("name") == table_name
321
+ ):
322
+ for column in content.get("columns", []):
311
323
  column_metadata = create_metadata_dict(column)
312
324
  # Creates a dictionary with column names and their metadata,
313
325
  # for example: {column_name: {metadata}}
@@ -403,7 +403,7 @@ Possible causes:
403
403
  overwrite model column fields.
404
404
 
405
405
  """
406
- for attribute in model_column.__fields__:
406
+ for attribute in type(model_column).model_fields:
407
407
  value = getattr(model_column, attribute)
408
408
  if attribute != "tests" and not value:
409
409
  setattr(model_column, attribute, getattr(upstream_column, attribute))
@@ -251,6 +251,7 @@ def add(
251
251
  table_name: Annotated[
252
252
  str, typer.Argument(help="The name of the table to add.", show_default=False)
253
253
  ],
254
+ source: options.source = config.bronze_schema,
254
255
  case_sensitive_cols: Annotated[
255
256
  bool | None,
256
257
  typer.Option(
@@ -281,7 +282,6 @@ def add(
281
282
  """Add a new table to a source schema and materializes it as a base model."""
282
283
  dbt_project_dir = Path(context.get("PROJECT_DIR"))
283
284
  project = project or dbt_project_dir.name
284
- source = config.bronze_schema
285
285
 
286
286
  base_dir = dbt_project_dir.joinpath("models", "sources", source)
287
287
 
@@ -362,6 +362,7 @@ def add(
362
362
  @app.command(context_settings=wrapper_context_settings)
363
363
  def freshness(
364
364
  ctx: typer.Context,
365
+ source: options.source = config.bronze_schema,
365
366
  select: Annotated[
366
367
  str | None, typer.Option("--select", "-s", help="The source(s) to select.")
367
368
  ] = None,
@@ -374,7 +375,7 @@ def freshness(
374
375
  if select:
375
376
  if "." not in select:
376
377
  # Table name has to be fully qualified.
377
- select = f"{config.bronze_schema}.{select}"
378
+ select = f"{source}.{select}"
378
379
  if "source:" not in select:
379
380
  select = f"source:{select}"
380
381
  args.extend(["-s", select])
@@ -398,6 +399,7 @@ def rm(
398
399
  table_name: Annotated[
399
400
  str, typer.Argument(help="The name of the table to add.", show_default=False)
400
401
  ],
402
+ source: options.source = config.bronze_schema,
401
403
  remove_base_model: Annotated[
402
404
  bool | None,
403
405
  typer.Option(
@@ -410,7 +412,6 @@ def rm(
410
412
  ) -> bool:
411
413
  """Remove a source table from the schema YAML."""
412
414
  dbt_project_dir = Path(context.get("PROJECT_DIR"))
413
- source = config.bronze_schema
414
415
  base_dir = dbt_project_dir.joinpath("models", "sources", source)
415
416
  schema_path = _get_default_schema_path(source)
416
417
 
@@ -1,16 +1,21 @@
1
1
  import copy
2
- import os
3
- import random
4
- import shutil
5
2
  from datetime import datetime
6
- from pytz import utc as UTC
7
3
  from functools import cached_property
4
+ import os
8
5
  from pathlib import Path
9
- from nesso_cli.models.common import execute_sql
10
- import pandas as pd
11
- import pytest
6
+ import random
7
+ import shutil
8
+
12
9
  from dotenv import load_dotenv
13
10
  from faker import Faker
11
+ import pandas as pd
12
+ from pydantic import BaseModel, Field
13
+ import pytest
14
+ from pytz import utc as UTC
15
+ from sqlalchemy import create_engine
16
+ from sqlalchemy.pool import NullPool
17
+
18
+ from nesso_cli.models.common import execute_sql
14
19
  from nesso_cli.models.config import config, yaml
15
20
  from nesso_cli.models.models import (
16
21
  ColumnMeta,
@@ -29,9 +34,6 @@ from nesso_cli.models.tests.test_init import (
29
34
  TEST_TEMPLATE_FILE_TEMPLATED_FILENAME,
30
35
  )
31
36
  from nesso_cli.models.tests.test_seed import SEED_SCHEMA_PATH
32
- from pydantic import BaseModel, Field
33
- from sqlalchemy import create_engine
34
- from sqlalchemy.pool import NullPool
35
37
 
36
38
 
37
39
  load_dotenv()
@@ -87,7 +89,7 @@ def TEST_SOURCE():
87
89
  yield config.bronze_schema
88
90
 
89
91
 
90
- @pytest.fixture(scope="function")
92
+ @pytest.fixture
91
93
  def SOURCE_SCHEMA_PATH(TEST_SOURCE):
92
94
  schema_file_name = TEST_SOURCE + ".yml"
93
95
  schema_path = PROJECT_DIR / "models" / "sources" / TEST_SOURCE / schema_file_name
@@ -151,7 +153,7 @@ class TestData:
151
153
  name="email",
152
154
  data_type="CHARACTER VARYING(256)",
153
155
  description="description_email",
154
- data_tests=["unique", "not_null", {"dbt_utils.expression_is_true": {"expression": "LIKE '%@%'"}}],
156
+ data_tests=["unique", "not_null", {"dbt_utils.expression_is_true": {"arguments": {"expression": "LIKE '%@%'"}}}],
155
157
  tags=SAMPLE_TAG,
156
158
  ),
157
159
  ColumnMeta(
@@ -586,7 +588,7 @@ def create_contacts_table(request, TEST_SOURCE, TEST_TABLE_CONTACT):
586
588
  class Contact(BaseModel):
587
589
  Id: int = Field(default_factory=lambda: i)
588
590
  AccountId: str = Field(
589
- default_factory=lambda: random.randint(1, test_tables_nrows)
591
+ default_factory=lambda: str(random.randint(1, test_tables_nrows))
590
592
  )
591
593
  FirstName: str = Field(default_factory=fake.first_name)
592
594
  LastName: str = Field(default_factory=fake.last_name)
@@ -599,12 +601,10 @@ def create_contacts_table(request, TEST_SOURCE, TEST_TABLE_CONTACT):
599
601
  )
600
602
  contacts = []
601
603
  for i in range(1, test_tables_nrows + 1):
602
- contacts.append(Contact(Id=i).dict(by_alias=True))
604
+ contacts.append(Contact(Id=i).model_dump(by_alias=True))
603
605
  contacts_df_pandas = pd.DataFrame(contacts)
604
606
 
605
607
  fqn = f"{TEST_SOURCE}.{TEST_TABLE_CONTACT}"
606
- db_path = PROJECT_DIR / "test.duckdb"
607
- engine = create_engine(f"duckdb:///{db_path}", poolclass=NullPool)
608
608
 
609
609
  # Make sure the table does not exist.
610
610
  execute_sql(f"DROP TABLE IF EXISTS {fqn} CASCADE", commit=True, target=env)
@@ -612,14 +612,18 @@ def create_contacts_table(request, TEST_SOURCE, TEST_TABLE_CONTACT):
612
612
  # Make sure the schema exists.
613
613
  execute_sql(f"CREATE SCHEMA IF NOT EXISTS {TEST_SOURCE}", commit=True, target=env)
614
614
 
615
+
615
616
  # Create the table.
616
- contacts_df_pandas.to_sql(
617
- TEST_TABLE_CONTACT,
618
- engine,
619
- schema=TEST_SOURCE,
620
- if_exists="replace",
621
- index=False,
622
- )
617
+ db_path = PROJECT_DIR / "test.duckdb"
618
+ engine = create_engine(f"duckdb:///{db_path}", poolclass=NullPool)
619
+ with engine.connect() as connection:
620
+ contacts_df_pandas.to_sql(
621
+ TEST_TABLE_CONTACT,
622
+ connection,
623
+ schema=TEST_SOURCE,
624
+ if_exists="replace",
625
+ index=False,
626
+ )
623
627
 
624
628
  engine.dispose()
625
629
 
@@ -646,12 +650,10 @@ def create_accounts_table(request, TEST_SOURCE, TEST_TABLE_ACCOUNT):
646
650
  )
647
651
  accounts = []
648
652
  for i in range(1, test_tables_nrows + 1):
649
- accounts.append(Account(id=i).dict(by_alias=True))
653
+ accounts.append(Account(id=i).model_dump(by_alias=True))
650
654
  accounts_df_pandas = pd.DataFrame(accounts)
651
655
 
652
656
  fqn = f"{TEST_SOURCE}.{TEST_TABLE_ACCOUNT}"
653
- db_path = PROJECT_DIR / "test.duckdb"
654
- engine = create_engine(f"duckdb:///{db_path}", poolclass=NullPool)
655
657
 
656
658
  # Make sure the table does not exist.
657
659
  execute_sql(f"DROP TABLE IF EXISTS {fqn} CASCADE", commit=True, target=env)
@@ -660,12 +662,15 @@ def create_accounts_table(request, TEST_SOURCE, TEST_TABLE_ACCOUNT):
660
662
  execute_sql(f"CREATE SCHEMA IF NOT EXISTS {TEST_SOURCE}", commit=True, target=env)
661
663
 
662
664
  # Create the table.
663
- accounts_df_pandas.to_sql(
664
- TEST_TABLE_ACCOUNT,
665
- engine,
666
- schema=TEST_SOURCE,
667
- if_exists="replace",
668
- index=False,
665
+ db_path = PROJECT_DIR / "test.duckdb"
666
+ engine = create_engine(f"duckdb:///{db_path}", poolclass=NullPool)
667
+ with engine.connect() as connection:
668
+ accounts_df_pandas.to_sql(
669
+ TEST_TABLE_ACCOUNT,
670
+ connection,
671
+ schema=TEST_SOURCE,
672
+ if_exists="replace",
673
+ index=False,
669
674
  )
670
675
 
671
676
  engine.dispose()
@@ -1,51 +1,68 @@
1
- import shutil
1
+ import json
2
2
  from pathlib import Path
3
+ import shutil
3
4
  from unittest.mock import Mock
4
5
 
5
- import nesso_cli.models.context as context
6
6
  import pytest
7
- from nesso_cli.models.base_model import check_if_base_model_exists, bootstrap_yaml as base_model_bootstrap_yaml
7
+
8
+ from nesso_cli.models import context
9
+ from nesso_cli.models.base_model import (
10
+ bootstrap_yaml as base_model_bootstrap_yaml,
11
+ )
12
+ from nesso_cli.models.base_model import (
13
+ check_if_base_model_exists,
14
+ )
8
15
  from nesso_cli.models.common import call_shell, execute_sql
9
- from nesso_cli.models.config import config, yaml
16
+ from nesso_cli.models.config import config
10
17
  from nesso_cli.models.model import bootstrap_yaml as model_bootstrap_yaml
11
- from nesso_cli.models.seed import check_if_seed_exists, register as seed_register
12
- from nesso_cli.models.source import check_if_source_exists, check_if_source_table_exists, add as source_add
18
+ from nesso_cli.models.seed import check_if_seed_exists
19
+ from nesso_cli.models.seed import register as seed_register
20
+ from nesso_cli.models.source import (
21
+ add as source_add,
22
+ )
23
+ from nesso_cli.models.source import (
24
+ check_if_source_exists,
25
+ check_if_source_table_exists,
26
+ )
13
27
  from nesso_cli.models.tests.test_source import create_empty_source
14
28
 
29
+
15
30
  PROJECT_DIR = Path(__file__).parent.parent.joinpath("dbt_projects", "duckdb")
16
31
  context._set("PROJECT_DIR", PROJECT_DIR)
17
32
  TEST_SEED_COUNTRIES_NAME = "countries_example"
18
33
 
19
34
 
20
- @pytest.fixture(scope="function")
35
+ @pytest.fixture
21
36
  def create_seed(TEST_SCHEMA):
22
37
  # Create seed
23
- SEED_SCHEMA_PATH = PROJECT_DIR.joinpath("seeds", "schema.yml")
38
+ seed_schema_path = PROJECT_DIR.joinpath("seeds", "schema.yml")
24
39
 
25
40
  seed_register(
26
41
  seed=TEST_SEED_COUNTRIES_NAME,
27
- schema_path=SEED_SCHEMA_PATH,
42
+ schema_path=seed_schema_path,
28
43
  technical_owner="test_technical_owner",
29
44
  business_owner="test_business_owner",
30
45
  )
31
46
 
32
47
  # Check if the schema file was created.
33
- assert SEED_SCHEMA_PATH.exists()
48
+ assert seed_schema_path.exists()
34
49
 
35
50
  # Check if the seed was materialized.
36
51
  execute_sql(f"SELECT * FROM {TEST_SCHEMA}.{TEST_SEED_COUNTRIES_NAME}")
37
52
 
38
53
  # Check if the seed was added to the schema file.
39
- assert check_if_seed_exists(TEST_SEED_COUNTRIES_NAME, schema_path=SEED_SCHEMA_PATH)
54
+ assert check_if_seed_exists(TEST_SEED_COUNTRIES_NAME, schema_path=seed_schema_path)
40
55
 
41
56
  yield
42
57
 
43
58
  # Cleanup.
44
- SEED_SCHEMA_PATH.unlink()
45
- execute_sql(f"DROP TABLE IF EXISTS {TEST_SCHEMA}.{TEST_SEED_COUNTRIES_NAME};", commit=True)
59
+ seed_schema_path.unlink()
60
+ execute_sql(
61
+ f"DROP TABLE IF EXISTS {TEST_SCHEMA}.{TEST_SEED_COUNTRIES_NAME};", commit=True
62
+ )
46
63
 
47
64
 
48
- @pytest.fixture(scope="function")
65
+ @pytest.fixture
49
66
  def create_source(
50
67
  create_accounts_table,
51
68
  TEST_SOURCE,
@@ -83,7 +100,7 @@ def create_source(
83
100
  )
84
101
 
85
102
 
86
- @pytest.fixture(scope="function")
103
+ @pytest.fixture
87
104
  def create_base_model(
88
105
  TEST_SCHEMA,
89
106
  TEST_SOURCE,
@@ -95,7 +112,7 @@ def create_base_model(
95
112
  )
96
113
  base_model_file_sql = base_model_path / f"{TEST_TABLE_ACCOUNT_BASE_MODEL}.sql"
97
114
  base_model_path.mkdir(parents=True, exist_ok=True)
98
- with open(base_model_file_sql, "w") as f:
115
+ with Path(base_model_file_sql).open("w") as f:
99
116
  f.write(
100
117
  f"select * from {{{{ source('{TEST_SOURCE}', '{TEST_TABLE_ACCOUNT}') }}}}"
101
118
  )
@@ -116,11 +133,12 @@ def create_base_model(
116
133
  ignore_errors=False,
117
134
  )
118
135
  execute_sql(
119
- f"DROP VIEW IF EXISTS {TEST_SCHEMA}.{TEST_TABLE_ACCOUNT_BASE_MODEL} CASCADE", commit=True
136
+ f"DROP VIEW IF EXISTS {TEST_SCHEMA}.{TEST_TABLE_ACCOUNT_BASE_MODEL} CASCADE",
137
+ commit=True,
120
138
  )
121
139
 
122
140
 
123
- @pytest.fixture(scope="function")
141
+ @pytest.fixture
124
142
  def create_model(
125
143
  create_source,
126
144
  create_base_model,
@@ -128,7 +146,7 @@ def create_model(
128
146
  TEST_TABLE_ACCOUNT_BASE_MODEL,
129
147
  ):
130
148
  # Create model SQL.
131
- MODEL_PATH = PROJECT_DIR.joinpath(
149
+ model_path = PROJECT_DIR.joinpath(
132
150
  "models",
133
151
  config.gold_layer_name,
134
152
  "test_mart",
@@ -136,9 +154,9 @@ def create_model(
136
154
  TEST_TABLE_ACCOUNT,
137
155
  TEST_TABLE_ACCOUNT + ".sql",
138
156
  )
139
- MODEL_PATH.parent.mkdir(parents=True, exist_ok=True)
157
+ model_path.parent.mkdir(parents=True, exist_ok=True)
140
158
 
141
- with open(MODEL_PATH, "w") as f:
159
+ with Path(model_path).open("w") as f:
142
160
  f.write(f"""SELECT * FROM {{{{ ref("{TEST_TABLE_ACCOUNT_BASE_MODEL}") }}}}""")
143
161
 
144
162
  # Bootstrap YAML for the model.
@@ -157,10 +175,9 @@ def create_model(
157
175
  )
158
176
 
159
177
 
160
- @pytest.fixture(scope="function")
178
+ @pytest.fixture
161
179
  def create_manifest() -> None:
162
180
  """Run dbt commands in a specific order to generate the manifest.json file."""
163
-
164
181
  manifest_path = PROJECT_DIR.joinpath("target", "manifest.json")
165
182
  manifest_path.unlink(missing_ok=True)
166
183
 
@@ -204,15 +221,16 @@ def test_manifest(
204
221
  TEST_TABLE_ACCOUNT,
205
222
  TEST_TABLE_ACCOUNT_BASE_MODEL,
206
223
  ):
207
- """
208
- This test has 3 stages:
224
+ """Verify that the manifest.json file contains the expected metadata.
225
+
226
+ The test has 3 stages:
209
227
  1. Create resources of each type (seed, source, base model, model).
210
228
  2. Run dbt commands in a specific order to generate the manifest.json file.
211
229
  3. Inspect that the results for each resource match expectations.
212
230
  """
213
231
 
214
- with open(PROJECT_DIR.joinpath("target", "manifest.json")) as f:
215
- manifest = yaml.load(f)
232
+ with Path(PROJECT_DIR.joinpath("target", "manifest.json")).open() as f:
233
+ manifest = json.load(f)
216
234
 
217
235
  # Tests.
218
236
  # Seed.
@@ -1,18 +1,26 @@
1
1
  import copy
2
2
  from pathlib import Path
3
3
  import shutil
4
+ from unittest.mock import Mock
4
5
 
5
6
  from conftest import TestData
6
7
  import pytest
7
8
  from typer.testing import CliRunner
8
- from unittest.mock import Mock
9
9
 
10
10
  from nesso_cli.models import context
11
- from nesso_cli.models.base_model import check_if_base_model_exists, bootstrap, bootstrap_yaml
12
- from nesso_cli.models.common import check_if_relation_exists, get_current_dbt_project_obj
11
+ from nesso_cli.models.base_model import (
12
+ bootstrap,
13
+ bootstrap_yaml,
14
+ check_if_base_model_exists,
15
+ )
16
+ from nesso_cli.models.common import (
17
+ check_if_relation_exists,
18
+ execute_sql,
19
+ get_current_dbt_project_obj,
20
+ )
13
21
  from nesso_cli.models.config import config, yaml
14
22
  from nesso_cli.models.main import app
15
- from nesso_cli.models.common import execute_sql
23
+
16
24
 
17
25
  PROJECT_DIR = Path(__file__).parent.joinpath("dbt_projects", "duckdb")
18
26
  context._set("PROJECT_DIR", PROJECT_DIR)
@@ -1,11 +1,11 @@
1
1
  import os
2
- import shutil
3
2
  from pathlib import Path
3
+ import shutil
4
4
 
5
5
  import agate
6
- import nesso_cli.models.context as context
7
- import pytest
8
6
  from conftest import TestData, test_tables_nrows
7
+ import pytest
8
+
9
9
  from nesso_cli.models.common import (
10
10
  call_shell,
11
11
  check_if_relation_exists,
@@ -25,13 +25,15 @@ from nesso_cli.models.common import (
25
25
  run_in_dbt_project,
26
26
  )
27
27
  from nesso_cli.models.config import config, yaml
28
+ import nesso_cli.models.context as context
29
+
28
30
 
29
31
  PROJECT_NAME = "duckdb"
30
32
  PROJECT_DIR = Path(__file__).parent.joinpath("dbt_projects", "duckdb")
31
33
  context._set("PROJECT_DIR", PROJECT_DIR)
32
34
 
33
35
 
34
- @pytest.fixture(scope="function")
36
+ @pytest.fixture
35
37
  def FAKE_DBT_PROFILES_DIR():
36
38
  profiles_dir = "/tmp/fake_project"
37
39
 
@@ -43,7 +45,7 @@ def FAKE_DBT_PROFILES_DIR():
43
45
  shutil.rmtree(profiles_dir, ignore_errors=True)
44
46
 
45
47
 
46
- @pytest.fixture(scope="function")
48
+ @pytest.fixture
47
49
  def FAKE_DBT_PROFILES_PATH(FAKE_DBT_PROFILES_DIR):
48
50
  profiles_dir = FAKE_DBT_PROFILES_DIR.joinpath("profiles.yml")
49
51
  profiles_dir.unlink(missing_ok=True)
@@ -1,4 +1,5 @@
1
1
  import pytest
2
+
2
3
  from nesso_cli.models.config import config
3
4
 
4
5