Skip to content

✨ add --mysql-skip-create-tables and --mysql-skip-transfer-data options #117

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

Merged
merged 12 commits into from
Jun 9, 2024

Conversation

techouse
Copy link
Owner

@techouse techouse commented Jun 7, 2024

Description

Add 2 new options:

  • -K, --mysql-skip-create-tables Skip creating tables in MySQL.
  • -J, --mysql-skip-transfer-data Skip transferring data to MySQL.

Type of change

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

How Has This Been Tested?

  • added CLI tests

Checklist:

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • 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

@techouse techouse added the enhancement New feature or request label Jun 7, 2024
@techouse techouse self-assigned this Jun 7, 2024
Copy link

coderabbitai bot commented Jun 7, 2024

Warning

Rate limit exceeded

@techouse has exceeded the limit for the number of commits or files that can be reviewed per hour. Please wait 11 minutes and 2 seconds before requesting another review.

How to resolve this issue?

After the wait time has elapsed, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans have higher rate limits than the trial, open-source and free plans. In all cases, we re-allow further reviews after a brief timeout.

Please see our FAQ for further information.

Commits

Files that changed from the base of the PR and between 5c5b248 and cfdf2af.

Walkthrough

The recent updates to the sqlite3mysql tool include version information updates, reordering of options, and the addition of new functionalities to skip table creation and data transfer in MySQL. These changes enhance the tool's flexibility and usability, allowing users to have more control over the data migration process.

Changes

Files Change Summary
README.md Updated version info, reordered options for --mysql-insert-method and --mysql-text-type, added new options -K and -J.
docs/README.rst Added new options for MySQL connection and transfer, modified existing options, and provided detailed descriptions.
src/sqlite3_to_mysql/cli.py Added logic for new options -K and -J, updated CLI function to handle these options.
src/sqlite3_to_mysql/transporter.py Added conditional checks for new options, updated table creation and data transfer logic.
src/sqlite3_to_mysql/types.py Included new attributes mysql_create_tables and mysql_transfer_data in parameter classes.
tests/func/test_cli.py Added new test methods to verify the functionality of -K and -J options.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant CLI
    participant SQLite3toMySQL
    participant MySQL

    User ->> CLI: Run sqlite3mysql with -K or -J
    CLI ->> SQLite3toMySQL: Initialize with options
    SQLite3toMySQL -->> CLI: Return instance
    CLI ->> SQLite3toMySQL: Invoke transfer method
    alt mysql_skip_create_tables
        SQLite3toMySQL --x MySQL: Skip table creation
    end
    alt mysql_skip_transfer_data
        SQLite3toMySQL --x MySQL: Skip data transfer
    end
    SQLite3toMySQL ->> User: Process completed
Loading

Poem

In the land of data, a bunny so bright,
Tweaked the tool with all its might.
Skip tables here, skip data there,
Flexibility now, beyond compare.
With options new, and order neat,
Migration's now a simpler feat.
Cheers to changes, hip-hip-hooray,
For sqlite3mysql, a brighter day! 🐇🎉


Thank you for using CodeRabbit. We offer it for free to the OSS community and would appreciate your support in helping us grow. If you find it useful, would you consider giving us a shout-out on your favorite social media?

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>.
    • Generate unit testing code for this file.
    • 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 generate unit testing code for this file.
    • @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 generate interesting stats about this repository and render them as a table.
    • @coderabbitai show all the console.log statements in this repository.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @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.

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 as 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 resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Additionally, you can add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.

CodeRabbit Configration 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.

Copy link

codecov bot commented Jun 7, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.44%. Comparing base (b0569ce) to head (cfdf2af).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #117      +/-   ##
==========================================
+ Coverage   88.16%   88.44%   +0.28%     
==========================================
  Files           8        8              
  Lines         642      658      +16     
==========================================
+ Hits          566      582      +16     
  Misses         76       76              

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

@techouse techouse changed the title ✨ add --mysql-skip-create-table and --mysql-skip-transfer-data options ✨ add --mysql-skip-create-tables and --mysql-skip-transfer-data options Jun 8, 2024
@techouse techouse marked this pull request as ready for review June 8, 2024 11:23
Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 3

Outside diff range and nitpick comments (1)
README.md (1)

Line range hint 21-21: Please correct the heading level from h4 to h3 to maintain a proper incremental sequence in the document structure.

-#### A simple Python tool to transfer data from SQLite 3 to MySQL.
+### A simple Python tool to transfer data from SQLite 3 to MySQL.
Tools
Markdownlint

32-32: null (MD040, fenced-code-language)
Fenced code blocks should have a language specified

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between b0569ce and 2170415.

