Currently it is not straight forward to use SQLMock with dbt. This PR should solve that by adding dbt support
What changed
Introduced new decorator classes:
dbt Model Support: The introduction of a dbt_model_meta decorator allows SQLMock to directly interface with dbt models. This decorator links SQLMock mock tables to specific dbt models, enabling the testing of dbt-generated SQL queries within the SQLMock framework.
@dbt_model_meta(model_name="your_dbt_model_name")
class YourDBTModelTable(BigQueryMockTable):
# Define your table columns and other necessary attributes here
dbt Source Integration: A dbt_source_meta decorator was added to handle dbt sources. This is crucial for mocking raw data sources that are used in dbt projects, facilitating the testing of dbt transformations from these sources.
@dbt_source_meta(source_name="your_source_name", table_name="your_source_table")
class YourDBTSourceTable(BigQueryMockTable):
# Define your table columns and other necessary attributes here
dbt Seed Handling: The addition of a dbt_seed_meta decorator enables SQLMock to integrate with dbt seed files. Seeds in dbt are static data sets, and this functionality allows for their representation and manipulation within SQLMock.
@dbt_seed_meta(seed_name="your_dbt_seed_name")
class YourDBTSeedTable(BigQueryMockTable):
# Define your table columns and other necessary attributes here
Introduced a SQLMockConfig class that can be used to globally set the path to the dbt manifest file, e.g.:
Problem Context
Relates to https://github.com/DeepLcom/sql-mock/issues/7
Currently it is not straight forward to use SQLMock with dbt. This PR should solve that by adding dbt support
What changed
Introduced new decorator classes:
dbt Model Support: The introduction of a
dbt_model_meta
decorator allows SQLMock to directly interface with dbt models. This decorator links SQLMock mock tables to specific dbt models, enabling the testing of dbt-generated SQL queries within the SQLMock framework.dbt Source Integration: A
dbt_source_meta
decorator was added to handle dbt sources. This is crucial for mocking raw data sources that are used in dbt projects, facilitating the testing of dbt transformations from these sources.dbt Seed Handling: The addition of a
dbt_seed_meta
decorator enables SQLMock to integrate with dbt seed files. Seeds in dbt are static data sets, and this functionality allows for their representation and manipulation within SQLMock.Introduced a
SQLMockConfig
class that can be used to globally set the path to the dbt manifest file, e.g.:What to look for
Make sure to take a close look at: