Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update dbt-core to 1.5 and implement support for model contracts #163

Merged
merged 6 commits into from
Jan 11, 2024

Conversation

mwallace582
Copy link
Collaborator

resolves #145

Description

I've followed the instructions published for updating to dbt-core 1.5 and implemented support for model contracts.

I was able to get all of the new test classes to pass, and model contracts are working as expected for my dbt models.

There's some trickiness with the difference between types that MySQL allows in schemas, and the types that can be passed into calls to CAST(). I've handed some of the obvious cases, but it's possible that there are gaps with more obscure types.

Checklist

  • I have run this code in development and it appears to resolve the stated issue
  • This PR includes tests, or tests are not required/relevant for this PR
  • I have updated the CHANGELOG.md with information about my change

@mwallace582 mwallace582 added the ok to test This pull request can run integration tests label Jan 9, 2024
@mwallace582 mwallace582 changed the base branch from main to 1.5.latest January 9, 2024 17:09
@dbeatty10 dbeatty10 mentioned this pull request Jan 11, 2024
Copy link
Owner

@dbeatty10 dbeatty10 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks awesome.

Figuring out how to workaround casting was a crucial piece.

dbt/include/mariadb/macros/adapters.sql Show resolved Hide resolved
@mwallace582 mwallace582 merged commit 49c9e85 into 1.5.latest Jan 11, 2024
10 checks passed
mwallace582 added a commit that referenced this pull request Jan 17, 2024
* 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]>
mwallace582 added a commit that referenced this pull request Apr 26, 2024
* 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

* Fix unicode decode error (#169)

* Update setup.py

Explicitly defining utf-8 encoding to avoid UnicodeDecodeError on setup.py in Windows environment

* Update CHANGELOG.md

---------

Co-authored-by: Scott Gunn <[email protected]>

* Pin jsonschema version to fix tests (#174)

* Add collation support in profiles.yml / Fix incorrect collation for utf8mb4 (#173)

* Add support for charset and collation in profile.yml

* Change mysql-connect-python version

* Update readme with new profile options

* Update setup.py with less restricting mysql-connector-python version after code review

Co-authored-by: Matthew Wallace <[email protected]>

* Add collation and charset support for mariadb and mysql5

---------

Co-authored-by: Matthew Wallace <[email protected]>

* Pin jsonschema version to fix tests

* Update black to resolve security alert

https://github.com/dbeatty10/dbt-mysql/security/dependabot/5

---------

Co-authored-by: Luke <[email protected]>
Co-authored-by: Doug Beatty <[email protected]>
Co-authored-by: Scott Gunn <[email protected]>
Co-authored-by: Krzysztof Zajączkowski <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
ok to test This pull request can run integration tests
Projects
None yet
Development

Successfully merging this pull request may close these issues.

upgrade to support dbt-core v1.5.0
2 participants