-
-
Notifications
You must be signed in to change notification settings - Fork 35
✨ transfer MySQL views as native SQLite views #110
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
Changes from 2 commits
Commits
Show all changes
10 commits
Select commit
Hold shift + click to select a range
19b1cfe
:sparkles: add support for MySQL views in SQLite transfer and impleme…
techouse cd0cb65
:sparkles: add option to materialize MySQL views as SQLite tables
techouse f63c850
:white_check_mark: add tests for handling MySQL views and ensure prop…
techouse 91b3a51
:sparkles: enhance SHOW CREATE VIEW handling to escape backticks and …
techouse fdc7115
:white_check_mark: add test for SHOW CREATE VIEW fallback to handle n…
techouse b8918f0
:bug: fix reconnection logic and enhance error handling in view creation
techouse 554559c
:white_check_mark: add tests for reconnecting and error handling in v…
techouse 911948c
:white_check_mark: refactor test_translate_default_bool_non_boolean_t…
techouse f85e393
:white_check_mark: refactor test for view creation to use pytest.rais…
techouse 2b6e2ee
:white_check_mark: refactor test to use pytest.raises for sqlite3.Err…
techouse File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,68 @@ | ||
| import typing as t | ||
|
|
||
| import pytest | ||
| from click.testing import CliRunner | ||
|
|
||
| from mysql_to_sqlite3.cli import cli as mysql2sqlite | ||
|
|
||
|
|
||
| class TestCLIViewsFlag: | ||
| def test_mysql_views_as_tables_flag_is_threaded(self, monkeypatch: pytest.MonkeyPatch) -> None: | ||
| """Ensure --mysql-views-as-tables reaches MySQLtoSQLite as views_as_views=False (legacy materialization).""" | ||
| received_kwargs: t.Dict[str, t.Any] = {} | ||
|
|
||
| class FakeConverter: | ||
| def __init__(self, **kwargs: t.Any) -> None: | ||
| received_kwargs.update(kwargs) | ||
|
|
||
| def transfer(self) -> None: # pragma: no cover - nothing to do | ||
| return None | ||
|
|
||
| # Patch the converter used by the CLI | ||
| monkeypatch.setattr("mysql_to_sqlite3.cli.MySQLtoSQLite", FakeConverter) | ||
|
|
||
| runner = CliRunner() | ||
| result = runner.invoke( | ||
| mysql2sqlite, | ||
| [ | ||
| "-f", | ||
| "out.sqlite3", | ||
| "-d", | ||
| "db", | ||
| "-u", | ||
| "user", | ||
| "--mysql-views-as-tables", | ||
| ], | ||
| ) | ||
| assert result.exit_code == 0 | ||
| assert received_kwargs.get("views_as_views") is False | ||
|
|
||
| def test_mysql_views_as_tables_short_flag_is_threaded(self, monkeypatch: pytest.MonkeyPatch) -> None: | ||
| """Ensure -T (short for --mysql-views-as-tables) reaches MySQLtoSQLite as views_as_views=False.""" | ||
| received_kwargs: t.Dict[str, t.Any] = {} | ||
|
|
||
| class FakeConverter: | ||
| def __init__(self, **kwargs: t.Any) -> None: | ||
| received_kwargs.update(kwargs) | ||
|
|
||
| def transfer(self) -> None: # pragma: no cover - nothing to do | ||
| return None | ||
|
|
||
| # Patch the converter used by the CLI | ||
| monkeypatch.setattr("mysql_to_sqlite3.cli.MySQLtoSQLite", FakeConverter) | ||
|
|
||
| runner = CliRunner() | ||
| result = runner.invoke( | ||
| mysql2sqlite, | ||
| [ | ||
| "-f", | ||
| "out.sqlite3", | ||
| "-d", | ||
| "db", | ||
| "-u", | ||
| "user", | ||
| "-T", | ||
| ], | ||
| ) | ||
| assert result.exit_code == 0 | ||
| assert received_kwargs.get("views_as_views") is False |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.