Files selected for processing (6)
  • README.md (4 hunks)
  • docs/README.rst (1 hunks)
  • src/sqlite3_to_mysql/cli.py (4 hunks)
  • src/sqlite3_to_mysql/transporter.py (2 hunks)
  • src/sqlite3_to_mysql/types.py (2 hunks)
  • tests/func/test_cli.py (1 hunks)
Additional context used
LanguageTool
README.md

[locale-violation] ~5-~5: license must be spelled with a “c” when used as a noun in British English. Use “licence”. (LICENCE_LICENSE_NOUN_SINGULAR)
Context: ...10.2+|+10.3+|+10.4+|+10.5&color=C0765A) [![GitHub license](https://img.shields.io/github/license/...

Markdownlint
README.md

21-21: Expected: h2; Actual: h4 (MD001, heading-increment)
Heading levels should only increment by one level at a time


32-32: null (MD040, fenced-code-language)
Fenced code blocks should have a language specified

GitHub Check: codecov/patch
src/sqlite3_to_mysql/transporter.py

[warning] 137-137: src/sqlite3_to_mysql/transporter.py#L137
Added line #L137 was not covered by tests


[warning] 698-698: src/sqlite3_to_mysql/transporter.py#L698
Added line #L698 was not covered by tests

Additional comments not posted (11)
src/sqlite3_to_mysql/types.py (2)

29-31: The addition of mysql_create_tables and mysql_transfer_data as optional parameters is well-aligned with the new CLI options. Good job maintaining consistency with the tool's flexible configuration.


59-61: The implementation of _mysql_create_tables and _mysql_transfer_data as boolean attributes ensures that these settings are explicitly managed at runtime, which is a robust approach.

docs/README.rst (2)

29-31: The addition of MySQL host, port, and SSL configuration options in the documentation is clear and informative, providing necessary details for users configuring database connections.


36-48: The documentation for the new transfer options, including conditions for table-specific transfers and data handling strategies, is comprehensive and enhances the tool's usability for advanced scenarios.

README.md (1)

Line range hint 35-79: The updates to the version information and the addition of new CLI options are well-documented, ensuring users are aware of the new functionalities and their usage.

src/sqlite3_to_mysql/cli.py (1)

Line range hint 123-175: The implementation of the new CLI options to skip table creation and data transfer is correct. The added logic to handle cases where both options are set, ensuring the tool does not proceed when there is no action to be performed, is a robust safeguard.

tests/func/test_cli.py (3)

214-236: The test test_mysql_skip_create_tables correctly invokes the CLI with the --mysql-skip-create-tables option and checks for a successful exit code. This is a good practice to ensure the new feature behaves as expected under normal conditions.


237-258: The test test_mysql_skip_transfer_data properly tests the functionality of the --mysql-skip-transfer-data option. It verifies that the application exits successfully when this option is used, which aligns with the expected behaviour.


260-286: The test test_mysql_skip_create_tables_and_transfer_data effectively checks the scenario where both skip options are enabled, and correctly asserts that the application should exit with an error. This is crucial for preventing user errors in real-world usage.

src/sqlite3_to_mysql/transporter.py (2)

133-138: The implementation of the new options mysql_create_tables and mysql_transfer_data in the constructor is correct. The conditional check that raises an exception if both are false is a good safeguard to prevent no-op scenarios.

Tools
GitHub Check: codecov/patch

[warning] 137-137: src/sqlite3_to_mysql/transporter.py#L137
Added line #L137 was not covered by tests


686-698: The conditional logic to create tables or transfer data based on the new CLI options is correctly implemented. This allows for flexible operation modes which can be very useful in different deployment scenarios.

Tools
GitHub Check: codecov/patch

[warning] 698-698: src/sqlite3_to_mysql/transporter.py#L698
Added line #L698 was not covered by tests

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

Review details

Configuration used: CodeRabbit UI
Review profile: CHILL

Commits

Files that changed from the base of the PR and between 2170415 and 5c5b248.

Files selected for processing (3)
  • src/sqlite3_to_mysql/transporter.py (4 hunks)
  • tests/func/sqlite3_to_mysql_test.py (1 hunks)
  • tests/func/test_cli.py (1 hunks)
Files skipped from review as they are similar to previous changes (2)
  • src/sqlite3_to_mysql/transporter.py
  • tests/func/test_cli.py
Additional comments not posted (1)
tests/func/sqlite3_to_mysql_test.py (1)

203-229: The test method test_mysql_skip_create_tables_and_transfer_data correctly simulates the scenario where both table creation and data transfer are skipped, and it properly asserts that a ValueError is raised. This aligns well with the new functionality introduced in the PR.

@techouse techouse merged commit d6c619c into master Jun 9, 2024
71 checks passed
@techouse techouse deleted the feat/only-tables-only-data branch June 9, 2024 08:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant