Repository: dbt-labs/dbt-core

Issue:
Make relation Filtering None-tolerant for maximal flexibility
resolves #8974

### Problem

Spark needs flexibility to have None/null value for the database identifier.

### Solution

We now explicitly allow that.

### Checklist

- [x] I have read [the contributing guide](https://github.com/dbt-labs/dbt-core/blob/main/CONTRIBUTING.md) and understand what's expected of me  
- [x] I have run this code in development and it appears to resolve the stated issue  
- [x] This PR includes tests, or tests are not required/relevant for this PR
- [x] This PR has no interface changes (e.g. macros, cli, logs, json artifacts, config files, adapter interface, etc) or this PR has already received feedback and approval from Product or DX
- [x] This PR includes [type annotations](https://docs.python.org/3/library/typing.html) for new and modified functions



Discussion:
## [Codecov](https://app.codecov.io/gh/dbt-labs/dbt-core/pull/8975?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dbt-labs) Report
All modified and coverable lines are covered by tests :white_check_mark:
> Comparison is base [(`bb21403`)](https://app.codecov.io/gh/dbt-labs/dbt-core/commit/bb21403c9e906097c4913edcf7a013d404e93d80?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dbt-labs) 86.46% compared to head [(`baf83a2`)](https://app.codecov.io/gh/dbt-labs/dbt-core/pull/8975?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dbt-labs) 86.51%.

<details><summary>Additional details and impacted files</summary>


```diff
@@            Coverage Diff             @@
##             main    #8975      +/-   ##
==========================================
+ Coverage   86.46%   86.51%   +0.05%     
==========================================
  Files         179      179              
  Lines       26505    26508       +3     
==========================================
+ Hits        22917    22933      +16     
+ Misses       3588     3575      -13     
```

| [Flag](https://app.codecov.io/gh/dbt-labs/dbt-core/pull/8975/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dbt-labs) | Coverage Δ | |
|---|---|---|
| [integration](https://app.codecov.io/gh/dbt-labs/dbt-core/pull/8975/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dbt-labs) | `83.40% <100.00%> (+0.12%)` | :arrow_up: |
| [unit](https://app.codecov.io/gh/dbt-labs/dbt-core/pull/8975/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dbt-labs) | `64.81% <100.00%> (+<0.01%)` | :arrow_up: |

Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dbt-labs#carryforward-flags-in-the-pull-request-comment) to find out more.

| [Files](https://app.codecov.io/gh/dbt-labs/dbt-core/pull/8975?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dbt-labs) | Coverage Δ | |
|---|---|---|
| [core/dbt/adapters/base/impl.py](https://app.codecov.io/gh/dbt-labs/dbt-core/pull/8975?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dbt-labs#diff-Y29yZS9kYnQvYWRhcHRlcnMvYmFzZS9pbXBsLnB5) | `82.93% <100.00%> (+0.07%)` | :arrow_up: |

... and [3 files with indirect coverage changes](https://app.codecov.io/gh/dbt-labs/dbt-core/pull/8975/indirect-changes?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dbt-labs)


</details>

[:umbrella: View full report in Codecov by Sentry](https://app.codecov.io/gh/dbt-labs/dbt-core/pull/8975?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dbt-labs).   
:loudspeaker: Have feedback on the report? [Share it here](https://about.codecov.io/codecov-pr-comment-feedback/?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=dbt-labs).


Resolving patch:
diff --git a/core/dbt/adapters/base/impl.py b/core/dbt/adapters/base/impl.py
--- a/core/dbt/adapters/base/impl.py
+++ b/core/dbt/adapters/base/impl.py
@@ -1179,9 +1179,12 @@ def get_filtered_catalog(
             }
 
             def in_map(row: agate.Row):
-                d = _expect_row_value("table_database", row).casefold()
-                s = _expect_row_value("table_schema", row).casefold()
-                i = _expect_row_value("table_name", row).casefold()
+                d = _expect_row_value("table_database", row)
+                s = _expect_row_value("table_schema", row)
+                i = _expect_row_value("table_name", row)
+                d = d.casefold() if d is not None else None
+                s = s.casefold() if s is not None else None
+                i = i.casefold() if i is not None else None
                 return (d, s, i) in relation_map
 
             catalogs = catalogs.where(in_map)


Test patch: