Repository: dbt-labs/dbt-core

Issue:
[LMA regression] dbt 0.15.0b2 model reference error
### Describe the bug
running a known working model I receive the error 
```
Encountered an error:
Compilation Error in model amazon_estimated_retail_market_data_mv (models\amazon_market_data\materialized views\amazon_estimated_retail_market_data_mv.sql)     
  Model 'model.BASE_DATA_LAYER.amazon_estimated_retail_market_data_mv' depends on model 'AMAZON_ESTIMATED_RETAIL_MARKET_DATA_INCREMENTAL' which was not found or is disabled ```
of note, it is returning an all lowercase model name where it is capitalized in the project. 

``` 
### Steps To Reproduce
I believe it to be due to models with capitalized names running on Windows.
@drewbanin was not able to reproduce this on his machine. 

### Screenshots and log output
project dir with the models in question
![image](https://user-images.githubusercontent.com/43586980/67409886-0fb25b00-f570-11e9-8891-fa6d7a096735.png)

references to the model 
![image](https://user-images.githubusercontent.com/43586980/67409962-2fe21a00-f570-11e9-98ac-bc3e39caf1c1.png)



### System information
**Which database are you using dbt with?**
 [ ] snowflake

**The output of `dbt --version`:**
```
installed version: 0.15.0-b2
   latest version: 0.14.3

