Skip to content

Commit cfd275c

Browse files
mwallace582lpezetdbeatty10
authored
Merge versioned branches into main (#168)
* Revert "Upgraded to dbt-core 1.4. (#146)" This reverts commit 3db05eb. * Fix version bumping * Migration bump2version (unmaintained) to bump-my-version * Import `bumpversion.cfg` from `dbt-snowflake` * Convert `bumpversion.cfg` to `bumpversion.toml` * Fix a few incorrect version labels * Remove macos and windows as integration targets * Fix requirements conflict between dbt 1.2 and tox * Bump version to 1.3 * Upgraded to dbt-core 1.4. (#146) * Upgraded to dbt-core 1.4. * Updated CHANGELOG. * Fixed policy fields definitions for mariadb and mysql5. * Replaced deprecated dbt.exceptions.raise_compiler_error() with dbt.exceptions.CompilationError. * Now using dbt.exceptions.DbtDatabaseError insead of dbt.exceptions.DatabaseException. * Update version * Update changelog --------- Co-authored-by: Doug Beatty <doug.beatty@dbtlabs.com> * Bump version to 1.5 * Update dbt-core to 1.5 and implement support for model contracts (#163) Update dbt-core to 1.5.9 and implement support for constraints * Update changelog * Fix unit test error - The error was: `AttributeError: 'Namespace' object has no attribute 'MACRO_DEBUGGING'` * Allow Unix socket connection rather than just TCP (#165) * Support Black & MyPy pre-commit hooks (#167) * Add black and mypy as pre-commit hooks * Run black formatter on all files * Add MyPy configuration & make tweaks and ignore errors to make MyPy pass * Add .git-blame-ignore-revs to ignore `black` changes in git blame * Update changelog * Run black formatter on all files * Add black commit to .git-blame-ignore-revs * Run black formatter on all files * Add black commit to .git-blame-ignore-revs * Fix MyPy & black errors * Make the `database` config field nullable again * Fix mypy * Bump version to 1.6 * Bump version to 1.7 * Fix import error --------- Co-authored-by: Luke <lpezet@gmail.com> Co-authored-by: Doug Beatty <doug.beatty@dbtlabs.com>
1 parent 22de9fe commit cfd275c

37 files changed

+1198
-267
lines changed

.bumpversion.cfg

Lines changed: 0 additions & 35 deletions
This file was deleted.

.bumpversion.toml

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
[tool.bumpversion]
2+
current_version = "1.7.0a1"
3+
parse = '''
4+
(?P<major>[\d]+) # major version number
5+
\.(?P<minor>[\d]+) # minor version number
6+
\.(?P<patch>[\d]+) # patch version number
7+
(?P<prerelease> # optional pre-release - ex: a1, b2, rc25
8+
(?P<prekind>a|b|rc) # pre-release type
9+
(?P<num>[\d]+) # pre-release version number
10+
)?
11+
( # optional nightly release indicator
12+
\.(?P<nightly>dev[0-9]+) # ex: .dev02142023
13+
)? # expected matches: `1.15.0`, `1.5.0a11`, `1.5.0a1.dev123`, `1.5.0.dev123457`, expected failures: `1`, `1.5`, `1.5.2-a1`, `text1.5.0`
14+
'''
15+
serialize = [
16+
"{major}.{minor}.{patch}{prekind}{num}.{nightly}",
17+
"{major}.{minor}.{patch}.{nightly}",
18+
"{major}.{minor}.{patch}{prekind}{num}",
19+
"{major}.{minor}.{patch}",
20+
]
21+
commit = false
22+
tag = false
23+
24+
[tool.bumpversion.parts.prekind]
25+
first_value = "a"
26+
optional_value = "final"
27+
values = [
28+
"a",
29+
"b",
30+
"rc",
31+
"final",
32+
]
33+
34+
[tool.bumpversion.parts.num]
35+
first_value = "1"
36+
37+
[[tool.bumpversion.files]]
38+
filename = "setup.py"
39+
40+
[[tool.bumpversion.files]]
41+
filename = "dbt/adapters/mysql/__version__.py"
42+
43+
[[tool.bumpversion.files]]
44+
filename = "dbt/adapters/mysql5/__version__.py"
45+
46+
[[tool.bumpversion.files]]
47+
filename = "dbt/adapters/mariadb/__version__.py"
48+
49+
[[tool.bumpversion.files]]
50+
filename = "dev-requirements.txt"
51+
parse = '''
52+
(?P<major>[\d]+) # major version number
53+
\.(?P<minor>[\d]+) # minor version number
54+
.latest
55+
'''
56+
serialize = ["{major}.{minor}.latest"]

.git-blame-ignore-revs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# Ran `black` on all files
2+
99a125c82b846fd25aed432ed67a9ad982bbe0ad
3+
# Ran `black` on all files
4+
f0507baaa4279575831ad06452757666d25bd90b
5+
# Ran `black` on all files
6+
870bbbf3c55081c436da7acb67a28e05c7484a44

.github/scripts/integration-test-matrix.js

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -39,24 +39,6 @@ module.exports = ({ context }) => {
3939
"database-image": adapterImages[adapter],
4040
"python-version": pythonVersion,
4141
});
42-
43-
if (labels.includes("test windows") || testAllLabel) {
44-
include.push({
45-
os: "windows-latest",
46-
adapter,
47-
"database-image": adapterImages[adapter],
48-
"python-version": pythonVersion,
49-
});
50-
}
51-
52-
if (labels.includes("test macos") || testAllLabel) {
53-
include.push({
54-
os: "macos-latest",
55-
adapter,
56-
"database-image": adapterImages[adapter],
57-
"python-version": pythonVersion,
58-
});
59-
}
6042
}
6143
}
6244
}
@@ -84,19 +66,6 @@ module.exports = ({ context }) => {
8466
}
8567
}
8668

