Skip to content

Commit

Permalink
Merge versioned branches into main (#168)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>

* 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 <[email protected]>
Co-authored-by: Doug Beatty <[email protected]>
  • Loading branch information
3 people authored Jan 17, 2024
1 parent 22de9fe commit cfd275c
Show file tree
Hide file tree
Showing 37 changed files with 1,198 additions and 267 deletions.
35 changes: 0 additions & 35 deletions .bumpversion.cfg

This file was deleted.

56 changes: 56 additions & 0 deletions .bumpversion.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
[tool.bumpversion]
current_version = "1.7.0a1"
parse = '''
(?P<major>[\d]+) # major version number
\.(?P<minor>[\d]+) # minor version number
\.(?P<patch>[\d]+) # patch version number
(?P<prerelease> # optional pre-release - ex: a1, b2, rc25
(?P<prekind>a|b|rc) # pre-release type
(?P<num>[\d]+) # pre-release version number
)?
( # optional nightly release indicator
\.(?P<nightly>dev[0-9]+) # ex: .dev02142023
)? # 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`
'''
serialize = [
"{major}.{minor}.{patch}{prekind}{num}.{nightly}",
"{major}.{minor}.{patch}.{nightly}",
"{major}.{minor}.{patch}{prekind}{num}",
"{major}.{minor}.{patch}",
]
commit = false
tag = false

[tool.bumpversion.parts.prekind]
first_value = "a"
optional_value = "final"
values = [
"a",
"b",
"rc",
"final",
]

[tool.bumpversion.parts.num]
first_value = "1"

[[tool.bumpversion.files]]
filename = "setup.py"

[[tool.bumpversion.files]]
filename = "dbt/adapters/mysql/__version__.py"

[[tool.bumpversion.files]]
filename = "dbt/adapters/mysql5/__version__.py"

[[tool.bumpversion.files]]
filename = "dbt/adapters/mariadb/__version__.py"

[[tool.bumpversion.files]]
filename = "dev-requirements.txt"
parse = '''
(?P<major>[\d]+) # major version number
\.(?P<minor>[\d]+) # minor version number
.latest
'''
serialize = ["{major}.{minor}.latest"]
6 changes: 6 additions & 0 deletions .git-blame-ignore-revs
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Ran `black` on all files
99a125c82b846fd25aed432ed67a9ad982bbe0ad
# Ran `black` on all files
f0507baaa4279575831ad06452757666d25bd90b
# Ran `black` on all files
870bbbf3c55081c436da7acb67a28e05c7484a44
31 changes: 0 additions & 31 deletions .github/scripts/integration-test-matrix.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,24 +39,6 @@ module.exports = ({ context }) => {
"database-image": adapterImages[adapter],
"python-version": pythonVersion,
});

if (labels.includes("test windows") || testAllLabel) {
include.push({
os: "windows-latest",
adapter,
"database-image": adapterImages[adapter],
"python-version": pythonVersion,
});
}

if (labels.includes("test macos") || testAllLabel) {
include.push({
os: "macos-latest",
adapter,
"database-image": adapterImages[adapter],
"python-version": pythonVersion,
});
}
}
}
}
Expand Down Expand Up @@ -84,19 +66,6 @@ module.exports = ({ context }) => {
}
}

// additionally include runs for all adapters, on macos and windows,
// but only for the default python version
for (const adapter of supportedAdapters) {
for (const operatingSystem of ["windows-latest", "macos-latest"]) {
include.push({
os: operatingSystem,
adapter: adapter,
"database-image": adapterImages[adapter],
"python-version": defaultPythonVersion,
});
}
}

console.log("matrix", { include });

