Repository: dbt-labs/dbt-core

Issue:
docs settings for analyses folder not working in 0.20.+
### Describe the bug
dbt docs generate in version 0.20.0+ does not take into account any schema.yml config for the analyses folder.

When updating from 0.19.2 to 0.20.0+, the analyses descriptions were no longer showing up in generated docs when run dbt docs generate. No code changes were made, just the environment was changed to use 0.20.0 rather than 0.19.2
A clear and concise description of what the bug is. What command did you run? What happened?

### Steps To Reproduce
1. create an analysis
2. describe the analysis in a schema.yml file as per this documentation: https://docs.getdbt.com/reference/analysis-properties/ 
3. ensure your environment is set to 0.19.2
4. run dbt docs generate
5. observe the description in the documentation
6. modify the environment to be set to 0.20.0 or 0.20.1
7. run dbt docs generate
8. observe that there is no longer description in the documentation for the analysis

### Expected behavior
Analysis documentation behaviour is adhered to when moving from 0.19.2 to 0.20.+
### Screenshots and log output
Link to loom of the issue: https://www.loom.com/share/88ed5de8f75d4bb7a98c0ae167d4b5d3 

### System information
**Which database are you using dbt with?**
- [ ] postgres
- [ ] redshift
- [x ] bigquery
- [ ] snowflake
- [ ] other (specify: ____________)


**The output of `dbt --version`:**
```
0.19.2 and 0.20.0 depending (bug is in version 0.20.0)
```

**The operating system you're using:**
n/a (using cloud)
**The output of `python --version`:**
(using cloud n/a)
### Additional context
Add any other context about the problem here.



Discussion:
@saraleon1 Thank you for the detailed report! I think this is a genuine regression in v0.20.

@leahwicz Would it be possible to get someone to take a look at this? If the fix is straightforward, I'd love to sneak it into v0.20.2.

Here's the really simple reproduction case I just used locally:

```sql
-- analysis/my_analysis.sql
select 1 as fun
```
```yml
# analysis/schema.yml
version: 2

analyses:
  - name: my_analysis
    description: "This is my analysis"
```

In v0.20, the analysis node is missing its `description`. In v0.19, the `description` is present.

Except from `manifest.json` produced by `dbt docs generate`, using dbt v0.20.1:
```json
"analysis.testy.my_analysis": {
    "raw_sql": "select 1 as fun",
    "compiled": true,
    "resource_type": "analysis",
    "depends_on": {
        "macros": [],
        "nodes": []
    },
    "config": {
        "enabled": true,
        "materialized": "view",
        "persist_docs": {},
        "vars": {},
        "quoting": {},
        "column_types": {},
        "alias": null,
        "schema": null,
        "database": null,
        "tags": [],
        "full_refresh": null,
        "post-hook": [],
        "pre-hook": []
    },
    "database": "jerco",
    "schema": "dbt_jcohen",
    "fqn": [
        "testy",
        "analysis",
        "my_analysis"
    ],
    "unique_id": "analysis.testy.my_analysis",
    "package_name": "testy",
    "root_path": "/Users/jerco/dev/scratch/testy",
    "path": "analysis/my_analysis.sql",
    "original_file_path": "analysis/my_analysis.sql",
    "name": "my_analysis",
    "alias": "my_analysis",
    "checksum": {
        "name": "sha256",
        "checksum": "9d978b5c99a9c4d94be28f61552de2c1e9bfb9319b04b77d7cfc67944b0acf50"
    },
    "tags": [],
    "refs": [],
    "sources": [],
    "description": "",
    "columns": {},
    "meta": {},
    "docs": {
        "show": true
    },
    "patch_path": null,
    "compiled_path": "target/compiled/testy/analysis/my_analysis.sql",
    "build_path": null,
    "deferred": false,
    "unrendered_config": {},
    "created_at": 1629225666,
    "compiled_sql": "select 1 as fun",
    "extra_ctes_injected": true,
    "extra_ctes": [],
    "relation_name": null
}
```
Except from `manifest.json` produced by dbt v0.19.2:
```json
"analysis.testy.my_analysis": {
    "raw_sql": "select 1 as fun",
    "compiled": true,
    "resource_type": "analysis",
    "depends_on": {
        "macros": [],
        "nodes": []
    },
    "config": {
        "enabled": true,
        "materialized": "view",
        "persist_docs": {},
        "vars": {},
        "quoting": {},
        "column_types": {},
        "alias": null,
        "schema": null,
        "database": null,
        "tags": [],
        "full_refresh": null,
        "post-hook": [],
        "pre-hook": []
    },
    "database": "jerco",
    "schema": "dbt_jcohen",
    "fqn": [
        "testy",
        "analysis",
        "my_analysis"
    ],
    "unique_id": "analysis.testy.my_analysis",
    "package_name": "testy",
    "root_path": "/Users/jerco/dev/scratch/testy",
    "path": "analysis/my_analysis.sql",
    "original_file_path": "analysis/my_analysis.sql",
    "name": "my_analysis",
    "alias": "my_analysis",
    "checksum": {
        "name": "sha256",
        "checksum": "9d978b5c99a9c4d94be28f61552de2c1e9bfb9319b04b77d7cfc67944b0acf50"
    },
    "tags": [],
    "refs": [],
    "sources": [],
    "description": "This is my analysis",
    "columns": {},
    "meta": {},
    "docs": {
        "show": true
    },
    "patch_path": "analysis/schema.yml",
    "build_path": "target/compiled/testy/analysis/my_analysis.sql",
    "deferred": false,
    "unrendered_config": {},
    "compiled_sql": "select 1 as fun",
    "extra_ctes_injected": true,
    "extra_ctes": [],
    "relation_name": null
}
```
This was not directly due to partial parsing. We switched to looking up unique_ids and applying patches immediately instead of saving them for later, and there was a bug in the analysis unique_id lookup. 2 character fix + test case.

Resolving patch:
diff --git a/core/dbt/contracts/graph/manifest.py b/core/dbt/contracts/graph/manifest.py
--- a/core/dbt/contracts/graph/manifest.py
+++ b/core/dbt/contracts/graph/manifest.py
@@ -170,7 +170,7 @@ def perform_lookup(
 
 
 class AnalysisLookup(RefableLookup):
-    _lookup_types: ClassVar[set] = set(NodeType.Analysis)
+    _lookup_types: ClassVar[set] = set([NodeType.Analysis])
 
 
 def _search_packages(


Test patch:
diff --git a/test/integration/019_analysis_tests/analysis/schema.yml b/test/integration/019_analysis_tests/analysis/schema.yml
new file mode 100644
--- /dev/null
+++ b/test/integration/019_analysis_tests/analysis/schema.yml
@@ -0,0 +1,5 @@
+version: 2
+
+analyses:
+  - name: analysis
+    description: "This is my analysis"
diff --git a/test/integration/019_analysis_tests/test_analyses.py b/test/integration/019_analysis_tests/test_analyses.py
--- a/test/integration/019_analysis_tests/test_analyses.py
+++ b/test/integration/019_analysis_tests/test_analyses.py
@@ -1,4 +1,4 @@
-from test.integration.base import DBTIntegrationTest, use_profile
+from test.integration.base import DBTIntegrationTest, use_profile, get_manifest
 import os
 
 
@@ -36,6 +36,11 @@ def test_postgres_analyses(self):
         self.assertFalse(os.path.exists(compiled_analysis_path))
         results = self.run_dbt(["compile"])
         self.assertEqual(len(results), 3)
+        manifest = get_manifest()
+        analysis_id = 'analysis.test.analysis'
+        self.assertIn(analysis_id, manifest.nodes)
+        node = manifest.nodes[analysis_id]
+        self.assertEqual(node.description, 'This is my analysis')
 
         self.assertTrue(os.path.exists(path_1))
         self.assertTrue(os.path.exists(path_2))