Closed patygold closed 8 months ago
@patygold I realized that the pydantic-v1 branch was a bit outdated. Would you mind double-checking whether it works on the latest version?
In the meanwhile we improved the dbt support and you would need to set the path to your project yaml file
SQLMockConfig.set_dbt_project_path('/path/to/your/dbt_project.yml')
Let me know whether this works with the latest update :)
@Somtom Unfortunately, it is still not working.
I've re-installed the package with the newest version, changed the SQLMockConfig
to set dbt project path as specified, and also changed all the mocked models to inherit from BigQueryTableMock
(in the old version it was BigQueryMockTable
).
The problem now seems to lie with the SQLMockConfig:
parkdepot/repository_parkdepot_tests/dbt/staging/postgres/mocked_stg_postgres__car_owner.py:7: in <module>
class StgPostgresCarOwner(BigQueryTableMock):
parkdepot/.venv/lib/python3.9/site-packages/sql_mock/dbt.py:114: in decorator
dbt_meta = _get_model_metadata(project_path=path, model_name=model_name)
parkdepot/.venv/lib/python3.9/site-packages/sql_mock/dbt.py:45: in _get_model_metadata
"query_path": os.path.join(project_dir, node["compiled_path"]),
/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/posixpath.py:90: in join
genericpath._check_arg_types('join', a, *p)
/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/genericpath.py:152: in _check_arg_types
raise TypeError(f'{funcname}() argument must be str, bytes, or '
E TypeError: join() argument must be str, bytes, or os.PathLike object, not 'NoneType'
At the moment, my config looks like this:
SQLMockConfig.set_dbt_project_path("/Users/patricia.goldberg/Documents/ParkDepot/dagster/parkdepot/dbt/parkdepot/dbt_project.yml")
Adding the full path of the file, just to test it.
And this is indeed the correct path of this file in my local machine:
(.venv) patricia.goldberg@parkdepot:ls /Users/patricia.goldberg/Documents/ParkDepot/dagster/parkdepot/dbt/parkdepot | grep dbt_project.yml
dbt_project.yml
(.venv) patricia.goldberg@parkdepot:
As discussed, the last error was solved by compiling the whole dbt project again. This issue was solved then! Thank you!
I'm using V1 of pydantic, thus I've installed the package using this branch: https://github.com/DeepLcom/sql-mock/tree/pydantic-v1/docs
Added the config in my conftest.py:
SQLMockConfig.set_dbt_manifest_path("../dbt/parkdepot/target/manifest.json")
Created two mocks: 1- A source:2- A model:
And then when testing the model, like this:
I get the error while importing the tests:
Versions: