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

Issue:
[CT-381] [HOTFIX] Homebrew Incident Resolution
### What Happened

dbt-core depends on the dbt-extractor package, and the dbt-extractor package depends on tree-sitter-jinja2. dbt-extractor specifies tree-sitter-jinja2 via a github link using the git protocol. Github security rules changed to require this link to use https which caused cargo to fail to build the dbt-extractor.

### Who Is Affected

Everyone attempting to build dbt-core from source after the github security rules took affect. This primarily affects homebrew users since homebrew builds dbt from source locally.

### Solution:
- release new dbt-extractor (0.4.1). The fix is already in main
    - dbt-labs/dbt-extractor#51
- release new dbt-core patch from branch [1.0.4-hotfix](https://github.com/dbt-labs/dbt-core/tree/1.0.4-hotfix) which depends on this new version and accepts all future patch releases so we can skip this step in the future. This branch is only the 3 necessary commits ahead of 1.0.3 to fix this incident.
    - main: #4890
    - backport is directly on branch [1.0.4-hotfix](https://github.com/dbt-labs/dbt-core/tree/1.0.4-hotfix) because of complications with running the bump-version workflow for a hotfix branch.
    
Getting the release out has been delayed due to complications with github actions due to an [ongoing GitHub incident](https://www.githubstatus.com/incidents/dcnvr6zym66r).
  


Discussion:

Resolving patch:
diff --git a/core/setup.py b/core/setup.py
--- a/core/setup.py
+++ b/core/setup.py
@@ -64,7 +64,7 @@
         "networkx>=2.3,<3",
         "packaging>=20.9,<22.0",
         "sqlparse>=0.2.3,<0.5",
-        "dbt-extractor==0.4.0",
+        "dbt-extractor~=0.4.1",
         "typing-extensions>=3.7.4,<4.2",
         "werkzeug>=1,<3",
         # the following are all to match snowflake-connector-python


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

Issue:
[CT-381] [HOTFIX] Homebrew Incident Resolution
### What Happened

dbt-core depends on the dbt-extractor package, and the dbt-extractor package depends on tree-sitter-jinja2. dbt-extractor specifies tree-sitter-jinja2 via a github link using the git protocol. Github security rules changed to require this link to use https which caused cargo to fail to build the dbt-extractor.

### Who Is Affected

Everyone attempting to build dbt-core from source after the github security rules took affect. This primarily affects homebrew users since homebrew builds dbt from source locally.

### Solution:
- release new dbt-extractor (0.4.1). The fix is already in main
    - dbt-labs/dbt-extractor#51
- release new dbt-core patch from branch [1.0.4-hotfix](https://github.com/dbt-labs/dbt-core/tree/1.0.4-hotfix) which depends on this new version and accepts all future patch releases so we can skip this step in the future. This branch is only the 3 necessary commits ahead of 1.0.3 to fix this incident.
    - main: #4890
    - backport is directly on branch [1.0.4-hotfix](https://github.com/dbt-labs/dbt-core/tree/1.0.4-hotfix) because of complications with running the bump-version workflow for a hotfix branch.
    
Getting the release out has been delayed due to complications with github actions due to an [ongoing GitHub incident](https://www.githubstatus.com/incidents/dcnvr6zym66r).
  


Discussion:

Resolving patch:
diff --git a/core/setup.py b/core/setup.py
--- a/core/setup.py
+++ b/core/setup.py
@@ -64,7 +64,7 @@
         'networkx>=2.3,<3',
         'packaging>=20.9,<22.0',
         'sqlparse>=0.2.3,<0.5',
-        'dbt-extractor==0.4.0',
+        'dbt-extractor~=0.4.1',
         'typing-extensions>=3.7.4,<3.11',
         'werkzeug>=1,<3',
         # the following are all to match snowflake-connector-python


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

Issue:
[CT-437] Finalize support for Python 3.10
follow up to https://github.com/dbt-labs/dbt-core/pull/4866

We still need to update:
- our tests (core + plugins): https://github.com/dbt-labs/dbt-core/blob/5071b00baac3ff2a9bcce565d09661605de52654/.github/workflows/main.yml#L71
- our package metadata (core + plugins)
https://github.com/dbt-labs/dbt-core/blob/5071b00baac3ff2a9bcce565d09661605de52654/core/setup.py#L82-L84
- our docs: https://github.com/dbt-labs/docs.getdbt.com/issues/1285
- ...anywhere else...?


Discussion:

Resolving patch:
diff --git a/core/setup.py b/core/setup.py
--- a/core/setup.py
+++ b/core/setup.py
@@ -82,6 +82,7 @@
         "Programming Language :: Python :: 3.7",
         "Programming Language :: Python :: 3.8",
         "Programming Language :: Python :: 3.9",
+        "Programming Language :: Python :: 3.10",
     ],
     python_requires=">=3.7.2",
 )
diff --git a/plugins/postgres/setup.py b/plugins/postgres/setup.py
--- a/plugins/postgres/setup.py
+++ b/plugins/postgres/setup.py
@@ -82,6 +82,7 @@ def _dbt_psycopg2_name():
         "Programming Language :: Python :: 3.7",
         "Programming Language :: Python :: 3.8",
         "Programming Language :: Python :: 3.9",
+        "Programming Language :: Python :: 3.10",
     ],
     python_requires=">=3.7",
 )


Test patch:
diff --git a/Dockerfile.test b/Dockerfile.test
--- a/Dockerfile.test
+++ b/Dockerfile.test
@@ -46,6 +46,9 @@ RUN apt-get update \
     python3.9 \
     python3.9-dev \
     python3.9-venv \
+    python3.10 \
+    python3.10-dev \
+    python3.10-venv \
     && apt-get clean \
     && rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
Repository: dbt-labs/dbt-core

Issue:
[CT-494] Move the deprecation check for dependancies outside the caching logic
Move the deprecation check for dependancies outside the caching logic.  The deprecations don't actually get cached, just the response so it's not really valid.

Relevant code:
https://github.com/dbt-labs/dbt-core/blob/080dd41876aaf5d348f75db402b2efbb074be4a2/core/dbt/clients/registry.py#L92-L109


Discussion:
This needs to be done as part of #5034 or the tests won't pass but does not effect use in the CLI.

Resolving patch:
diff --git a/core/dbt/clients/registry.py b/core/dbt/clients/registry.py
--- a/core/dbt/clients/registry.py
+++ b/core/dbt/clients/registry.py
@@ -89,6 +89,15 @@ def _get(package_name, registry_base_url=None):
         fire_event(RegistryResponseExtraNestedKeys(response=response))
         raise requests.exceptions.ContentDecodingError(error_msg, response=resp)
 
+    return response
+
+
+_get_cached = memoized(_get_with_retries)
+
+
+def package(package_name, registry_base_url=None) -> Dict[str, Any]:
+    # returns a dictionary of metadata for all versions of a package
+    response = _get_cached(package_name, registry_base_url)
     # Either redirectnamespace or redirectname in the JSON response indicate a redirect
     # redirectnamespace redirects based on package ownership
     # redirectname redirects based on package name
@@ -107,16 +116,6 @@ def _get(package_name, registry_base_url=None):
 
         new_nwo = use_namespace + "/" + use_name
         deprecations.warn("package-redirect", old_name=package_name, new_name=new_nwo)
-
-    return response
-
-
-_get_cached = memoized(_get_with_retries)
-
-
-def package(package_name, registry_base_url=None) -> Dict[str, Any]:
-    # returns a dictionary of metadata for all versions of a package
-    response = _get_cached(package_name, registry_base_url)
     return response["versions"]
 
 


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

Issue:
[CT-413] Update Mashumaro to 3.0
### Is there an existing feature request for this?

- [X] I have searched the existing issues

### Describe the Feature

Tech debt:
Updated Mashumaro to 3.0.  It has some breaking changes so the dependabot PR isn't going to cut it.

See dependabot PR
https://github.com/dbt-labs/dbt-core/pull/4705

### Describe alternatives you've considered

_No response_

### Who will this benefit?

_No response_

### Are you interested in contributing this feature?

_No response_

### Anything else?

_No response_


Discussion:

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
@@ -1,7 +1,7 @@
 import enum
 from dataclasses import dataclass, field
 from itertools import chain, islice
-from mashumaro import DataClassMessagePackMixin
+from mashumaro.mixins.msgpack import DataClassMessagePackMixin
 from multiprocessing.synchronize import Lock
 from typing import (
     Dict,
diff --git a/core/setup.py b/core/setup.py
--- a/core/setup.py
+++ b/core/setup.py
@@ -56,7 +56,7 @@
         "hologram>=0.0.14,<=0.0.15",
         "isodate>=0.6,<0.7",
         "logbook>=1.5,<1.6",
-        "mashumaro==2.9",
+        "mashumaro[msgpack]==3.0.3",
         "minimal-snowplow-tracker==0.0.2",
         "networkx>=2.3,<2.8.1;python_version<'3.8'",
         "networkx>=2.3,<3;python_version>='3.8'",
@@ -69,6 +69,7 @@
         "requests<3.0.0",
         "idna>=2.5,<4",
         "cffi>=1.9,<2.0.0",
+        "pyyaml>=6.0",
     ],
     zip_safe=False,
     classifiers=[


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

Issue:
[CT-586] [Feature] Improve tracking error message
### Is this your first time opening an issue?

- [X] I have read the [expectations for open source contributors](https://docs.getdbt.com/docs/contributing/oss-expectations)

### Describe the Feature

The tracking error `"Error sending message, disabling tracking"` should be more helpful by being more descriptive: 
- It is not obvious that it is related to DBT's internal anonymous usage statistics. 
- What "disabling" means also isn't clear, as far as I understand, it only disables it for the current execution, the next run will still have the error. Permanent disabling requires setting it in the profile or in environment variables as described here: https://docs.getdbt.com/reference/global-configs#send-anonymous-usage-stats

So I suggest this more descriptive message which could save people time:  
`Error sending anonymous usage statistics. Disabling tracking for this execution. If you wish to permanently disable tracking, see: https://docs.getdbt.com/reference/global-configs#send-anonymous-usage-stats .`

In my case, I am using DBT 1.0.4 on Windows 10 in an environment without internet for regulatory reasons, so tracking can never happen.

### Describe alternatives you've considered

1. Do users need to know that DBT internal tracking failed? You could show it only in debug mode when the `--debug` flag is used. But it still requires a more descriptive message, I think.
2. DBT could test if a connection to the internet exists, and silently disable tracking if it doesn't. But that's a bit more work than just editing an error message, and running DBT without internet probably doesn't represent a big percentage of use cases.

### Who will this benefit?

Anyone using DBT without an internet connection.

### Are you interested in contributing this feature?

Sure, I should be able to handle editing a string!


Discussion:
@NicolasPA Agree + agree! Let's update this error message, and make it `DebugLevel` instead of `WarnLevel`.

https://github.com/dbt-labs/dbt-core/blob/a2b3602485a8e9e03eea51caa9ffdd974e5900c6/core/dbt/events/types.py#L2354-L2359

Have at it :)

Resolving patch:
diff --git a/core/dbt/events/types.py b/core/dbt/events/types.py
--- a/core/dbt/events/types.py
+++ b/core/dbt/events/types.py
@@ -2352,11 +2352,15 @@ def message(self) -> str:
 
 
 @dataclass
-class DisableTracking(WarnLevel):
+class DisableTracking(DebugLevel):
     code: str = "Z039"
 
     def message(self) -> str:
-        return "Error sending message, disabling tracking"
+        return (
+            "Error sending anonymous usage statistics. Disabling tracking for this execution. "
+            "If you wish to permanently disable tracking, see: "
+            "https://docs.getdbt.com/reference/global-configs#send-anonymous-usage-stats."
+        )
 
 
 @dataclass


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

Issue:
[CT-616] Update to use Holgram v0.0.15
Hologram had dependency versions that were causing problems with Airflow https://github.com/dbt-labs/hologram/pull/45

The new version of Hologram has been released with the change so we need to bump the Hologram version on Core's end to reflect that.


Discussion:

Resolving patch:
diff --git a/core/setup.py b/core/setup.py
--- a/core/setup.py
+++ b/core/setup.py
@@ -56,7 +56,7 @@
         "agate>=1.6,<1.6.4",
         "click>=7.0,<9",
         "colorama>=0.3.9,<0.4.5",
-        "hologram==0.0.14",
+        "hologram>=0.0.14,<=0.0.15",
         "isodate>=0.6,<0.7",
         "logbook>=1.5,<1.6",
         "mashumaro==2.9",


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

Issue:
[CT-710] Fix unit test test_graph_selection.py so it can run separately
Previous changes to graph selection added a flag. Now when you attempt to run test_graph_selection.py by itself it fails because the flags aren't created.


Discussion:

Resolving patch:
diff --git a/core/dbt/graph/selector_spec.py b/core/dbt/graph/selector_spec.py
--- a/core/dbt/graph/selector_spec.py
+++ b/core/dbt/graph/selector_spec.py
@@ -2,7 +2,7 @@
 import re
 from abc import ABCMeta, abstractmethod
 from dataclasses import dataclass
-from dbt.dataclass_schema import StrEnum
+from dbt.dataclass_schema import StrEnum, dbtClassMixin
 
 from typing import Set, Iterator, List, Optional, Dict, Union, Any, Iterable, Tuple
 from .graph import UniqueId
@@ -169,7 +169,7 @@ def from_single_spec(
         )
 
 
-class BaseSelectionGroup(Iterable[SelectionSpec], metaclass=ABCMeta):
+class BaseSelectionGroup(dbtClassMixin, Iterable[SelectionSpec], metaclass=ABCMeta):
     def __init__(
         self,
         components: Iterable[SelectionSpec],


Test patch:
diff --git a/test/unit/test_graph_selection.py b/test/unit/test_graph_selection.py
--- a/test/unit/test_graph_selection.py
+++ b/test/unit/test_graph_selection.py
@@ -11,6 +11,13 @@
 
 import networkx as nx
 
+from dbt import flags
+
+from argparse import Namespace
+from dbt.contracts.project import UserConfig
+
+flags.set_from_args(Namespace(), UserConfig())
+
 
 def _get_graph():
     integer_graph = nx.balanced_tree(2, 2, nx.DiGraph())
Repository: dbt-labs/dbt-core

Issue:
[CT-737] [Bug] Wonky pluralization when duplicate docs are found
### Is there an existing issue for this?

- [X] I have searched the existing issues

### Current Behavior

The error message for duplicate docs is:

```
dbt found two docss with the name "whatever".
```

### Expected Behavior

The error message would be:

```
dbt found two docs with the name "whatever".
```

### Steps To Reproduce

1. Create multiple `{% docs whatever %}` blocks with the same name.
2. Run `dbt parse`.
3. See the weird pluralization in the output.

### Relevant log output

_No response_

### Environment

```markdown
- OS:
- Python:
- dbt:
```


### What database are you using dbt with?

redshift

### Additional Context

I believe the `pluralize` method of `NodeType.Documentation` would need to be updated to change this.


Discussion:
@pdebelak Nice catch!

> I believe the `pluralize` method of `NodeType.Documentation` would need to be updated to change this.

You're spot on :) Would you like to contribute the fix for this?

https://github.com/dbt-labs/dbt-core/blob/72b6a80b07b3acc9aa64ae65c5d82191dbb1aa11/core/dbt/node_types.py#L57-L61

Is the plural of `docs`, `docs`? Should it be `docs blocks` (per [our docs](https://docs.getdbt.com/docs/building-a-dbt-project/documentation#using-docs-blocks))? I could go either way.

Resolving patch:
diff --git a/core/dbt/node_types.py b/core/dbt/node_types.py
--- a/core/dbt/node_types.py
+++ b/core/dbt/node_types.py
@@ -12,8 +12,8 @@ class NodeType(StrEnum):
     Seed = "seed"
     # TODO: rm?
     RPCCall = "rpc"
-    SqlOperation = "sql"
-    Documentation = "docs"
+    SqlOperation = "sql operation"
+    Documentation = "docs block"
     Source = "source"
     Macro = "macro"
     Exposure = "exposure"
@@ -55,10 +55,9 @@ def documentable(cls) -> List["NodeType"]:
         ]
 
     def pluralize(self) -> str:
-        if self == "analysis":
+        if self is self.Analysis:
             return "analyses"
-        else:
-            return f"{self}s"
+        return f"{self}s"
 
 
 class RunHookType(StrEnum):


Test patch:
diff --git a/test/unit/test_node_types.py b/test/unit/test_node_types.py
new file mode 100644
--- /dev/null
+++ b/test/unit/test_node_types.py
@@ -0,0 +1,27 @@
+import pytest
+from dbt.node_types import NodeType
+
+node_type_pluralizations = {
+    NodeType.Model: "models",
+    NodeType.Analysis: "analyses",
+    NodeType.Test: "tests",
+    NodeType.Snapshot: "snapshots",
+    NodeType.Operation: "operations",
+    NodeType.Seed: "seeds",
+    NodeType.RPCCall: "rpcs",
+    NodeType.SqlOperation: "sql operations",
+    NodeType.Documentation: "docs blocks",
+    NodeType.Source: "sources",
+    NodeType.Macro: "macros",
+    NodeType.Exposure: "exposures",
+    NodeType.Metric: "metrics",
+}
+
+
+def test_all_types_have_pluralizations():
+    assert set(NodeType) == set(node_type_pluralizations)
+
+
+@pytest.mark.parametrize("node_type, pluralization", node_type_pluralizations.items())
+def test_pluralizes_correctly(node_type, pluralization):
+    assert node_type.pluralize() == pluralization
Repository: dbt-labs/dbt-core

Issue:
[CT-873] postgres: standardize connection retries.
Criteria:
- default to one retry after 1 second.
- if users specify more than one retry, use `x^2` exponential backoff

Redshift will inherit this configuration.


Discussion:

Resolving patch:
diff --git a/plugins/postgres/dbt/adapters/postgres/connections.py b/plugins/postgres/dbt/adapters/postgres/connections.py
--- a/plugins/postgres/dbt/adapters/postgres/connections.py
+++ b/plugins/postgres/dbt/adapters/postgres/connections.py
@@ -145,11 +145,15 @@ def connect():
             psycopg2.errors.OperationalError,
         ]
 
+        def exponential_backoff(attempt: int):
+            return attempt * attempt
+
         return cls.retry_connection(
             connection,
             connect=connect,
             logger=logger,
             retry_limit=credentials.retries,
+            retry_timeout=exponential_backoff,
             retryable_exceptions=retryable_exceptions,
         )
 


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

Issue:
[CT-876] Could we also now remove our upper bound on `MarkupSafe`, which we put in place earlier this year due to incompatibility with Jinja2?
Remove our upper bound on `MarkupSafe`, which we put in place earlier this year due to incompatibility with Jinja2(#4745).  Also bump minimum requirement to match [Jinja2's requirements](https://github.com/pallets/jinja/blob/1c4066a4fad5aaeb2ac55809d1d38477cd23a0f6/setup.py#L6).



Discussion:

Resolving patch:
diff --git a/core/setup.py b/core/setup.py
--- a/core/setup.py
+++ b/core/setup.py
@@ -49,7 +49,6 @@
     },
     install_requires=[
         "Jinja2==3.1.2",
-        "MarkupSafe>=0.23,<2.1",
         "agate>=1.6,<1.6.4",
         "click>=7.0,<9",
         "colorama>=0.3.9,<0.4.6",


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

Issue:
[CT-966] Flake8 fails on 1.0.latest branch when flake8 is updated to 5.0.2
flake8 --select=E,W,F --ignore=W504,E741 --max-line-length 99 core/dbt plugins/postgres/dbt
core/dbt/semver.py:283:11: E275 missing whitespace after keyword
core/dbt/semver.py:411:11: E275 missing whitespace after keyword
core/dbt/semver.py:427:11: E275 missing whitespace after keyword


Discussion:

Resolving patch:
diff --git a/core/dbt/semver.py b/core/dbt/semver.py
--- a/core/dbt/semver.py
+++ b/core/dbt/semver.py
@@ -280,7 +280,7 @@ def _try_combine_upper_bound(self, a, b):
     def reduce(self, other):
         start = None
 
-        if(self.start.is_exact and other.start.is_exact):
+        if (self.start.is_exact and other.start.is_exact):
             start = end = self._try_combine_exact(self.start, other.start)
 
         else:
@@ -408,9 +408,9 @@ def find_possible_versions(requested_range, available_versions):
     for version_string in available_versions:
         version = VersionSpecifier.from_version_string(version_string)
 
-        if(versions_compatible(version,
-                               requested_range.start,
-                               requested_range.end)):
+        if (versions_compatible(version,
+                                requested_range.start,
+                                requested_range.end)):
             possible_versions.append(version)
 
     sorted_versions = sorted(possible_versions, reverse=True)
@@ -424,7 +424,7 @@ def resolve_to_specific_version(requested_range, available_versions):
     for version_string in available_versions:
         version = VersionSpecifier.from_version_string(version_string)
 
-        if(versions_compatible(version,
+        if (versions_compatible(version,
            requested_range.start, requested_range.end) and
            (max_version is None or max_version.compare(version) < 0)):
             max_version = version


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

Issue:
[CT-1063] [Bug] Small typos in core/dbt/adapters/
### Is this a new bug in dbt-core?

- [X] I believe this is a new bug in dbt-core
- [X] I have searched the existing issues, and I could not find an existing issue for this bug

### Current Behavior


https://github.com/dbt-labs/dbt-core/blob/7f8d9a7af976f640e376900773a0d793acf3a3ce/core/dbt/adapters/cache.py#L387

I think `relaton` is a typo.

https://github.com/dbt-labs/dbt-core/blob/7f8d9a7af976f640e376900773a0d793acf3a3ce/core/dbt/adapters/protocol.py#L91

Also, I believe `restirctiveness` is a typo.

### Expected Behavior

Fix typos:

* `relaton` to `relation`
*  `restirctiveness` to `restrictiveness`




### Steps To Reproduce

1. Change from `relaton` to `relation` https://github.com/dbt-labs/dbt-core/blob/7f8d9a7af976f640e376900773a0d793acf3a3ce/core/dbt/adapters/cache.py#L387
2. Change from `restirctiveness` to `restrictiveness` https://github.com/dbt-labs/dbt-core/blob/7f8d9a7af976f640e376900773a0d793acf3a3ce/core/dbt/adapters/protocol.py#L91


### Relevant log output

_No response_

### Environment

```markdown
- OS:
- Python:
- dbt:
```


### Which database adapter are you using with dbt?

_No response_

### Additional Context

_No response_


Discussion:

Resolving patch:
diff --git a/core/dbt/adapters/cache.py b/core/dbt/adapters/cache.py
--- a/core/dbt/adapters/cache.py
+++ b/core/dbt/adapters/cache.py
@@ -384,7 +384,7 @@ def _rename_relation(self, old_key, new_relation):
         relation = self.relations.pop(old_key)
         new_key = new_relation.key()
 
-        # relaton has to rename its innards, so it needs the _CachedRelation.
+        # relation has to rename its innards, so it needs the _CachedRelation.
         relation.rename(new_relation)
         # update all the relations that refer to it
         for cached in self.relations.values():
diff --git a/core/dbt/adapters/protocol.py b/core/dbt/adapters/protocol.py
--- a/core/dbt/adapters/protocol.py
+++ b/core/dbt/adapters/protocol.py
@@ -88,7 +88,7 @@ class AdapterProtocol(  # type: ignore[misc]
     ],
 ):
     # N.B. Technically these are ClassVars, but mypy doesn't support putting type vars in a
-    # ClassVar due to the restirctiveness of PEP-526
+    # ClassVar due to the restrictiveness of PEP-526
     # See: https://github.com/python/mypy/issues/5144
     AdapterSpecificConfigs: Type[AdapterConfig_T]
     Column: Type[Column_T]


Test patch: