sqlite3-to-mysql icon indicating copy to clipboard operation
sqlite3-to-mysql copied to clipboard

:sparkles: added a --mysql-socket option to connect to MySQL using a Unix socket

Open mackuba opened this issue 1 year ago • 2 comments

Description

This adds a --mysql-socket option to the CLI which passes a unix_socket parameter to the MySQL Connector, which lets you connect using a Unix socket instead of a TCP port.

Type of change

  • [ ] Bug fix (non-breaking change which fixes an issue)
  • [x] New feature (non-breaking change which adds functionality)
  • [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • [ ] This change requires a documentation update

How Has This Been Tested?

Tested with my local database with disabled networking (MacPorts default), with and without the option --mysql-socket /opt/local/var/run/mysql8/mysqld.sock.

Checklist:

  • [x] My code follows the style guidelines of this project
  • [x] I have performed a self-review of my own code
  • [ ] I have commented my code, particularly in hard-to-understand areas
  • [x] I have made corresponding changes to the documentation
  • [x] My changes generate no new warnings
  • [ ] I have added tests that prove my fix is effective or that my feature works
  • [ ] New and existing unit tests pass locally with my changes
  • [ ] Any dependent changes have been merged and published in downstream modules

mackuba avatar Oct 23 '24 16:10 mackuba

[!IMPORTANT]

Review skipped

Draft detected.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

The changes introduced in this pull request add a new command-line option, --mysql-socket TEXT, to the sqlite3mysql tool, allowing users to specify the path to the MySQL Unix socket file. This update is reflected in the command-line interface, relevant documentation, and associated code, enhancing the tool's flexibility for MySQL database connections. The modifications include updates to the cli function, the SQLite3toMySQL class, and the documentation, ensuring that the new option is properly integrated and documented without altering existing functionalities.

Changes

File Change Summary
README.md, docs/README.rst Added new command-line option --mysql-socket TEXT for specifying MySQL Unix socket path.
src/sqlite3_to_mysql/cli.py Introduced --mysql-socket option in cli function and updated method signature accordingly.
src/sqlite3_to_mysql/transporter.py Added _mysql_socket instance variable to SQLite3toMySQL class for handling Unix socket in MySQL connection.
src/sqlite3_to_mysql/types.py Added mysql_socket field to SQLite3toMySQLParams and _mysql_socket attribute to SQLite3toMySQLAttributes.

Possibly related PRs

  • #117: The changes in this PR involve modifications to the command-line interface of the sqlite3mysql tool, specifically adding new options related to MySQL operations, which may interact with the newly introduced --mysql-socket option in the main PR.

Poem

🐇 In the realm of code, a socket's new path,
A command-line option, to ease the user's math.
With --mysql-socket, connections now flow,
To MySQL's heart, where data can grow.
Hopping through changes, we celebrate bright,
A tool more flexible, oh what a delight! 🌟


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.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need 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)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

coderabbitai[bot] avatar Oct 24 '24 07:10 coderabbitai[bot]

Good idea 😇

Could you please look at the comments CodeRabbit made? They seem quite valid.

Also, since this is a new feature, could you please add some tests?

techouse avatar Oct 24 '24 07:10 techouse

Superseeded by https://github.com/techouse/sqlite3-to-mysql/pull/137

techouse avatar Jul 13 '25 14:07 techouse