Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

merge main into feature/decouple-adapters-from-core #9305

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
2474722
moving types_pb2.py to common/events
colin-rogers-dbt Oct 25, 2023
07743b7
merge
colin-rogers-dbt Oct 25, 2023
252e3e3
Merge branch 'feature/decouple-adapters-from-core' of https://github.…
colin-rogers-dbt Oct 26, 2023
ff9d519
Merge branch 'feature/decouple-adapters-from-core' of https://github.…
colin-rogers-dbt Nov 2, 2023
bf079b1
Merge branch 'feature/decouple-adapters-from-core' of https://github.…
colin-rogers-dbt Nov 28, 2023
3187ded
Merge branch 'feature/decouple-adapters-from-core' of https://github.…
colin-rogers-dbt Nov 28, 2023
4da67bf
Merge branch 'feature/decouple-adapters-from-core' of https://github.…
colin-rogers-dbt Dec 5, 2023
c03823f
Merge branch 'feature/decouple-adapters-from-core' of https://github.…
colin-rogers-dbt Dec 6, 2023
2811ccd
Merge branch 'feature/decouple-adapters-from-core' of https://github.…
colin-rogers-dbt Dec 7, 2023
e88138a
Merge branch 'feature/decouple-adapters-from-core' of https://github.…
colin-rogers-dbt Dec 7, 2023
1740df5
Update parser to support conversion metrics (#9173)
WilliamDee Dec 7, 2023
977a842
Merge branch 'feature/decouple-adapters-from-core' of https://github.…
colin-rogers-dbt Dec 7, 2023
6e0a387
Remove `--dry-run` flag from `dbt deps` (#9169)
jtcohen6 Dec 11, 2023
c2bc2f0
adding clean_up methods to basic and unique_id tests (#9195)
McKnight-42 Dec 12, 2023
3ddfcdd
Merge branch 'feature/decouple-adapters-from-core' of https://github.…
colin-rogers-dbt Dec 12, 2023
082b0c6
Merge branch 'feature/decouple-adapters-from-core' of https://github.…
colin-rogers-dbt Dec 14, 2023
611981f
Merge branch 'feature/decouple-adapters-from-core' of https://github.…
colin-rogers-dbt Dec 14, 2023
3665fb1
Merge branch 'feature/decouple-adapters-from-core' of https://github.…
colin-rogers-dbt Dec 14, 2023
24690b0
Merge branch 'feature/decouple-adapters-from-core' of https://github.…
colin-rogers-dbt Dec 18, 2023
5dbee88
Merge branch 'feature/decouple-adapters-from-core' of https://github.…
colin-rogers-dbt Dec 18, 2023
a005c9b
merge main
colin-rogers-dbt Dec 19, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .changes/unreleased/Breaking Changes-20231129-091921.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
kind: Breaking Changes
body: Rm --dry-run flag from 'dbt deps --add-package', in favor of just 'dbt deps
--lock'
time: 2023-11-29T09:19:21.071212+01:00
custom:
Author: jtcohen6
Issue: "9100"
7 changes: 0 additions & 7 deletions core/dbt/cli/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,6 @@ def debug(ctx, **kwargs):
@p.target
@p.vars
@p.source
@p.dry_run
@p.lock
@p.upgrade
@p.add_package
Expand All @@ -483,12 +482,6 @@ def deps(ctx, **kwargs):
message=f"Version is required in --add-package when a package when source is {flags.SOURCE}",
option_name="--add-package",
)
else:
if flags.DRY_RUN:
raise BadOptionUsage(
message="Invalid flag `--dry-run` when not using `--add-package`.",
option_name="--dry-run",
)
task = DepsTask(flags, ctx.obj["project"])
results = task.run()
success = task.interpret_results(results)
Expand Down
7 changes: 0 additions & 7 deletions core/dbt/cli/params.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,13 +83,6 @@
hidden=True,
)

dry_run = click.option(
"--dry-run",
envvar=None,
help="Option to run `dbt deps --add-package` without updating package-lock.yml file.",
is_flag=True,
)

empty = click.option(
"--empty/--no-empty",
envvar="DBT_EMPTY",
Expand Down
5 changes: 3 additions & 2 deletions core/dbt/task/deps.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,8 +221,9 @@ def run(self) -> None:
if previous_hash != current_hash:
self.lock()

# Early return when dry run or lock only.
if self.args.dry_run or self.args.lock:
# Early return when 'dbt deps --lock'
# Just resolve packages and write lock file, don't actually install packages
if self.args.lock:
return

if system.path_exists(self.project.packages_install_path):
Expand Down
11 changes: 11 additions & 0 deletions tests/adapter/dbt/tests/adapter/basic/test_adapter_methods.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,17 @@ def project_config_update(self):
"name": "adapter_methods",
}

@pytest.fixture(autouse=True)
def clean_up(self, project):
yield
with project.adapter.connection_named("__test"):
relation = project.adapter.Relation.create(
database=project.database, schema=project.test_schema
)
project.adapter.drop_schema(relation)

pass

# snowflake need all tables in CAP name
@pytest.fixture(scope="class")
def equal_tables(self):
Expand Down
11 changes: 11 additions & 0 deletions tests/adapter/dbt/tests/adapter/basic/test_base.py
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,17 @@ def project_config_update(self):
"name": "base",
}

@pytest.fixture(autouse=True)
def clean_up(self, project):
yield
with project.adapter.connection_named("__test"):
relation = project.adapter.Relation.create(
database=project.database, schema=project.test_schema
)
project.adapter.drop_schema(relation)

pass

def test_base(self, project):

# seed command
Expand Down
12 changes: 12 additions & 0 deletions tests/adapter/dbt/tests/adapter/basic/test_docs_generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -428,6 +428,18 @@ def expected_catalog(self, project, profile_user):
model_stats=no_stats(),
)

@pytest.fixture(autouse=True)
def clean_up(self, project):
yield
with project.adapter.connection_named("__test"):
alternate_schema = f"{project.test_schema}_test"
relation = project.adapter.Relation.create(
database=project.database, schema=alternate_schema
)
project.adapter.drop_schema(relation)

pass

# Test "--no-compile" flag works and produces no manifest.json
def test_run_and_generate_no_compile(self, project, expected_catalog):
start_time = run_and_generate(project, ["--no-compile"])
Expand Down
11 changes: 11 additions & 0 deletions tests/adapter/dbt/tests/adapter/basic/test_generic_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,17 @@ def models(self):
"schema_table.yml": generic_test_table_yml,
}

@pytest.fixture(autouse=True)
def clean_up(self, project):
yield
with project.adapter.connection_named("__test"):
relation = project.adapter.Relation.create(
database=project.database, schema=project.test_schema
)
project.adapter.drop_schema(relation)

pass

def test_generic_tests(self, project):
# seed command
results = run_dbt(["seed"])
Expand Down
11 changes: 11 additions & 0 deletions tests/adapter/dbt/tests/adapter/basic/test_incremental.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,17 @@ def models(self):
def seeds(self):
return {"base.csv": seeds_base_csv, "added.csv": seeds_added_csv}

@pytest.fixture(autouse=True)
def clean_up(self, project):
yield
with project.adapter.connection_named("__test"):
relation = project.adapter.Relation.create(
database=project.database, schema=project.test_schema
)
project.adapter.drop_schema(relation)

pass

def test_incremental(self, project):
# seed command
results = run_dbt(["seed"])
Expand Down
11 changes: 11 additions & 0 deletions tests/adapter/dbt/tests/adapter/basic/test_singular_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,17 @@ def tests(self):
def project_config_update(self):
return {"name": "singular_tests"}

@pytest.fixture(autouse=True)
def clean_up(self, project):
yield
with project.adapter.connection_named("__test"):
relation = project.adapter.Relation.create(
database=project.database, schema=project.test_schema
)
project.adapter.drop_schema(relation)

pass

def test_singular_tests(self, project):
# test command
results = run_dbt(["test"], expect_pass=False)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,17 @@ def project_config_update(self):
"name": "singular_tests_ephemeral",
}

@pytest.fixture(autouse=True)
def clean_up(self, project):
yield
with project.adapter.connection_named("__test"):
relation = project.adapter.Relation.create(
database=project.database, schema=project.test_schema
)
project.adapter.drop_schema(relation)

pass

def test_singular_tests_ephemeral(self, project):
# check results from seed command
results = run_dbt(["seed"])
Expand Down
11 changes: 11 additions & 0 deletions tests/adapter/dbt/tests/adapter/basic/test_snapshot_check_cols.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,17 @@ def snapshots(self):
"cc_name_snapshot.sql": cc_name_snapshot_sql,
}

@pytest.fixture(autouse=True)
def clean_up(self, project):
yield
with project.adapter.connection_named("__test"):
relation = project.adapter.Relation.create(
database=project.database, schema=project.test_schema
)
project.adapter.drop_schema(relation)

pass

def test_snapshot_check_cols(self, project):
# seed command
results = run_dbt(["seed"])
Expand Down
11 changes: 11 additions & 0 deletions tests/adapter/dbt/tests/adapter/basic/test_snapshot_timestamp.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,17 @@ def snapshots(self):
def project_config_update(self):
return {"name": "snapshot_strategy_timestamp"}

@pytest.fixture(autouse=True)
def clean_up(self, project):
yield
with project.adapter.connection_named("__test"):
relation = project.adapter.Relation.create(
database=project.database, schema=project.test_schema
)
project.adapter.drop_schema(relation)

pass

def test_snapshot_timestamp(self, project):
# seed command
results = run_dbt(["seed"])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,6 +344,17 @@ def seeds(self):
"add_new_rows.sql": seeds__add_new_rows_sql,
}

@pytest.fixture(autouse=True)
def clean_up(self, project):
yield
with project.adapter.connection_named("__test"):
relation = project.adapter.Relation.create(
database=project.database, schema=project.test_schema
)
project.adapter.drop_schema(relation)

pass

def update_incremental_model(self, incremental_model):
"""update incremental model after the seed table has been updated"""
model_result_set = run_dbt(["run", "--select", incremental_model])
Expand Down
2 changes: 1 addition & 1 deletion tests/functional/artifacts/data/state/v12/manifest.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -412,7 +412,7 @@ def test_compare_state_current(self, project):
current_manifest_schema_version == self.CURRENT_EXPECTED_MANIFEST_VERSION
), "Sounds like you've bumped the manifest version and need to update this test!"
# If we need a newly generated manifest, uncomment the following line and commit the result
self.generate_latest_manifest(project, current_manifest_schema_version)
# self.generate_latest_manifest(project, current_manifest_schema_version)
self.compare_previous_state(project, current_manifest_schema_version, True, 0)

def test_backwards_compatible_versions(self, project):
Expand Down
4 changes: 2 additions & 2 deletions tests/functional/dependencies/test_dependency_options.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,14 @@ def test_deps_add(self, clean_start):
)
assert len(os.listdir("dbt_packages")) == 3

def test_deps_add_dry_run(self, clean_start):
def test_deps_add_without_install(self, clean_start):
os.rename("packages.yml", "dependencies.yml")
run_dbt(
[
"deps",
"--add-package",
"dbt-labs/[email protected]",
"--dry-run",
"--lock",
]
)
assert not os.path.exists("dbt_packages")
Expand Down
Loading