We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
DBT 0.17.0rc3 - Compilation failure regression
### Describe the bug

When trying to compile a project having some schema tests using `dbt_utils.equality` the compilation fails because the model does not exists.
However calling DBT run works.

The compilation failure happens when using DBT 0.17.0rc3, however compiling the same project using DBT 0.16.1 succeeds.

### Steps To Reproduce

The following ZIP file includes a dummy project to reproduce the issue.
[dummy.zip](https://github.com/fishtown-analytics/dbt/files/4705434/dummy.zip)

You will need to configure a profile for it though.

Extract the project and run:
```
dbt deps
dbt compile
```


### Expected behavior

The compilation succeeds on both DBT 0.16.1 and 0.17.0rc3

### Actual behavior

The compilation succeeds for DBT 0.16.1 and fails for 0.17.0rc3 with the following error:

```
Encountered an error:
Runtime Error
  Database Error in test dbt_utils_equality_my_second_dbt_model_id__ref_my_first_dbt_model_ (models/example/schema.yml)
    002003 (42S02): SQL compilation error:
    Table 'DB.SCHEMA.MY_SECOND_DBT_MODEL' does not exist or not authorized.
```

### System information
**Which database are you using dbt with?**
- [ ] postgres
- [ ] redshift
- [ ] bigquery
- [x] snowflake
- [ ] other (specify: ____________)


**The output of `dbt --version`:**
```
dbt --version
installed version: 0.17.0-rc3
   latest version: 0.16.1

Your version of dbt is ahead of the latest release!

Plugins:
  - snowflake: 0.17.0rc3
  - postgres: 0.17.0rc3
  - redshift: 0.17.0rc3
  - bigquery: 0.17.0rc3
```

**The operating system you're using:**  Linux Mint 19.3


**The output of `python --version`:** Python 3.6.9

--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `plugins/snowflake/dbt/adapters/snowflake/impl.py`
Content:
```
1 from dataclasses import dataclass
2 from typing import Mapping, Any, Optional, List, Union
3 
4 import agate
5 
6 from dbt.adapters.base.impl import AdapterConfig
7 from dbt.adapters.sql import SQLAdapter
8 from dbt.adapters.sql.impl import (
9     LIST_SCHEMAS_MACRO_NAME,
10     LIST_RELATIONS_MACRO_NAME,
11 )
12 from dbt.adapters.snowflake import SnowflakeConnectionManager
13 from dbt.adapters.snowflake import SnowflakeRelation
14 from dbt.adapters.snowflake import SnowflakeColumn
15 from dbt.contracts.graph.manifest import Manifest
16 from dbt.exceptions import RuntimeException, DatabaseException
17 from dbt.utils import filter_null_values
18 
19 
20 @dataclass
21 class SnowflakeConfig(AdapterConfig):
22     transient: Optional[bool] = None
23     cluster_by: Optional[Union[str, List[str]]] = None
24     automatic_clustering: Optional[bool] = None
25     secure: Optional[bool] = None
26     copy_grants: Optional[bool] = None
27     snowflake_warehouse: Optional[str] = None
28 
29 
30 class SnowflakeAdapter(SQLAdapter):
31     Relation = SnowflakeRelation
32     Column = SnowflakeColumn
33     ConnectionManager = SnowflakeConnectionManager
34 
35     AdapterSpecificConfigs = SnowflakeConfig
36 
37     @classmethod
38     def date_function(cls):
39         return "CURRENT_TIMESTAMP()"
40 
41     @classmethod
42     def _catalog_filter_table(
43         cls, table: agate.Table, manifest: Manifest
44     ) -> agate.Table:
45         # On snowflake, users can set QUOTED_IDENTIFIERS_IGNORE_CASE, so force
46         # the column names to their lowercased forms.
47         lowered = table.rename(
48             column_names=[c.lower() for c in table.column_names]
49         )
50         return super()._catalog_filter_table(lowered, manifest)
51 
52     def _make_match_kwargs(self, database, schema, identifier):
53         quoting = self.config.quoting
54         if identifier is not None and quoting["identifier"] is False:
55             identifier = identifier.upper()
56 
57         if schema is not None and quoting["schema"] is False:
58             schema = schema.upper()
59 
60         if database is not None and quoting["database"] is False:
61             database = database.upper()
62 
63         return filter_null_values(
64             {"identifier": identifier, "schema": schema, "database": database}
65         )
66 
67     def _get_warehouse(self) -> str:
68         _, table = self.execute(
69             'select current_warehouse() as warehouse',
70             fetch=True
71         )
72         if len(table) == 0 or len(table[0]) == 0:
73             # can this happen?
74             raise RuntimeException(
75                 'Could not get current warehouse: no results'
76             )
77         return str(table[0][0])
78 
79     def _use_warehouse(self, warehouse: str):
80         """Use the given warehouse. Quotes are never applied."""
81         self.execute('use warehouse {}'.format(warehouse))
82 
83     def pre_model_hook(self, config: Mapping[str, Any]) -> Optional[str]:
84         default_warehouse = self.config.credentials.warehouse
85         warehouse = config.get('snowflake_warehouse', default_warehouse)
86         if warehouse == default_warehouse or warehouse is None:
87             return None
88         previous = self._get_warehouse()
89         self._use_warehouse(warehouse)
90         return previous
91 
92     def post_model_hook(
93         self, config: Mapping[str, Any], context: Optional[str]
94     ) -> None:
95         if context is not None:
96             self._use_warehouse(context)
97 
98     def list_schemas(self, database: str) -> List[str]:
99         try:
100             results = self.execute_macro(
101                 LIST_SCHEMAS_MACRO_NAME,
102                 kwargs={'database': database}
103             )
104         except DatabaseException as exc:
105             msg = (
106                 f'Database error while listing schemas in database '
107                 f'"{database}"\n{exc}'
108             )
109             raise RuntimeException(msg)
110         # this uses 'show terse schemas in database', and the column name we
111         # want is 'name'
112 
113         return [row['name'] for row in results]
114 
115     def list_relations_without_caching(
116             self, schema_relation: SnowflakeRelation
117     ) -> List[SnowflakeRelation]:
118         kwargs = {'schema_relation': schema_relation}
119         try:
120             results = self.execute_macro(
121                 LIST_RELATIONS_MACRO_NAME,
122                 kwargs=kwargs
123             )
124         except DatabaseException as exc:
125             # if the schema doesn't exist, we just want to return.
126             # Alternatively, we could query the list of schemas before we start
127             # and skip listing the missing ones, which sounds expensive.
128             if 'Object does not exist' in str(exc):
129                 return []
130             raise
131 
132         relations = []
133         quote_policy = {
134             'database': True,
135             'schema': True,
136             'identifier': True
137         }
138 
139         columns = ['database_name', 'schema_name', 'name', 'kind']
140         for _database, _schema, _identifier, _type in results.select(columns):
141             try:
142                 _type = self.Relation.get_relation_type(_type.lower())
143             except ValueError:
144                 _type = self.Relation.External
145             relations.append(self.Relation.create(
146                 database=_database,
147                 schema=_schema,
148                 identifier=_identifier,
149                 quote_policy=quote_policy,
150                 type=_type
151             ))
152 
153         return relations
154
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/plugins/snowflake/dbt/adapters/snowflake/impl.py b/plugins/snowflake/dbt/adapters/snowflake/impl.py
--- a/plugins/snowflake/dbt/adapters/snowflake/impl.py
+++ b/plugins/snowflake/dbt/adapters/snowflake/impl.py
@@ -112,6 +112,15 @@
 
         return [row['name'] for row in results]
 
+    def get_columns_in_relation(self, relation):
+        try:
+            return super().get_columns_in_relation(relation)
+        except DatabaseException as exc:
+            if 'does not exist or not authorized' in str(exc):
+                return []
+            else:
+                raise
+
     def list_relations_without_caching(
             self, schema_relation: SnowflakeRelation
     ) -> List[SnowflakeRelation]:

{"golden_diff": "diff --git a/plugins/snowflake/dbt/adapters/snowflake/impl.py b/plugins/snowflake/dbt/adapters/snowflake/impl.py\n--- a/plugins/snowflake/dbt/adapters/snowflake/impl.py\n+++ b/plugins/snowflake/dbt/adapters/snowflake/impl.py\n@@ -112,6 +112,15 @@\n \n         return [row['name'] for row in results]\n \n+    def get_columns_in_relation(self, relation):\n+        try:\n+            return super().get_columns_in_relation(relation)\n+        except DatabaseException as exc:\n+            if 'does not exist or not authorized' in str(exc):\n+                return []\n+            else:\n+                raise\n+\n     def list_relations_without_caching(\n             self, schema_relation: SnowflakeRelation\n     ) -> List[SnowflakeRelation]:\n", "issue": "DBT 0.17.0rc3 - Compilation failure regression\n### Describe the bug\r\n\r\nWhen trying to compile a project having some schema tests using `dbt_utils.equality` the compilation fails because the model does not exists.\r\nHowever calling DBT run works.\r\n\r\nThe compilation failure happens when using DBT 0.17.0rc3, however compiling the same project using DBT 0.16.1 succeeds.\r\n\r\n### Steps To Reproduce\r\n\r\nThe following ZIP file includes a dummy project to reproduce the issue.\r\n[dummy.zip](https://github.com/fishtown-analytics/dbt/files/4705434/dummy.zip)\r\n\r\nYou will need to configure a profile for it though.\r\n\r\nExtract the project and run:\r\n```\r\ndbt deps\r\ndbt compile\r\n```\r\n\r\n\r\n### Expected behavior\r\n\r\nThe compilation succeeds on both DBT 0.16.1 and 0.17.0rc3\r\n\r\n### Actual behavior\r\n\r\nThe compilation succeeds for DBT 0.16.1 and fails for 0.17.0rc3 with the following error:\r\n\r\n```\r\nEncountered an error:\r\nRuntime Error\r\n  Database Error in test dbt_utils_equality_my_second_dbt_model_id__ref_my_first_dbt_model_ (models/example/schema.yml)\r\n    002003 (42S02): SQL compilation error:\r\n    Table 'DB.SCHEMA.MY_SECOND_DBT_MODEL' does not exist or not authorized.\r\n```\r\n\r\n### System information\r\n**Which database are you using dbt with?**\r\n- [ ] postgres\r\n- [ ] redshift\r\n- [ ] bigquery\r\n- [x] snowflake\r\n- [ ] other (specify: ____________)\r\n\r\n\r\n**The output of `dbt --version`:**\r\n```\r\ndbt --version\r\ninstalled version: 0.17.0-rc3\r\n   latest version: 0.16.1\r\n\r\nYour version of dbt is ahead of the latest release!\r\n\r\nPlugins:\r\n  - snowflake: 0.17.0rc3\r\n  - postgres: 0.17.0rc3\r\n  - redshift: 0.17.0rc3\r\n  - bigquery: 0.17.0rc3\r\n```\r\n\r\n**The operating system you're using:**  Linux Mint 19.3\r\n\r\n\r\n**The output of `python --version`:** Python 3.6.9\n", "before_files": [{"content": "from dataclasses import dataclass\nfrom typing import Mapping, Any, Optional, List, Union\n\nimport agate\n\nfrom dbt.adapters.base.impl import AdapterConfig\nfrom dbt.adapters.sql import SQLAdapter\nfrom dbt.adapters.sql.impl import (\n    LIST_SCHEMAS_MACRO_NAME,\n    LIST_RELATIONS_MACRO_NAME,\n)\nfrom dbt.adapters.snowflake import SnowflakeConnectionManager\nfrom dbt.adapters.snowflake import SnowflakeRelation\nfrom dbt.adapters.snowflake import SnowflakeColumn\nfrom dbt.contracts.graph.manifest import Manifest\nfrom dbt.exceptions import RuntimeException, DatabaseException\nfrom dbt.utils import filter_null_values\n\n\n@dataclass\nclass SnowflakeConfig(AdapterConfig):\n    transient: Optional[bool] = None\n    cluster_by: Optional[Union[str, List[str]]] = None\n    automatic_clustering: Optional[bool] = None\n    secure: Optional[bool] = None\n    copy_grants: Optional[bool] = None\n    snowflake_warehouse: Optional[str] = None\n\n\nclass SnowflakeAdapter(SQLAdapter):\n    Relation = SnowflakeRelation\n    Column = SnowflakeColumn\n    ConnectionManager = SnowflakeConnectionManager\n\n    AdapterSpecificConfigs = SnowflakeConfig\n\n    @classmethod\n    def date_function(cls):\n        return \"CURRENT_TIMESTAMP()\"\n\n    @classmethod\n    def _catalog_filter_table(\n        cls, table: agate.Table, manifest: Manifest\n    ) -> agate.Table:\n        # On snowflake, users can set QUOTED_IDENTIFIERS_IGNORE_CASE, so force\n        # the column names to their lowercased forms.\n        lowered = table.rename(\n            column_names=[c.lower() for c in table.column_names]\n        )\n        return super()._catalog_filter_table(lowered, manifest)\n\n    def _make_match_kwargs(self, database, schema, identifier):\n        quoting = self.config.quoting\n        if identifier is not None and quoting[\"identifier\"] is False:\n            identifier = identifier.upper()\n\n        if schema is not None and quoting[\"schema\"] is False:\n            schema = schema.upper()\n\n        if database is not None and quoting[\"database\"] is False:\n            database = database.upper()\n\n        return filter_null_values(\n            {\"identifier\": identifier, \"schema\": schema, \"database\": database}\n        )\n\n    def _get_warehouse(self) -> str:\n        _, table = self.execute(\n            'select current_warehouse() as warehouse',\n            fetch=True\n        )\n        if len(table) == 0 or len(table[0]) == 0:\n            # can this happen?\n            raise RuntimeException(\n                'Could not get current warehouse: no results'\n            )\n        return str(table[0][0])\n\n    def _use_warehouse(self, warehouse: str):\n        \"\"\"Use the given warehouse. Quotes are never applied.\"\"\"\n        self.execute('use warehouse {}'.format(warehouse))\n\n    def pre_model_hook(self, config: Mapping[str, Any]) -> Optional[str]:\n        default_warehouse = self.config.credentials.warehouse\n        warehouse = config.get('snowflake_warehouse', default_warehouse)\n        if warehouse == default_warehouse or warehouse is None:\n            return None\n        previous = self._get_warehouse()\n        self._use_warehouse(warehouse)\n        return previous\n\n    def post_model_hook(\n        self, config: Mapping[str, Any], context: Optional[str]\n    ) -> None:\n        if context is not None:\n            self._use_warehouse(context)\n\n    def list_schemas(self, database: str) -> List[str]:\n        try:\n            results = self.execute_macro(\n                LIST_SCHEMAS_MACRO_NAME,\n                kwargs={'database': database}\n            )\n        except DatabaseException as exc:\n            msg = (\n                f'Database error while listing schemas in database '\n                f'\"{database}\"\\n{exc}'\n            )\n            raise RuntimeException(msg)\n        # this uses 'show terse schemas in database', and the column name we\n        # want is 'name'\n\n        return [row['name'] for row in results]\n\n    def list_relations_without_caching(\n            self, schema_relation: SnowflakeRelation\n    ) -> List[SnowflakeRelation]:\n        kwargs = {'schema_relation': schema_relation}\n        try:\n            results = self.execute_macro(\n                LIST_RELATIONS_MACRO_NAME,\n                kwargs=kwargs\n            )\n        except DatabaseException as exc:\n            # if the schema doesn't exist, we just want to return.\n            # Alternatively, we could query the list of schemas before we start\n            # and skip listing the missing ones, which sounds expensive.\n            if 'Object does not exist' in str(exc):\n                return []\n            raise\n\n        relations = []\n        quote_policy = {\n            'database': True,\n            'schema': True,\n            'identifier': True\n        }\n\n        columns = ['database_name', 'schema_name', 'name', 'kind']\n        for _database, _schema, _identifier, _type in results.select(columns):\n            try:\n                _type = self.Relation.get_relation_type(_type.lower())\n            except ValueError:\n                _type = self.Relation.External\n            relations.append(self.Relation.create(\n                database=_database,\n                schema=_schema,\n                identifier=_identifier,\n                quote_policy=quote_policy,\n                type=_type\n            ))\n\n        return relations\n", "path": "plugins/snowflake/dbt/adapters/snowflake/impl.py"}], "after_files": [{"content": "from dataclasses import dataclass\nfrom typing import Mapping, Any, Optional, List, Union\n\nimport agate\n\nfrom dbt.adapters.base.impl import AdapterConfig\nfrom dbt.adapters.sql import SQLAdapter\nfrom dbt.adapters.sql.impl import (\n    LIST_SCHEMAS_MACRO_NAME,\n    LIST_RELATIONS_MACRO_NAME,\n)\nfrom dbt.adapters.snowflake import SnowflakeConnectionManager\nfrom dbt.adapters.snowflake import SnowflakeRelation\nfrom dbt.adapters.snowflake import SnowflakeColumn\nfrom dbt.contracts.graph.manifest import Manifest\nfrom dbt.exceptions import RuntimeException, DatabaseException\nfrom dbt.utils import filter_null_values\n\n\n@dataclass\nclass SnowflakeConfig(AdapterConfig):\n    transient: Optional[bool] = None\n    cluster_by: Optional[Union[str, List[str]]] = None\n    automatic_clustering: Optional[bool] = None\n    secure: Optional[bool] = None\n    copy_grants: Optional[bool] = None\n    snowflake_warehouse: Optional[str] = None\n\n\nclass SnowflakeAdapter(SQLAdapter):\n    Relation = SnowflakeRelation\n    Column = SnowflakeColumn\n    ConnectionManager = SnowflakeConnectionManager\n\n    AdapterSpecificConfigs = SnowflakeConfig\n\n    @classmethod\n    def date_function(cls):\n        return \"CURRENT_TIMESTAMP()\"\n\n    @classmethod\n    def _catalog_filter_table(\n        cls, table: agate.Table, manifest: Manifest\n    ) -> agate.Table:\n        # On snowflake, users can set QUOTED_IDENTIFIERS_IGNORE_CASE, so force\n        # the column names to their lowercased forms.\n        lowered = table.rename(\n            column_names=[c.lower() for c in table.column_names]\n        )\n        return super()._catalog_filter_table(lowered, manifest)\n\n    def _make_match_kwargs(self, database, schema, identifier):\n        quoting = self.config.quoting\n        if identifier is not None and quoting[\"identifier\"] is False:\n            identifier = identifier.upper()\n\n        if schema is not None and quoting[\"schema\"] is False:\n            schema = schema.upper()\n\n        if database is not None and quoting[\"database\"] is False:\n            database = database.upper()\n\n        return filter_null_values(\n            {\"identifier\": identifier, \"schema\": schema, \"database\": database}\n        )\n\n    def _get_warehouse(self) -> str:\n        _, table = self.execute(\n            'select current_warehouse() as warehouse',\n            fetch=True\n        )\n        if len(table) == 0 or len(table[0]) == 0:\n            # can this happen?\n            raise RuntimeException(\n                'Could not get current warehouse: no results'\n            )\n        return str(table[0][0])\n\n    def _use_warehouse(self, warehouse: str):\n        \"\"\"Use the given warehouse. Quotes are never applied.\"\"\"\n        self.execute('use warehouse {}'.format(warehouse))\n\n    def pre_model_hook(self, config: Mapping[str, Any]) -> Optional[str]:\n        default_warehouse = self.config.credentials.warehouse\n        warehouse = config.get('snowflake_warehouse', default_warehouse)\n        if warehouse == default_warehouse or warehouse is None:\n            return None\n        previous = self._get_warehouse()\n        self._use_warehouse(warehouse)\n        return previous\n\n    def post_model_hook(\n        self, config: Mapping[str, Any], context: Optional[str]\n    ) -> None:\n        if context is not None:\n            self._use_warehouse(context)\n\n    def list_schemas(self, database: str) -> List[str]:\n        try:\n            results = self.execute_macro(\n                LIST_SCHEMAS_MACRO_NAME,\n                kwargs={'database': database}\n            )\n        except DatabaseException as exc:\n            msg = (\n                f'Database error while listing schemas in database '\n                f'\"{database}\"\\n{exc}'\n            )\n            raise RuntimeException(msg)\n        # this uses 'show terse schemas in database', and the column name we\n        # want is 'name'\n\n        return [row['name'] for row in results]\n\n    def get_columns_in_relation(self, relation):\n        try:\n            return super().get_columns_in_relation(relation)\n        except DatabaseException as exc:\n            if 'does not exist or not authorized' in str(exc):\n                return []\n            else:\n                raise\n\n    def list_relations_without_caching(\n            self, schema_relation: SnowflakeRelation\n    ) -> List[SnowflakeRelation]:\n        kwargs = {'schema_relation': schema_relation}\n        try:\n            results = self.execute_macro(\n                LIST_RELATIONS_MACRO_NAME,\n                kwargs=kwargs\n            )\n        except DatabaseException as exc:\n            # if the schema doesn't exist, we just want to return.\n            # Alternatively, we could query the list of schemas before we start\n            # and skip listing the missing ones, which sounds expensive.\n            if 'Object does not exist' in str(exc):\n                return []\n            raise\n\n        relations = []\n        quote_policy = {\n            'database': True,\n            'schema': True,\n            'identifier': True\n        }\n\n        columns = ['database_name', 'schema_name', 'name', 'kind']\n        for _database, _schema, _identifier, _type in results.select(columns):\n            try:\n                _type = self.Relation.get_relation_type(_type.lower())\n            except ValueError:\n                _type = self.Relation.External\n            relations.append(self.Relation.create(\n                database=_database,\n                schema=_schema,\n                identifier=_identifier,\n                quote_policy=quote_policy,\n                type=_type\n            ))\n\n        return relations\n", "path": "plugins/snowflake/dbt/adapters/snowflake/impl.py"}]}