-
-
Notifications
You must be signed in to change notification settings - Fork 60
✨ MySQL Unix socket connection support #137
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
Conversation
WalkthroughA new command-line option and supporting logic were introduced to allow specifying a MySQL Unix socket file for connections in the Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant CLI
participant SQLite3toMySQL
participant MySQL
User->>CLI: Run with --mysql-socket PATH
CLI->>SQLite3toMySQL: Instantiate with mysql_socket=PATH
SQLite3toMySQL->>Filesystem: Validate PATH exists
SQLite3toMySQL->>MySQL: Connect using unix_socket=PATH
MySQL-->>SQLite3toMySQL: Connection established via socket
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (21)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
📜 Review details
Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (6)
README.md
(1 hunks)docs/README.rst
(1 hunks)src/sqlite3_to_mysql/cli.py
(3 hunks)src/sqlite3_to_mysql/transporter.py
(2 hunks)src/sqlite3_to_mysql/types.py
(2 hunks)tests/unit/types_test.py
(4 hunks)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (21)
- GitHub Check: Test (python3.13, mysql:5.7, 0, false, 3.13)
- GitHub Check: Test (python3.10, mysql:5.7, 0, false, 3.10)
- GitHub Check: Test (python3.11, mariadb:11.8, 0, false, 3.11)
- GitHub Check: Test (python3.9, mariadb:11.4, 0, false, 3.9)
- GitHub Check: Test (python3.10, mariadb:11.8, 0, false, 3.10)
- GitHub Check: Test (python3.12, mariadb:11.8, 0, false, 3.12)
- GitHub Check: Test (python3.11, mariadb:10.11, 0, false, 3.11)
- GitHub Check: Test (python3.10, mariadb:10.11, 0, false, 3.10)
- GitHub Check: Test (python3.9, mariadb:10.11, 0, false, 3.9)
- GitHub Check: Test (python3.9, mariadb:10.6, 0, false, 3.9)
- GitHub Check: Test (python3.12, mariadb:10.6, 0, false, 3.12)
- GitHub Check: Test (python3.10, mariadb:10.6, 0, false, 3.10)
- GitHub Check: Test (python3.13, mariadb:5.5, 1, false, 3.13)
- GitHub Check: Test (python3.10, mariadb:10.0, 1, false, 3.10)
- GitHub Check: Test (python3.11, mariadb:5.5, 1, false, 3.11)
- GitHub Check: Test (python3.10, mariadb:5.5, 1, false, 3.10)
- GitHub Check: Test (python3.9, mariadb:10.0, 1, false, 3.9)
- GitHub Check: Test (python3.11, mariadb:10.0, 1, false, 3.11)
- GitHub Check: Test (python3.12, mariadb:5.5, 1, false, 3.12)
- GitHub Check: Test (python3.9, mariadb:5.5, 1, false, 3.9)
- GitHub Check: Codacy Static Code Analysis
🔇 Additional comments (10)
docs/README.rst (1)
32-32
: Documentation looks good.The new socket option is properly documented with a clear description.
README.md (1)
52-52
: Documentation is consistent and clear.The CLI option documentation follows the established format and provides a clear description.
src/sqlite3_to_mysql/cli.py (2)
147-147
: Parameter typing is correct.The optional string typing for
mysql_socket
is appropriate.
194-194
: Parameter passing looks correct.The
mysql_socket
parameter is properly passed to theSQLite3toMySQL
constructor.tests/unit/types_test.py (2)
26-26
: Test parameter coverage is comprehensive.The addition of
mysql_socket
to the test parameters and corresponding assertion provides proper test coverage for the new functionality.Also applies to: 54-54
95-95
: Test attribute coverage is thorough.The mock class properly includes the
_mysql_socket
attribute and the assertion validates its presence and value correctly.Also applies to: 135-135
src/sqlite3_to_mysql/types.py (2)
23-23
: New mysql_socket field is properly typed.The optional typing and PathLike support are consistent with similar fields in the TypedDict.
52-53
: No issues found with making_mysql_port
optionalI’ve searched every reference to
_mysql_port
andmysql_port
in the codebase:• In
transporter.py
,_mysql_port
is always defaulted to3306
(viakwargs.get("mysql_port", 3306) or 3306
) and only set toNone
in the Unix‐socket branch, whereunix_socket
is supplied.
• The only other use is passingport=self._mysql_port
into the connector; no arithmetic or assumptions are made on it.
• All unit and functional tests that set or assert on_mysql_port
use concrete integers, and there are no code paths that dereference it without checking the socket case.Optional[int] for
_mysql_port
therefore does not introduce any breaking changes.src/sqlite3_to_mysql/transporter.py (2)
78-85
: Well-implemented socket validation and mutual exclusivity logic.The socket parameter handling is robust and follows good practices:
- Early validation with appropriate error handling
- Proper use of
realpath
for resolving symlinks- Enforcement of mutual exclusivity by setting
mysql_port
toNone
- Consistent with the existing codebase patterns
156-156
: Correct implementation of Unix socket connection parameter.The addition of the
unix_socket
parameter to the MySQL connection is properly implemented according to themysql.connector
API.
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #137 +/- ##
==========================================
- Coverage 95.78% 95.11% -0.68%
==========================================
Files 8 8
Lines 664 675 +11
==========================================
+ Hits 636 642 +6
- Misses 28 33 +5 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
This pull request introduces support for specifying a MySQL Unix socket file in the
sqlite3_to_mysql
tool. The changes include updates to the CLI, internal logic, and test cases to accommodate this new feature.New Feature: MySQL Unix Socket Support
CLI Updates:
--mysql-socket
option to the CLI for specifying the path to a MySQL Unix socket file. This option is mutually exclusive with the--mysql-port
option. (README.md
[1]docs/README.rst
[2]src/sqlite3_to_mysql/cli.py
[3] [4] [5]Internal Logic:
SQLite3toMySQLParams
andSQLite3toMySQLAttributes
classes to include amysql_socket
attribute. (src/sqlite3_to_mysql/types.py
[1] [2]SQLite3toMySQL
transporter to handle themysql_socket
parameter. If a socket is provided, it overrides themysql_port
setting. Validation ensures the socket file exists. (src/sqlite3_to_mysql/transporter.py
[1] [2]Testing Enhancements:
mysql_socket
parameter, ensuring proper handling and validation. (tests/unit/types_test.py
[1] [2] [3] [4]Supersedes #129