internlm/SWE-Fixer-Train-110K huggingface dataset:
Repository: dbt-labs/dbt-core

Issue:
The script that builds dbt should `git add` the dockerfiles/requirements files and commit them.
### Describe the feature
This builds upon the script in #2119 that generates dockerfiles/docker images and pushes them. Also see #1944

As part of the build process, the script that builds dbt should `git add` the dockerfiles/requirements files and commit them.

I think it might make sense to generate a requirements file just before the version commit from `bumpversion`, and including it in that commit. Then subsequent steps in the build can use that.

### Who will this benefit?
- Users can see what's in an image more easily, builds should get more reproducible, it will be easier to replace `homebrew-pypi-poet`, etc
- Maintainers: I'm hopeful that we can get some good pull requests/issues from the community once users can more easily see what our Dockerfiles look like
- QA: Someday, maybe we can use this for tests?


Discussion:

Resolving patch:
diff --git a/scripts/build-dbt.py b/scripts/build-dbt.py
--- a/scripts/build-dbt.py
+++ b/scripts/build-dbt.py
@@ -589,7 +589,7 @@ def run_tests(formula_path: Path, audit: bool = True):
         versions = [
             l.strip() for l in
             collect_output(['brew', 'list']).split('\n')
-            if l.strip().startswith('dbt@')
+            if l.strip().startswith('dbt@') or l.strip() == 'dbt'
         ]
         if versions:
             run_command(['brew', 'unlink'] + versions)
@@ -779,6 +779,15 @@ def set_remote_tag(self):
             cwd=self.dbt_path,
         )
 
