FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

fix(mysql): add dialect parameter instead of hardcoded mysql dialect by nightblure · Pull Request #739 · testcontainers/testcontainers-python · GitHub

fix(mysql): add dialect parameter instead of hardcoded mysql dialect - #739

Merged
totallyzen merged 14 commits into
testcontainers:mainfrom
nightblure:fix-hardcoded-mysql-dialect
Dec 12, 2024
Merged

fix(mysql): add dialect parameter instead of hardcoded mysql dialect#739
totallyzen merged 14 commits into
testcontainers:mainfrom
nightblure:fix-hardcoded-mysql-dialect

Conversation

nightblure commented Nov 18, 2024
edited
Loading

Copy link
Copy Markdown
Contributor

closes #727

  • add parameter dialect;
  • tests fixing and add some assertions

nightblure marked this pull request as draft November 18, 2024 21:58
nightblure marked this pull request as ready for review November 18, 2024 22:00

nightblure commented Nov 19, 2024
edited
Loading

Copy link
Copy Markdown
Contributor Author

@totallyzen hi! sorry for the unnecessary trouble but I fixed it. please look at the changes

codecov Bot commented Nov 19, 2024
edited
Loading

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Please upload report for BASE (main@3436cbf). Learn more about missing BASE report.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #739   +/-   ##
=======================================
  Coverage        ?   84.77%           
=======================================
  Files           ?       12           
  Lines           ?      670           
  Branches        ?      105           
=======================================
  Hits            ?      568           
  Misses          ?       79           
  Partials        ?       23           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

)

def get_connection_url(self) -> str:
dialect = "mysql" if self.dialect is None else f"mysql+{self.dialect}"

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

I think you should put this simply in the init when you set self.dialect.

It would effectively become:

self.dialect = dialect or environ.get("MYSQL_DIALECT") or "mysql"

also I think dialect="mysql+asdf" makes more sense than dialect="asdf"

nightblure Nov 20, 2024
edited
Loading

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

moving to init is a good idea

but it is inconvenient for the user to create the string "mysql+asdf"

IMO dialect is a specific extension that comes after "mysql". Why repeat “mysql” everywhere if we already know that we are connecting to mysql?

besides, someone might make a typo

nightblure Nov 20, 2024
edited
Loading

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

@totallyzen Not that this is an argument, but it was interesting to look at the current implementation of the postgresql container, and it is done according to the principle that I proposed. what do you think?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

and it is done according to the principle that I proposed. what do you think?

sure I don't mind - maybe then validate the dialect does not start with mysql (raise a ValueError) then I'm happy :)

nightblure Nov 20, 2024
edited
Loading

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

ready to make this check what proposed @balint-backmaker if you approve it @totallyzen, fine?

totallyzen Nov 21, 2024
edited
Loading

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

oops, sorry for the mix - commented from the company account and not my personal 😅
(balint-backmaker is the company account, I do not normally use that here)

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

@totallyzen did it in last commit

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

@totallyzen ping)

Copy link
Copy Markdown
Contributor

hi! sorry for the delays, I'll do one more review and merge it for you.

totallyzen left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

small window for error: MYSQL_DIALECT can still be mysql+something and it will break tests. But I think it's good enough like this. I'll merge and release this for you and you can raise another patch for the bug above

totallyzen merged commit 8d77bd3 into testcontainers:main Dec 12, 2024
alexanderankin pushed a commit that referenced this pull request Jan 21, 2025
🤖 I have created a release *beep* *boop*
---


##
[4.9.1](testcontainers-v4.9.0...testcontainers-v4.9.1)
(2025-01-21)


### Bug Fixes

* milvus healthcheck: use correct requests errors
([#759](#759))
([78b137c](78b137c))
* **mysql:** add dialect parameter instead of hardcoded mysql dialect
([#739](#739))
([8d77bd3](8d77bd3))
* **tests:** replace dind-test direct docker usage with sdk
([#750](#750))
([ace2a7d](ace2a7d))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Bug: hardcoded dialect/driver parameter in connection url in mysql container

3 participants


Back | FazBrowse Home | New Git URL