return {
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ jobs:
python -m pip install -r dev-requirements.txt
python -m pip --version
pre-commit --version
mypy --version
dbt --version
- name: Run pre-commit hooks
Expand Down
45 changes: 43 additions & 2 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,22 +1,63 @@
# For more on configuring pre-commit hooks (see https://pre-commit.com/)

# Force all unspecified python hooks to run python 3.8
default_language_version:
python: python3

repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v3.2.0
rev: v4.4.0
hooks:
- id: check-yaml
args: [--unsafe]
- id: check-json
- id: end-of-file-fixer
- id: trailing-whitespace
- id: check-case-conflict
- repo: https://github.com/psf/black
rev: 23.1.0
hooks:
- id: black
additional_dependencies: ['click~=8.1']
args:
- "--line-length=99"
- "--target-version=py38"
- id: black
alias: black-check
stages: [manual]
additional_dependencies: ['click~=8.1']
args:
- "--line-length=99"
- "--target-version=py38"
- "--check"
- "--diff"
- repo: https://github.com/pycqa/flake8
rev: 4.0.1
rev: 6.0.0
hooks:
- id: flake8
- id: flake8
alias: flake8-check
stages: [manual]
- repo: https://github.com/pre-commit/mirrors-mypy
rev: v1.1.1
hooks:
- id: mypy
# N.B.: Mypy is... a bit fragile.
#
# By using `language: system` we run this hook in the local
# environment instead of a pre-commit isolated one. This is needed
# to ensure mypy correctly parses the project.

# It may cause trouble in that it adds environmental variables out
# of our control to the mix. Unfortunately, there's nothing we can
# do about per pre-commit's author.
# See https://github.com/pre-commit/pre-commit/issues/730 for details.
args: [--show-error-codes, --ignore-missing-imports, --explicit-package-bases]
files: ^dbt/adapters/.*
language: system
- id: mypy
alias: mypy-check
stages: [manual]
args: [--show-error-codes, --pretty, --ignore-missing-imports, --explicit-package-bases]
files: ^dbt/adapters
language: system
9 changes: 6 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,17 +1,20 @@
## Unreleased (TBD)

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

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

### Contributors
- [@lpezet](https://github.com/lpezet) ([#146](https://github.com/dbeatty10/dbt-mysql/pull/146), [#144](https://github.com/dbeatty10/dbt-mysql/issues/144))
- [@lpezet](https://github.com/lpezet) ([#146](https://github.com/dbeatty10/dbt-mysql/pull/146))
- [@moszutij](https://github.com/moszutij) ([#146](https://github.com/dbeatty10/dbt-mysql/pull/146), [#144](https://github.com/dbeatty10/dbt-mysql/issues/144))
- [@wesen](https://github.com/wesen) ([#146](https://github.com/dbeatty10/dbt-mysql/pull/146))
- [@mwallace582](https://github.com/mwallace582) ([#162](https://github.com/dbeatty10/dbt-mysql/pull/162))
- [@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))


## dbt-mysql 1.1.0 (Feb 5, 2023)
Expand Down
19 changes: 16 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,26 @@ dev-uninstall: ## Uninstalls all packages while maintaining the virtual environm
pip freeze | grep -v "^-e" | cut -d "@" -f1 | xargs pip uninstall -y
pip uninstall -y dbt-mysql

.PHONY: mypy
mypy: ## Runs mypy against staged changes for static type checking.
@\
pre-commit run --hook-stage manual mypy-check | grep -v "INFO"

.PHONY: flake8
flake8: ## Runs flake8 against staged changes to enforce style guide.
@\
pre-commit run --hook-stage manual flake8-check | grep -v "INFO"

.PHONY: black
black: ## Runs black against staged changes to enforce style guide.
@\
pre-commit run --hook-stage manual black-check -v | grep -v "INFO"

.PHONY: lint
lint: ## Runs flake8 code checks against staged changes.
lint: ## Runs flake8 and mypy code checks against staged changes.
@\
pre-commit run flake8-check --hook-stage manual | grep -v "INFO";
pre-commit run flake8-check --hook-stage manual | grep -v "INFO"; \
pre-commit run mypy-check --hook-stage manual | grep -v "INFO"

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

.PHONY: integration
integration: ## Runs mysql integration tests with py38.
Expand Down
10 changes: 5 additions & 5 deletions RELEASE.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,15 @@
1. Open a branch for the release
- `git checkout -b releases/1.5.0`
1. Update [`CHANGELOG.md`](CHANGELOG.md) with the most recent changes
1. Bump the version using [`bump2version`](https://github.com/c4urself/bump2version/#bump2version):
1. Dry run first by running `bumpversion --dry-run --verbose --new-version <desired-version> <part>`. Some examples:
1. Bump the version using [`bump-my-version`](https://github.com/callowayproject/bump-my-version):
1. Dry run first by running `bump-my-version bump --dry-run --verbose --new-version <desired-version> <part>`. Some examples:
- Release candidates: `--new-version 1.5.0rc1 num`
- Alpha releases: `--new-version 1.5.0a1 num`
- Patch releases: `--new-version 1.5.1 patch`
- Minor releases: `--new-version 1.5.0 minor`
- Major releases: `--new-version 2.0.0 major`
1. Actually modify the files: `bumpversion --no-tag --new-version <desired-version> <part>`. An example:
- Minor releases: `bumpversion --no-tag --new-version 1.5.0 minor`
1. Actually modify the files: `bump-my-version bump --no-tag --new-version <desired-version> <part>`. An example:
- Minor releases: `bump-my-version bump --no-tag --new-version 1.5.0 minor`
1. Check the diff with `git diff`
1. Add the files that were changed with `git add --update`
1. Commit with message `Release dbt-mysql v<desired-version>`
Expand Down Expand Up @@ -60,7 +60,7 @@ PyPI recognizes [pre-release versioning conventions](https://packaging.python.or
- `git pull`
- `git checkout -b bump-1.6.0a1`
- Minor releases:
`bumpversion --no-tag --new-version 1.6.0a1 num`
`bump-my-version bump --no-tag --new-version 1.6.0a1 num`
- Update the branch names in `dev-requirements.txt` from `@{previous-version}.latest` to `@{minor-version}.latest` (or `@main`)
- Commit with message `Bump dbt-mysql 1.6.0a1`
- `git push`
2 changes: 1 addition & 1 deletion dbt/adapters/mariadb/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@


Plugin = AdapterPlugin(
adapter=MariaDBAdapter,
adapter=MariaDBAdapter, # type: ignore[arg-type]
credentials=MariaDBCredentials,
include_path=mariadb.PACKAGE_PATH,
)
2 changes: 1 addition & 1 deletion dbt/adapters/mariadb/__version__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version = "1.4.0a1"
version = "1.7.0a1"
8 changes: 8 additions & 0 deletions dbt/adapters/mariadb/column.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,14 @@

@dataclass
class MariaDBColumn(Column):
TYPE_LABELS = {
"STRING": "TEXT",
"VAR_STRING": "TEXT",
"LONG": "INTEGER",
"LONGLONG": "INTEGER",
"INT": "INTEGER",
"TIMESTAMP": "DATETIME",
}
table_database: Optional[str] = None
table_schema: Optional[str] = None
table_name: Optional[str] = None
Expand Down
Loading

0 comments on commit cfd275c

Please sign in to comment.