+    def commit_docker_folder(self):
+        # commit the contents of docker/
+        run_command(
+            ['git', 'add', 'docker'],
+            cwd=self.dbt_path
+        )
+        commit_msg = f'Add {self.image_tag} dockerfiles and requirements'
+        run_command(['git', 'commit', '-m', commit_msg], cwd=self.dbt_path)
+
     def build(
         self,
         write_requirements: bool = True,
@@ -788,6 +797,7 @@ def build(
             self.write_lockfile()
         if write_dockerfile:
             self.write_dockerfile()
+        self.commit_docker_folder()
         self.create_docker_image()
         self.set_remote_tag()
 


Test patch:
Repository: dbt-labs/dbt-core

Issue:
Add timeout + error handling to `dbt deps` requests to hub site
### Describe the bug
We've seen a couple of reports of dbt hanging when connecting to the hub site (note the timestamps):
```
2020-03-10 00:07:57,503415 (MainThread): Response from registry: GET https://hub.getdbt.com/api/v1/fishtown-analytics/dbt_utils/0.2.5.json 200
2020-03-10 00:07:57,507527 (MainThread): Making package registry request: GET https://hub.getdbt.com/api/v1/fishtown-analytics/dbt_utils.json
2020-03-10 16:50:30,597385 (MainThread): Flushing usage events
2020-03-10 16:50:30,602693 (MainThread):
```

The dbt process was, somehow, alive for these 16+ hours and the process needed to be terminated manually to get it to exit. Let's:
- figure out how something like this could happen (did the request really stay open for 16 hours??)
- see if there's any additional error handling we need to add here
- add a timeout to these hubsite requests to [cancel them after some timeout](https://requests.readthedocs.io/en/master/user/quickstart/#timeouts). I think 30 seconds is reasonable.
- It would be good if dbt retried fetching packages a couple of times if an unhandled (ie. not 404) error occurs

### Steps To Reproduce
This one is _super_ tough to reproduce. No reliable repro case at the moment.

**The output of `dbt --version`:**
This was most recently replicated on dbt v0.15.0

**The operating system you're using:**
This was replicated in dbt Cloud

**The output of `python --version`:**
This was replicated in dbt Cloud


Discussion:
What happens if you literally unplug the network cable (or turn off the wifi) in the middle of dbt running?
@jrandrews it depends on what you run! 

I'm seeing:
```
$ dbt deps
Running with dbt=0.16.0-rc2
Encountered an error:
Unable to connect to registry hub
```

For a `dbt run`, I see that the database query times out after a couple of retries on Snowflake, with similar behavior expected on other databases.

I think the bigger failure mode here is when the remote keeps the connection open but never returns any data. A timeout on these requests would help there.

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
@@ -10,7 +10,7 @@
 import requests
 import stat
 from typing import (
-    Type, NoReturn, List, Optional, Dict, Any, Tuple, Callable
+    Type, NoReturn, List, Optional, Dict, Any, Tuple, Callable, Union
 )
 
 import dbt.exceptions
@@ -323,8 +323,9 @@ def run_cmd(
     return out, err
 
 
-def download(url: str, path: str) -> None:
-    response = requests.get(url)
+def download(url: str, path: str, timeout: Union[float, tuple] = None) -> None:
+    connection_timeout = timeout or float(os.getenv('DBT_HTTP_TIMEOUT', 10))
+    response = requests.get(url, timeout=connection_timeout)
     with open(path, 'wb') as handle:
         for block in response.iter_content(1024 * 64):
             handle.write(block)


Test patch:
Repository: dbt-labs/dbt-core

Issue:
Source doesn't allow usage of dataset and project aliases
### Describe the bug
Most everywhere else in DBT, database is synonymous to project, and dataset is synonymous to schema. In sources, this is not the case, and they are unexpected parameters. This is very confusing to end users looking at code with project and dataset everywhere else, they'll not even be familiar with what database and schema are, as these names don't appear anywhere in bigquery.

### Steps To Reproduce
Attempt to specify the dataset or project of a source in `schema.yml`

### Expected behavior
Schema and dataset should be interchangeable, as should database and project

### Screenshots and log output
`dditional properties are not allowed ('project', 'dataset' were unexpected)`

### System information
**Which database are you using dbt with?**
- [ ] postgres
- [ ] redshift
- [x] bigquery
- [ ] snowflake
- [ ] other (specify: ____________)


**The output of `dbt --version`:**
```
0.15.2
```



Discussion:
Thanks for the report @preston-hf! This does appear to be an oversight on our part.

Would you be interested in contributing a fix? If so, happy to help point you in the right direction!
+let's make sure to improve documentation for these aliases when we make this change

Resolving patch:
diff --git a/core/dbt/parser/schemas.py b/core/dbt/parser/schemas.py
--- a/core/dbt/parser/schemas.py
+++ b/core/dbt/parser/schemas.py
@@ -530,6 +530,7 @@ def get_unparsed_target(self) -> Iterable[SourceTarget]:
 
         for data in self.get_key_dicts():
             try:
+                data = self.project.credentials.translate_aliases(data)
                 data = self._renderer.render_schema_source(data)
                 source = UnparsedSourceDefinition.from_dict(data)
             except (ValidationError, JSONValidationException) as exc:


Test patch:
diff --git a/test/integration/022_bigquery_test/models/schema.yml b/test/integration/022_bigquery_test/models/schema.yml
--- a/test/integration/022_bigquery_test/models/schema.yml
+++ b/test/integration/022_bigquery_test/models/schema.yml
@@ -49,3 +49,12 @@ models:
     - was_materialized:
         name: fUnKyCaSe
         type: view
+
+
+sources:
+  - name: raw
+    project: "{{ target.database }}"
+    dataset: "{{ target.schema }}"
+    tables:
+      - name: seed
+        identifier: data_seed
diff --git a/test/integration/022_bigquery_test/models/view_model.sql b/test/integration/022_bigquery_test/models/view_model.sql
--- a/test/integration/022_bigquery_test/models/view_model.sql
+++ b/test/integration/022_bigquery_test/models/view_model.sql
@@ -11,4 +11,4 @@ select
     current_date as updated_at,
     dupe
 
-from {{ ref('data_seed') }}
+from {{ source('raw', 'seed') }}
Repository: dbt-labs/dbt-core

Issue:
Log test node metadata: depends_on_nodes
### Describe the feature
Currently the `extra` field from the structured log record is providing `unique_id` and `run_state` for test nodes. 
```json
{"timestamp": "2020-04-13T08:01:21.445113Z", "message": "10:01:21 | 2 of 385 START test assert_nnull_refid............................... [RUN]", "channel": "dbt", "level": 11, "levelname": "INFO", "thread_name": "Thread-6", "process": 13649, "extra": {"unique_id": "test.pmt_curated.assert_nnull_refid", "run_state": "running"}}
```
Include additional metadata field `depends_on_nodes` from the test node
```json
{"timestamp": "2020-04-13T08:01:21.445113Z", "message": "10:01:21 | 2 of 385 START test assert_nnull_refid............................... [RUN]", "channel": "dbt", "level": 11, "levelname": "INFO", "thread_name": "Thread-6", "process": 13649, "extra": {"unique_id": "test.pmt_curated.assert_nnull_refid", "run_state": "running", "depends_on_models": ["modelA", "modelB"]}}
```

### Who will this benefit?
People analyzing the logs for getting pipeline metrics can relate a failed test to a model or set of models.

Also [asked in in Slack](https://getdbt.slack.com/archives/C50NEBJGG/p1586535792024000).


Discussion:
I'd be happy to help with this if you think it's worth it.
Sure, I think this is a good idea! I would just call it `depends_on` instead of `depends_on_models`, since the test could conceivably be run against a seed, source, or snapshot too.

We'd love a PR for this one - let us know if there's anything we can help out with when you get to implementing :)

Resolving patch:
diff --git a/core/dbt/logger.py b/core/dbt/logger.py
--- a/core/dbt/logger.py
+++ b/core/dbt/logger.py
@@ -298,6 +298,7 @@ def mapping_keys(self):
             ('original_file_path', 'node_path'),
             ('name', 'node_name'),
             ('resource_type', 'resource_type'),
+            ('depends_on_nodes', 'depends_on'),
         ]
 
     def process_config(self, record):


Test patch:
Repository: dbt-labs/dbt-core

Issue:
`dbt compile` help text is missing a comma
### Describe the bug
`dbt -h` outputs:
```
...
    compile             Generates executable SQL from source model, test, and
                        analysis files. Compiled SQL files are written to the
                        target/ directory.
...
```
but a 'source model' is not a construct within dbt, there are sources _and_ models.


### Steps To Reproduce
`dbt -h`

### Expected behavior
I'd expect a comma between each object the help text describes, especially since the oxford comma is used before the word 'and'
### System information
**Which database are you using dbt with?**
- [ ] postgres
- [ ] redshift
- [ ] bigquery
- [x] snowflake
- [ ] other (specify: ____________)


**The output of `dbt --version`:**
```
installed version: 0.15.1
```
(but this is still true in dbt 0.16.x and in the current master branch)
**The operating system you're using:**
debian buster
**The output of `python --version`:**
Python 3.7.4.



Discussion:

Resolving patch:
diff --git a/core/dbt/main.py b/core/dbt/main.py
--- a/core/dbt/main.py
+++ b/core/dbt/main.py
@@ -415,7 +415,7 @@ def _build_compile_subparser(subparsers, base_subparser):
         'compile',
         parents=[base_subparser],
         help='''
-        Generates executable SQL from source model, test, and analysis files.
+        Generates executable SQL from source, model, test, and analysis files.
         Compiled SQL files are written to the target/ directory.
         '''
     )


Test patch:
Repository: dbt-labs/dbt-core

Issue:
Running dbt with a duplicate test name gives an unhelpful error
### Describe the bug
Running `dbt run` when there are multiple tests with the same name leads to an unhelpful error `local variable 'get_func' referenced before assignment`

### Steps To Reproduce
1. Create two tests with the same name (in different folders) of the project. 
2. Run `dbt run`
3. See the below error:
```
Running with dbt=0.16.1
Encountered an error:
local variable 'get_func' referenced before assignment
```

### Expected behavior
To receive a descriptive error like `'path1' and 'path2' give a test/resource with a duplicate name. Please ensure tests/resources have unique names.`

### System information
**Which database are you using dbt with?**
- [x] snowflake


**The output of `dbt --version`:**
```
installed version: 0.16.1
   latest version: 0.16.1

Up to date!
```

**The operating system you're using:**
Windows 10 Pro, version 1909, OS build 18363.778

**The output of `python --version`:**
Python 3.8.0




Discussion:
Thanks for the report @Tbodewes - should be a quick fix :)

Resolving patch:
diff --git a/core/dbt/exceptions.py b/core/dbt/exceptions.py
--- a/core/dbt/exceptions.py
+++ b/core/dbt/exceptions.py
@@ -729,6 +729,8 @@ def raise_duplicate_resource_name(node_1, node_2):
         get_func = 'doc("{}")'.format(duped_name)
     elif node_1.resource_type == NodeType.Test and 'schema' in node_1.tags:
         return
+    else:
+        get_func = '"{}"'.format(duped_name)
 
     raise_compiler_error(
         'dbt found two resources with the name "{}". Since these resources '


Test patch:
Repository: dbt-labs/dbt-core

Issue:
The create_adapter_plugin script emits a v1 config file
### Describe the bug
The create_adapter_plugin emits a v1 config file, but that results in a warning on every dbt run for users.

### Steps To Reproduce
Create a plugin with the script
Try to use it

### Expected behavior
I expect a `dbt_project.yml` with `config-version: 2`.

### System information
**The output of `dbt --version`:**
0.17.0rc1


Discussion:

Resolving patch:
diff --git a/core/scripts/create_adapter_plugins.py b/core/scripts/create_adapter_plugins.py
--- a/core/scripts/create_adapter_plugins.py
+++ b/core/scripts/create_adapter_plugins.py
@@ -6,6 +6,7 @@
 PROJECT_TEMPLATE = '''
 name: dbt_{adapter}
 version: {version}
+config-version: 2
 
 macro-paths: ["macros"]
 '''


Test patch:
Repository: dbt-labs/dbt-core

Issue:
--fail-fast msg typo
### Describe the bug
Typo in `--fail-fast` runner message:
```
Falling early due to test failure or runtime error
```
should say
```
Failing early due to test failure or runtime error
```

**The output of `dbt --version`:**
```
installed version: 0.17.0-rc1
   latest version: 0.16.1

Your version of dbt is ahead of the latest release!

Plugins:
  - bigquery: 0.17.0rc1
  - snowflake: 0.17.0rc1
  - redshift: 0.17.0rc1
  - postgres: 0.17.0rc1
```


Discussion:

Resolving patch:
diff --git a/core/dbt/task/runnable.py b/core/dbt/task/runnable.py
--- a/core/dbt/task/runnable.py
+++ b/core/dbt/task/runnable.py
@@ -183,7 +183,7 @@ def call_runner(self, runner):
 
         if (result.fail is not None or result.error is not None) and fail_fast:
             self._raise_next_tick = FailFastException(
-                message='Falling early due to test failure or runtime error',
+                message='Failing early due to test failure or runtime error',
                 result=result,
                 node=getattr(result, 'node', None)
             )


Test patch:
Repository: dbt-labs/dbt-core

Issue:
[0.17.0rc1] Broken Docker image entrypoint
### Describe the bug

The entrypoint for the image is invalid

### Steps To Reproduce

1. Pull the image: `docker pull fishtownanalytics/dbt:0.17.0rc1`
2. Run the image: 

```
docker run -it fishtownanalytics/dbt:0.17.0rc1
/bin/sh: 1: [dbt,: not found
```

### Expected behavior

The DBT help command is displayed


### Additional context

I plan on integrating DBT with our Airflow infrastructure as a container (we extend Airflow exclusively through containerized components)



Discussion:

Resolving patch:
diff --git a/scripts/build-dbt.py b/scripts/build-dbt.py
--- a/scripts/build-dbt.py
+++ b/scripts/build-dbt.py
@@ -740,7 +740,7 @@ def get_dockerfile_contents(self):
             VOLUME /usr/app
 
             USER dbt_user
-            CMD ['dbt', 'run']
+            ENTRYPOINT dbt
             '''
         )
 


Test patch:
Repository: dbt-labs/dbt-core

Issue:
Better error handling for compilation exceptions in .yml files
### Describe the bug
A malformed yml file can result in an error like:
<img width="399" alt="Screen Shot 2020-05-29 at 9 15 37 AM" src="https://user-images.githubusercontent.com/1541139/83263674-fa984d00-a18c-11ea-8c52-4148325edaa7.png">

Instead, this error should include information about the file in which the errant jinja code was found.

### Steps To Reproduce
Create a .yml file with the contents:
```
version: 2

models:
  - name: debug
    meta:
      abc: 123

      columns:
        - name: id
          description: '{{ doc("mydoc") }}'
```

Note that the columns entry is errantly indented under `meta`.

Run `dbt ls` or `dbt compile` to see the compilation exception.

### Expected behavior
I would expect to see the filename containing the errant code in the raised exception.

**The output of `dbt --version`:**
```
v0.17.0-rc3
```


Discussion:

Resolving patch:
diff --git a/core/dbt/config/renderer.py b/core/dbt/config/renderer.py
--- a/core/dbt/config/renderer.py
+++ b/core/dbt/config/renderer.py
@@ -1,9 +1,10 @@
 from typing import Dict, Any, Tuple, Optional, Union
 
-from dbt.clients.jinja import get_rendered
+from dbt.clients.jinja import get_rendered, catch_jinja
 
-from dbt.exceptions import DbtProjectError
-from dbt.exceptions import RecursionException
+from dbt.exceptions import (
+    DbtProjectError, CompilationException, RecursionException
+)
 from dbt.node_types import NodeType
 from dbt.utils import deep_map
 
@@ -35,7 +36,12 @@ def render_value(
         # if it wasn't read as a string, ignore it
         if not isinstance(value, str):
             return value
-        return get_rendered(value, self.context, native=True)
+        try:
+            with catch_jinja():
+                return get_rendered(value, self.context, native=True)
+        except CompilationException as exc:
+            msg = f'Could not render {value}: {exc.msg}'
+            raise CompilationException(msg) from exc
 
     def render_data(
         self, data: Dict[str, Any]
diff --git a/core/dbt/parser/schemas.py b/core/dbt/parser/schemas.py
--- a/core/dbt/parser/schemas.py
+++ b/core/dbt/parser/schemas.py
@@ -507,7 +507,14 @@ def parse_file(self, block: FileBlock) -> None:
         # mark the file as seen, even if there are no macros in it
         self.results.get_file(block.file)
         if dct:
-            dct = self.raw_renderer.render_data(dct)
+            try:
+                dct = self.raw_renderer.render_data(dct)
+            except CompilationException as exc:
+                raise CompilationException(
+                    f'Failed to render {block.path.original_file_path} from '
+                    f'project {self.project.project_name}: {exc}'
+                ) from exc
+
             yaml_block = YamlBlock.from_file_block(block, dct)
 
             self._parse_format_version(yaml_block)


Test patch:
Repository: dbt-labs/dbt-core

Issue:
create_adpater_plugin bug with --dependency flag
### Describe the bug
Bug in create_adapter_plugin.py script when a dependency is not passed in via the --dependency arg. 

### Steps To Reproduce
Run the create_adapter_plugin.py script without a --dependency arg. The variable 'prefix' is not defined in the else condition. 

### Expected behavior
The script should trigger the else condition. 

### Screenshots and log output


### System information
**Which database are you using dbt with?**
- [ ] postgres
- [ ] redshift
- [ ] bigquery
- [ ] snowflake
- [ ] other (specify: ____________)


**The output of `dbt --version`:**
```
Newest release candidate
```

**The operating system you're using:**

**The output of `python --version`:**

### Additional context



Discussion:

Resolving patch:
diff --git a/core/scripts/create_adapter_plugins.py b/core/scripts/create_adapter_plugins.py
--- a/core/scripts/create_adapter_plugins.py
+++ b/core/scripts/create_adapter_plugins.py
@@ -248,11 +248,12 @@ def parse_args(argv=None):
         parsed.title_case = parsed.adapter.title()
 
     if parsed.set_dependency:
+        
+        prefix = '\n        '
+        
         if parsed.dependency:
             # ['a', 'b'] => "'a',\n        'b'"; ['a'] -> "'a',"
-
-            prefix = '\n        '
-
+            
             parsed.dependency = prefix + prefix.join(
                 "'{}',".format(d) for d in parsed.dependency
             )


Test patch:
Repository: dbt-labs/dbt-core

Issue:
Python 3.6.2 doesn't work with dbt 0.17.0
### Describe the bug
Running dbt on python <= 3.6.2 results in an error that `name 'TimestampSnapshotConfig' is not defined`. 3.6.3 is unaffected.

### Steps To Reproduce
Install python 3.6.2
Install dbt
Try to use dbt

### Expected behavior
dbt should run, not crash, etc


### System information
**Which database are you using dbt with?**
Any

**The output of `dbt --version`:**
```
0.17.0
```

**The operating system you're using:**
macos, linux

**The output of `python --version`:**
`Python 3.6.2`




Discussion:

Resolving patch:
diff --git a/core/setup.py b/core/setup.py
--- a/core/setup.py
+++ b/core/setup.py
@@ -86,5 +86,5 @@ def read(fname):
         'Programming Language :: Python :: 3.7',
         'Programming Language :: Python :: 3.8',
     ],
-    python_requires=">=3.6.2",
+    python_requires=">=3.6.3",
 )


Test patch: