Skip to content

Commit 09e076f

Browse files
mwallace582lpezetdbeatty10sagunn-echokzajaczkowski
authored
Mwallace/merge 1.7 to main (#175)
* 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 * 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 <99990724+sagunn-echo@users.noreply.github.com> * 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 <github@matthewwallace.me> * Add collation and charset support for mariadb and mysql5 --------- Co-authored-by: Matthew Wallace <github@matthewwallace.me> * 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 <lpezet@gmail.com> Co-authored-by: Doug Beatty <doug.beatty@dbtlabs.com> Co-authored-by: Scott Gunn <99990724+sagunn-echo@users.noreply.github.com> Co-authored-by: Krzysztof Zajączkowski <65259263+kzajaczkowski@users.noreply.github.com>
1 parent cfd275c commit 09e076f

File tree

7 files changed

+32
-4
lines changed

7 files changed

+32
-4
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@
99

1010
### Fixes
1111
- Fix incremental composite keys ([#144](https://github.com/dbeatty10/dbt-mysql/issues/144))
12+
- Fix UnicodeDecodeErorr on setup.py ([#160](https://github.com/dbeatty10/dbt-mysql/issues/160))
1213

1314
### Contributors
1415
- [@lpezet](https://github.com/lpezet) ([#146](https://github.com/dbeatty10/dbt-mysql/pull/146))
1516
- [@moszutij](https://github.com/moszutij) ([#146](https://github.com/dbeatty10/dbt-mysql/pull/146), [#144](https://github.com/dbeatty10/dbt-mysql/issues/144))
1617
- [@wesen](https://github.com/wesen) ([#146](https://github.com/dbeatty10/dbt-mysql/pull/146))
1718
- [@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))
19+
- [@sagunn-echo](https://github.com/sagunn-echo) ([#160](https://github.com/dbeatty10/dbt-mysql/issues/160))
1820

1921

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

README.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,17 +86,21 @@ your_profile_name:
8686
username: your_mysql_username
8787
password: your_mysql_password
8888
ssl_disabled: True
89+
charset: utf8mb4
90+
collation: utf8mb4_0900_ai_ci
8991
```
9092

9193
| Option | Description | Required? | Example |
9294
| --------------- | ----------------------------------------------------------------------------------- | ------------------------------------------------------------------ | ---------------------------------------------- |
93-
| type | The specific adapter to use | Required | `mysql`, `mysql5` or `mariadb` |
95+
| type | The specific adapter to use | Required | `mysql`, `mysql5` or `mariadb` |
9496
| server | The server (hostname) to connect to | Required | `yourorg.mysqlhost.com` |
9597
| port | The port to use | Optional | `3306` |
9698
| schema | Specify the schema (database) to build models into | Required | `analytics` |
9799
| username | The username to use to connect to the server | Required | `dbt_admin` |
98100
| password | The password to use for authenticating to the server | Required | `correct-horse-battery-staple` |
99101
| ssl_disabled | Set to enable or disable TLS connectivity to mysql5.x | Optional | `True` or `False` |
102+
| charset | Specify charset to be used by a connection | Optional | `utf8mb4` |
103+
| collation | Set to enable or disable TLS connectivity to mysql5.x | Optional | `utf8mb4_0900_ai_ci` |
100104

101105
### Notes
102106

dbt/adapters/mariadb/connections.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ class MariaDBCredentials(Credentials):
2626
password: Optional[str] = None
2727
charset: Optional[str] = None
2828
ssl_disabled: Optional[bool] = None
29+
collation: Optional[str] = None
2930

3031
_ALIASES = {
3132
"UID": "username",
@@ -98,6 +99,12 @@ def open(cls, connection):
9899
if credentials.port:
99100
kwargs["port"] = credentials.port
100101

102+
if credentials.charset:
103+
kwargs["charset"] = credentials.charset
104+
105+
if credentials.collation:
106+
kwargs["collation"] = credentials.collation
107+
101108
try:
102109
connection.handle = mysql.connector.connect(**kwargs)
103110
connection.state = "open"

dbt/adapters/mysql/connections.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ class MySQLCredentials(Credentials):
2525
username: Optional[str] = None
2626
password: Optional[str] = None
2727
charset: Optional[str] = None
28+
collation: Optional[str] = None
2829

2930
_ALIASES = {
3031
"UID": "username",
@@ -94,6 +95,12 @@ def open(cls, connection):
9495
if credentials.port:
9596
kwargs["port"] = credentials.port
9697

98+
if credentials.charset:
99+
kwargs["charset"] = credentials.charset
100+
101+
if credentials.collation:
102+
kwargs["collation"] = credentials.collation
103+
97104
try:
98105
connection.handle = mysql.connector.connect(**kwargs)
99106
connection.state = "open"

dbt/adapters/mysql5/connections.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ class MySQLCredentials(Credentials):
2626
password: Optional[str] = None
2727
charset: Optional[str] = None
2828
ssl_disabled: Optional[bool] = None
29+
collation: Optional[str] = None
2930

3031
_ALIASES = {
3132
"UID": "username",
@@ -98,6 +99,12 @@ def open(cls, connection):
9899
if credentials.port:
99100
kwargs["port"] = credentials.port
100101

102+
if credentials.charset:
103+
kwargs["charset"] = credentials.charset
104+
105+
if credentials.collation:
106+
kwargs["collation"] = credentials.collation
107+
101108
try:
102109
connection.handle = mysql.connector.connect(**kwargs)
103110
connection.state = "open"

dev-requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,10 @@ git+https://github.com/dbt-labs/dbt-core.git@1.7.latest#egg=dbt-tests-adapter&su
55

66
# if version 1.x or greater -> pin to major version
77
# if version 0.x -> pin to minor
8-
black~=22.12
8+
black~=24.3
99
bumpversion~=0.6.0
1010
ddtrace~=2.3
11+
jsonschema<=4.17
1112
flake8~=6.1
1213
flaky~=3.7
1314
freezegun~=1.3

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424

2525
# pull long description from README
2626
this_directory = os.path.abspath(os.path.dirname(__file__))
27-
with open(os.path.join(this_directory, "README.md")) as f:
27+
with open(os.path.join(this_directory, "README.md"), encoding="utf-8") as f:
2828
long_description = f.read()
2929

3030

@@ -68,7 +68,7 @@ def _get_dbt_core_version():
6868
include_package_data=True,
6969
install_requires=[
7070
"dbt-core~={}".format(dbt_core_version),
71-
"mysql-connector-python>=8.0.0,<8.1",
71+
"mysql-connector-python>=8.0.0",
7272
],
7373
zip_safe=False,
7474
classifiers=[

0 commit comments

Comments
 (0)