87-
// additionally include runs for all adapters, on macos and windows,
88-
// but only for the default python version
89-
for (const adapter of supportedAdapters) {
90-
for (const operatingSystem of ["windows-latest", "macos-latest"]) {
91-
include.push({
92-
os: operatingSystem,
93-
adapter: adapter,
94-
"database-image": adapterImages[adapter],
95-
"python-version": defaultPythonVersion,
96-
});
97-
}
98-
}
99-
10069
console.log("matrix", { include });
10170

10271
return {

.github/workflows/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,7 @@ jobs:
5858
python -m pip install -r dev-requirements.txt
5959
python -m pip --version
6060
pre-commit --version
61+
mypy --version
6162
dbt --version
6263
6364
- name: Run pre-commit hooks

.pre-commit-config.yaml

Lines changed: 43 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,63 @@
11
# For more on configuring pre-commit hooks (see https://pre-commit.com/)
22

3+
# Force all unspecified python hooks to run python 3.8
34
default_language_version:
45
python: python3
56

67
repos:
78
- repo: https://github.com/pre-commit/pre-commit-hooks
8-
rev: v3.2.0
9+
rev: v4.4.0
910
hooks:
1011
- id: check-yaml
1112
args: [--unsafe]
1213
- id: check-json
1314
- id: end-of-file-fixer
1415
- id: trailing-whitespace
1516
- id: check-case-conflict
17+
- repo: https://github.com/psf/black
18+
rev: 23.1.0
19+
hooks:
20+
- id: black
21+
additional_dependencies: ['click~=8.1']
22+
args:
23+
- "--line-length=99"
24+
- "--target-version=py38"
25+
- id: black
26+
alias: black-check
27+
stages: [manual]
28+
additional_dependencies: ['click~=8.1']
29+
args:
30+
- "--line-length=99"
31+
- "--target-version=py38"
32+
- "--check"
33+
- "--diff"
1634
- repo: https://github.com/pycqa/flake8
17-
rev: 4.0.1
35+
rev: 6.0.0
1836
hooks:
1937
- id: flake8
2038
- id: flake8
2139
alias: flake8-check
2240
stages: [manual]
41+
- repo: https://github.com/pre-commit/mirrors-mypy
42+
rev: v1.1.1
43+
hooks:
44+
- id: mypy
45+
# N.B.: Mypy is... a bit fragile.
46+
#
47+
# By using `language: system` we run this hook in the local
48+
# environment instead of a pre-commit isolated one. This is needed
49+
# to ensure mypy correctly parses the project.
50+
51+
# It may cause trouble in that it adds environmental variables out
52+
# of our control to the mix. Unfortunately, there's nothing we can
53+
# do about per pre-commit's author.
54+
# See https://github.com/pre-commit/pre-commit/issues/730 for details.
55+
args: [--show-error-codes, --ignore-missing-imports, --explicit-package-bases]
56+
files: ^dbt/adapters/.*
57+
language: system
58+
- id: mypy
59+
alias: mypy-check
60+
stages: [manual]
61+
args: [--show-error-codes, --pretty, --ignore-missing-imports, --explicit-package-bases]
62+
files: ^dbt/adapters
63+
language: system

CHANGELOG.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,20 @@
11
## Unreleased (TBD)
22

33
### Features
4-
- Support dbt v1.4 ([#146](https://github.com/dbeatty10/dbt-mysql/pull/146))
54
- Migrate CircleCI to GitHub Actions ([#120](https://github.com/dbeatty10/dbt-mysql/issues/120))
5+
- Support dbt v1.4 ([#146](https://github.com/dbeatty10/dbt-mysql/pull/146))
6+
- Support dbt v1.5 ([#145](https://github.com/dbeatty10/dbt-mysql/issues/145))
7+
- Support connecting via UNIX sockets ([#164](https://github.com/dbeatty10/dbt-mysql/issues/164))
8+
- Support Black & MyPy pre-commit hooks ([#138](https://github.com/dbeatty10/dbt-mysql/issues/138))
69

710
### Fixes
811
- Fix incremental composite keys ([#144](https://github.com/dbeatty10/dbt-mysql/issues/144))
912

1013
### Contributors
11-
- [@lpezet](https://github.com/lpezet) ([#146](https://github.com/dbeatty10/dbt-mysql/pull/146), [#144](https://github.com/dbeatty10/dbt-mysql/issues/144))
14+
- [@lpezet](https://github.com/lpezet) ([#146](https://github.com/dbeatty10/dbt-mysql/pull/146))
1215
- [@moszutij](https://github.com/moszutij) ([#146](https://github.com/dbeatty10/dbt-mysql/pull/146), [#144](https://github.com/dbeatty10/dbt-mysql/issues/144))
1316
- [@wesen](https://github.com/wesen) ([#146](https://github.com/dbeatty10/dbt-mysql/pull/146))
14-
- [@mwallace582](https://github.com/mwallace582) ([#162](https://github.com/dbeatty10/dbt-mysql/pull/162))
17+
- [@mwallace582](https://github.com/mwallace582) ([#162](https://github.com/dbeatty10/dbt-mysql/pull/162), [#163](https://github.com/dbeatty10/dbt-mysql/pull/163), [#164](https://github.com/dbeatty10/dbt-mysql/issues/164), [#138](https://github.com/dbeatty10/dbt-mysql/issues/138))
1518

1619

1720
## dbt-mysql 1.1.0 (Feb 5, 2023)

Makefile

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,26 @@ dev-uninstall: ## Uninstalls all packages while maintaining the virtual environm
1111
pip freeze | grep -v "^-e" | cut -d "@" -f1 | xargs pip uninstall -y
1212
pip uninstall -y dbt-mysql
1313

14+
.PHONY: mypy
15+
mypy: ## Runs mypy against staged changes for static type checking.
16+
@\
17+
pre-commit run --hook-stage manual mypy-check | grep -v "INFO"
18+
1419
.PHONY: flake8
1520
flake8: ## Runs flake8 against staged changes to enforce style guide.
1621
@\
1722
pre-commit run --hook-stage manual flake8-check | grep -v "INFO"
1823

24+
.PHONY: black
25+
black: ## Runs black against staged changes to enforce style guide.
26+
@\
27+
pre-commit run --hook-stage manual black-check -v | grep -v "INFO"
28+
1929
.PHONY: lint
20-
lint: ## Runs flake8 code checks against staged changes.
30+
lint: ## Runs flake8 and mypy code checks against staged changes.
2131
@\
22-
pre-commit run flake8-check --hook-stage manual | grep -v "INFO";
32+
pre-commit run flake8-check --hook-stage manual | grep -v "INFO"; \
33+
pre-commit run mypy-check --hook-stage manual | grep -v "INFO"
2334

2435
.PHONY: linecheck
2536
linecheck: ## Checks for all Python lines 100 characters or more
@@ -35,7 +46,9 @@ unit: ## Runs unit tests with py38.
3546
test: ## Runs unit tests with py38 and code checks against staged changes.
3647
@\
3748
tox -p -e py38; \
38-
pre-commit run flake8-check --hook-stage manual | grep -v "INFO";
49+
pre-commit run black-check --hook-stage manual | grep -v "INFO"; \
50+
pre-commit run flake8-check --hook-stage manual | grep -v "INFO"; \
51+
pre-commit run mypy-check --hook-stage manual | grep -v "INFO"
3952

4053
.PHONY: integration
4154
integration: ## Runs mysql integration tests with py38.

RELEASE.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@
1010
1. Open a branch for the release
1111
- `git checkout -b releases/1.5.0`
1212
1. Update [`CHANGELOG.md`](CHANGELOG.md) with the most recent changes
13-
1. Bump the version using [`bump2version`](https://github.com/c4urself/bump2version/#bump2version):
14-
1. Dry run first by running `bumpversion --dry-run --verbose --new-version <desired-version> <part>`. Some examples:
13+
1. Bump the version using [`bump-my-version`](https://github.com/callowayproject/bump-my-version):
14+
1. Dry run first by running `bump-my-version bump --dry-run --verbose --new-version <desired-version> <part>`. Some examples:
1515
- Release candidates: `--new-version 1.5.0rc1 num`
1616
- Alpha releases: `--new-version 1.5.0a1 num`
1717
- Patch releases: `--new-version 1.5.1 patch`
1818
- Minor releases: `--new-version 1.5.0 minor`
1919
- Major releases: `--new-version 2.0.0 major`
20-
1. Actually modify the files: `bumpversion --no-tag --new-version <desired-version> <part>`. An example:
21-
- Minor releases: `bumpversion --no-tag --new-version 1.5.0 minor`
20+
1. Actually modify the files: `bump-my-version bump --no-tag --new-version <desired-version> <part>`. An example:
21+
- Minor releases: `bump-my-version bump --no-tag --new-version 1.5.0 minor`
2222
1. Check the diff with `git diff`
2323
1. Add the files that were changed with `git add --update`
2424
1. Commit with message `Release dbt-mysql v<desired-version>`
@@ -60,7 +60,7 @@ PyPI recognizes [pre-release versioning conventions](https://packaging.python.or
6060
- `git pull`
6161
- `git checkout -b bump-1.6.0a1`
6262
- Minor releases:
63-
`bumpversion --no-tag --new-version 1.6.0a1 num`
63+
`bump-my-version bump --no-tag --new-version 1.6.0a1 num`
6464
- Update the branch names in `dev-requirements.txt` from `@{previous-version}.latest` to `@{minor-version}.latest` (or `@main`)
6565
- Commit with message `Bump dbt-mysql 1.6.0a1`
6666
- `git push`

dbt/adapters/mariadb/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010

1111
Plugin = AdapterPlugin(
12-
adapter=MariaDBAdapter,
12+
adapter=MariaDBAdapter, # type: ignore[arg-type]
1313
credentials=MariaDBCredentials,
1414
include_path=mariadb.PACKAGE_PATH,
1515
)

0 commit comments

Comments
 (0)