Your version of dbt is ahead of the latest release!
```

**The operating system you're using:**
Windows 10 Pro

**The output of `python --version`:**
3.6.8

### Additional context
I have a hunch it is around the use of `os.path.normcase()`


Discussion:

Resolving patch:
diff --git a/core/dbt/clients/system.py b/core/dbt/clients/system.py
--- a/core/dbt/clients/system.py
+++ b/core/dbt/clients/system.py
@@ -50,11 +50,9 @@ def find_matching(root_path,
 
                 if fnmatch.fnmatch(local_file, file_pattern):
                     matching.append({
-                        'searched_path': os.path.normcase(
-                            relative_path_to_search
-                        ),
-                        'absolute_path': os.path.normcase(absolute_path),
-                        'relative_path': os.path.normcase(relative_path),
+                        'searched_path': relative_path_to_search,
+                        'absolute_path': absolute_path,
+                        'relative_path': relative_path,
                     })
 
     return matching
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
@@ -34,13 +34,13 @@ def search_key(self) -> str:
     @property
     def full_path(self) -> str:
         # useful for symlink preservation
-        return os.path.normcase(os.path.join(
+        return os.path.join(
             self.project_root, self.searched_path, self.relative_path
-        ))
+        )
 
     @property
     def absolute_path(self) -> str:
-        return os.path.normcase(os.path.abspath(self.full_path))
+        return os.path.abspath(self.full_path)
 
     @property
     def original_file_path(self) -> str:


Test patch:
diff --git a/test/integration/001_simple_copy_test/shouting_models/ADVANCED_INCREMENTAL.sql b/test/integration/001_simple_copy_test/shouting_models/ADVANCED_INCREMENTAL.sql
new file mode 100644
--- /dev/null
+++ b/test/integration/001_simple_copy_test/shouting_models/ADVANCED_INCREMENTAL.sql
@@ -0,0 +1,17 @@
+{{
+  config(
+    materialized = "incremental",
+    unique_key = "id",
+    persist_docs = {"relation": true}
+  )
+}}
+
+
+select *
+from {{ ref('seed') }}
+
+{% if is_incremental() %}
+
+    where id > (select max(id) from {{this}})
+
+{% endif %}
diff --git a/test/integration/001_simple_copy_test/shouting_models/COMPOUND_SORT.sql b/test/integration/001_simple_copy_test/shouting_models/COMPOUND_SORT.sql
new file mode 100644
--- /dev/null
+++ b/test/integration/001_simple_copy_test/shouting_models/COMPOUND_SORT.sql
@@ -0,0 +1,9 @@
+{{
+  config(
+    materialized = "table",
+    sort = 'first_name',
+    sort_type = 'compound'
+  )
+}}
+
+select * from {{ ref('seed') }}
diff --git a/test/integration/001_simple_copy_test/shouting_models/DISABLED.sql b/test/integration/001_simple_copy_test/shouting_models/DISABLED.sql
new file mode 100644
--- /dev/null
+++ b/test/integration/001_simple_copy_test/shouting_models/DISABLED.sql
@@ -0,0 +1,8 @@
+{{
+  config(
+    materialized = "view",
+    enabled = False
+  )
+}}
+
+select * from {{ ref('seed') }}
diff --git a/test/integration/001_simple_copy_test/shouting_models/EMPTY.sql b/test/integration/001_simple_copy_test/shouting_models/EMPTY.sql
new file mode 100644
--- /dev/null
+++ b/test/integration/001_simple_copy_test/shouting_models/EMPTY.sql
@@ -0,0 +1,5 @@
+
+
+
+
+
diff --git a/test/integration/001_simple_copy_test/shouting_models/GET_AND_REF.sql b/test/integration/001_simple_copy_test/shouting_models/GET_AND_REF.sql
new file mode 100644
--- /dev/null
+++ b/test/integration/001_simple_copy_test/shouting_models/GET_AND_REF.sql
@@ -0,0 +1,3 @@
+{%- do adapter.get_relation(database=target.database, schema=target.schema, identifier='MATERIALIZED') -%}
+
+select * from {{ ref('MATERIALIZED') }}
diff --git a/test/integration/001_simple_copy_test/shouting_models/INCREMENTAL.sql b/test/integration/001_simple_copy_test/shouting_models/INCREMENTAL.sql
new file mode 100644
--- /dev/null
+++ b/test/integration/001_simple_copy_test/shouting_models/INCREMENTAL.sql
@@ -0,0 +1,11 @@
+{{
+  config(
+    materialized = "incremental"
+  )
+}}
+
+select * from {{ ref('seed') }}
+
+{% if is_incremental() %}
+    where id > (select max(id) from {{this}})
+{% endif %}
diff --git a/test/integration/001_simple_copy_test/shouting_models/INTERLEAVED_SORT.sql b/test/integration/001_simple_copy_test/shouting_models/INTERLEAVED_SORT.sql
new file mode 100644
--- /dev/null
+++ b/test/integration/001_simple_copy_test/shouting_models/INTERLEAVED_SORT.sql
@@ -0,0 +1,9 @@
+{{
+  config(
+    materialized = "table",
+    sort = ['first_name', 'last_name'],
+    sort_type = 'interleaved'
+  )
+}}
+
+select * from {{ ref('seed') }}
diff --git a/test/integration/001_simple_copy_test/shouting_models/MATERIALIZED.sql b/test/integration/001_simple_copy_test/shouting_models/MATERIALIZED.sql
new file mode 100644
--- /dev/null
+++ b/test/integration/001_simple_copy_test/shouting_models/MATERIALIZED.sql
@@ -0,0 +1,8 @@
+{{
+  config(
+    materialized = "table"
+  )
+}}
+
+-- this is a unicode character: å
+select * from {{ ref('seed') }}
diff --git a/test/integration/001_simple_copy_test/shouting_models/SCHEMA.yml b/test/integration/001_simple_copy_test/shouting_models/SCHEMA.yml
new file mode 100644
--- /dev/null
+++ b/test/integration/001_simple_copy_test/shouting_models/SCHEMA.yml
@@ -0,0 +1,7 @@
+version: 2
+models:
+- name: DISABLED
+  columns:
+  - name: id
+    tests:
+    - unique
diff --git a/test/integration/001_simple_copy_test/shouting_models/VIEW_MODEL.sql b/test/integration/001_simple_copy_test/shouting_models/VIEW_MODEL.sql
new file mode 100644
--- /dev/null
+++ b/test/integration/001_simple_copy_test/shouting_models/VIEW_MODEL.sql
@@ -0,0 +1,7 @@
+{{
+  config(
+    materialized = "view"
+  )
+}}
+
+select * from {{ ref('seed') }}
diff --git a/test/integration/001_simple_copy_test/test_simple_copy.py b/test/integration/001_simple_copy_test/test_simple_copy.py
--- a/test/integration/001_simple_copy_test/test_simple_copy.py
+++ b/test/integration/001_simple_copy_test/test_simple_copy.py
@@ -298,3 +298,30 @@ def test__snowflake__incremental_overwrite(self):
 
         results = self.run_dbt(["run"])
         self.assertEqual(len(results),  1)
+
+
+class TestShouting(BaseTestSimpleCopy):
+    @property
+    def models(self):
+        return self.dir('shouting_models')
+
+    @property
+    def project_config(self):
+        return {"data-paths": [self.dir("seed-initial")]}
+
+    @use_profile("postgres")
+    def test__postgres__simple_copy_loud(self):
+        results = self.run_dbt(["seed"])
+        self.assertEqual(len(results),  1)
+        results = self.run_dbt()
+        self.assertEqual(len(results),  7)
+
+        self.assertManyTablesEqual(["seed", "VIEW_MODEL", "INCREMENTAL", "MATERIALIZED", "GET_AND_REF"])
+
+        self.use_default_project({"data-paths": [self.dir("seed-update")]})
+        results = self.run_dbt(["seed"])
+        self.assertEqual(len(results),  1)
+        results = self.run_dbt()
+        self.assertEqual(len(results),  7)
+
+        self.assertManyTablesEqual(["seed", "VIEW_MODEL", "INCREMENTAL", "MATERIALIZED", "GET_AND_REF"])