-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Run the test examples as docs by creating a dbt_project in the docs to run the test for and directly referencing example macros in the docs.
- Loading branch information
1 parent
f784c08
commit e82122d
Showing
12 changed files
with
73 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -132,3 +132,7 @@ dmypy.json | |
|
||
# Version | ||
src/pytest_dbt_core/_version.py | ||
|
||
# dbt | ||
.user.yml | ||
dbt_packages/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
name: dbt_project | ||
profile: dbt_project | ||
version: '0.3.0' | ||
config-version: 2 | ||
require-dbt-version: [">=1.0.0", "<2.0.0"] | ||
macro-paths: ["macros"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
packages: | ||
- package: dbt-labs/spark_utils | ||
version: 0.3.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
dbt_project: | ||
target: test | ||
outputs: | ||
test: | ||
type: spark | ||
method: session | ||
schema: test | ||
host: NA # not used, but required by `dbt-core` |
16 changes: 16 additions & 0 deletions
16
docs/source/_static/dbt_project/tests/test_spark_get_tables.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import pytest | ||
from dbt.clients.jinja import MacroGenerator | ||
from pyspark.sql import SparkSession | ||
|
||
|
||
@pytest.mark.parametrize( | ||
"macro_generator", ["macro.spark_utils.get_tables"], indirect=True | ||
) | ||
def test_get_tables( | ||
spark_session: SparkSession, macro_generator: MacroGenerator | ||
) -> None: | ||
"""The get tables macro should return the created table.""" | ||
expected_table = "default.example" | ||
spark_session.sql(f"CREATE TABLE {expected_table} (id int) USING parquet") | ||
tables = macro_generator() | ||
assert tables == [expected_table] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters