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

skips non resolvable fields from appearing in sample secrets.toml #1432

Merged
merged 1 commit into from
Jun 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 4 additions & 3 deletions dlt/cli/config_toml_writer.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,15 @@
from tomlkit.container import Container as TOMLContainer
from collections.abc import Sequence as C_Sequence

from dlt.common.configuration.specs.base_configuration import is_hint_not_resolved
from dlt.common.pendulum import pendulum
from dlt.common.configuration.specs import (
BaseConfiguration,
is_base_configuration_inner_hint,
extract_inner_hint,
)
from dlt.common.data_types import py_type_to_sc_type
from dlt.common.typing import AnyType, is_final_type, is_optional_type
from dlt.common.typing import AnyType, is_optional_type


class WritableConfigValue(NamedTuple):
Expand Down Expand Up @@ -62,9 +63,9 @@ def write_value(
# skip if table contains the name already
if name in toml_table and not overwrite_existing:
return
# do not dump final and optional fields if they are not of special interest
# do not dump nor resolvable and optional fields if they are not of special interest
if (
is_final_type(hint) or is_optional_type(hint) or default_value is not None
is_hint_not_resolved(hint) or is_optional_type(hint) or default_value is not None
) and not is_default_of_interest:
return
# get the inner hint to generate cool examples
Expand Down
8 changes: 7 additions & 1 deletion tests/cli/test_init_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -572,7 +572,13 @@ def assert_common_files(
# destination is there
assert secrets.get_value(destination_name, type, None, "destination") is not None
# certain values are never there
for not_there in ["destination_name", "default_schema_name", "as_staging", "staging_config"]:
for not_there in [
"destination_name",
"default_schema_name",
"as_staging",
"staging_config",
"dataset_name",
]:
assert secrets.get_value(not_there, type, None, "destination", destination_name)[0] is None

return visitor, secrets
Loading