Repository: dbt-labs/dbt-core

Issue:
Flip flag for `require_resource_names_without_spaces`



Discussion:

Patch:
diff --git a/.changes/unreleased/Breaking Changes-20250520-131830.yaml b/.changes/unreleased/Breaking Changes-20250520-131830.yaml
new file mode 100644
index 00000000000..6f23b05e688
--- /dev/null
+++ b/.changes/unreleased/Breaking Changes-20250520-131830.yaml
@@ -0,0 +1,6 @@
+kind: Breaking Changes
+body: Flip behavior flag to disallow spaces in resource names
+time: 2025-05-20T13:18:30.352998-05:00
+custom:
+  Author: QMalcolm
+  Issue: "11610"
diff --git a/core/dbt/contracts/project.py b/core/dbt/contracts/project.py
index a3c5f36d928..c54636e1462 100644
--- a/core/dbt/contracts/project.py
+++ b/core/dbt/contracts/project.py
@@ -351,7 +351,7 @@ class ProjectFlags(ExtensibleDbtClassMixin):
     # legacy behaviors - https://github.com/dbt-labs/dbt-core/blob/main/docs/guides/behavior-change-flags.md
     require_batched_execution_for_custom_microbatch_strategy: bool = False
     require_explicit_package_overrides_for_builtin_materializations: bool = True
-    require_resource_names_without_spaces: bool = False
+    require_resource_names_without_spaces: bool = True
     source_freshness_run_project_hooks: bool = True
     skip_nodes_if_on_run_start_fails: bool = False
     state_modified_compare_more_unrendered_values: bool = False


Test patch:
diff --git a/tests/functional/manifest_validations/test_check_for_spaces_in_model_names.py b/tests/functional/manifest_validations/test_check_for_spaces_in_model_names.py
index 543a4557eea..a1bf01bc77c 100644
--- a/tests/functional/manifest_validations/test_check_for_spaces_in_model_names.py
+++ b/tests/functional/manifest_validations/test_check_for_spaces_in_model_names.py
@@ -29,6 +29,8 @@ def models(self) -> Dict[str, str]:
         }
 
     def tests_warning_when_spaces_in_name(self, project) -> None:
+        config_patch = {"flags": {"require_resource_names_without_spaces": False}}
+        update_config_file(config_patch, project.project_root, "dbt_project.yml")
         event_catcher = EventCatcher(SpacesInResourceNameDeprecation)
         total_catcher = EventCatcher(ResourceNamesWithSpacesDeprecation)
         runner = dbtRunner(callbacks=[event_catcher.catch, total_catcher.catch])
@@ -50,6 +52,8 @@ def models(self) -> Dict[str, str]:
         }
 
     def tests_debug_when_spaces_in_name(self, project) -> None:
+        config_patch = {"flags": {"require_resource_names_without_spaces": False}}
+        update_config_file(config_patch, project.project_root, "dbt_project.yml")
         deprecations.reset_deprecations()
         spaces_check_catcher = EventCatcher(SpacesInResourceNameDeprecation)
         total_catcher = EventCatcher(ResourceNamesWithSpacesDeprecation)
@@ -83,6 +87,8 @@ def models(self) -> Dict[str, str]:
         }
 
     def test_require_resource_names_without_spaces(self, project):
+        config_patch = {"flags": {"require_resource_names_without_spaces": False}}
+        update_config_file(config_patch, project.project_root, "dbt_project.yml")
         spaces_check_catcher = EventCatcher(SpacesInResourceNameDeprecation)
         runner = dbtRunner(callbacks=[spaces_check_catcher.catch])
         runner.invoke(["parse"])