mysql_to_sqlite3 package

Submodules

mysql_to_sqlite3.cli module

The command line interface of MySQLtoSQLite.

mysql_to_sqlite3.click_utils module

Click utilities.

class mysql_to_sqlite3.click_utils.OptionEatAll(*args, **kwargs)[source]

Bases: Option

Taken from https://stackoverflow.com/questions/48391777/nargs-equivalent-for-options-in-click#answer-48394004.

__init__(*args, **kwargs)[source]

Override.

add_to_parser(parser, ctx) None[source]

Override.

mysql_to_sqlite3.click_utils.prompt_password(ctx: Context, param: Any, use_password: bool)[source]

Prompt for password.

mysql_to_sqlite3.click_utils.validate_positive_integer(ctx: Context, param: Any, value: int)[source]

Allow only positive integers and 0.

mysql_to_sqlite3.debug_info module

Module containing bug report helper(s).

Adapted from https://github.com/psf/requests/blob/master/requests/help.py

mysql_to_sqlite3.debug_info.info() List[List[str]][source]

Generate information for a bug report.

mysql_to_sqlite3.mysql_utils module

Miscellaneous MySQL utilities.

mysql_to_sqlite3.sqlite_utils module

SQLite adapters and converters for unsupported data types.

class mysql_to_sqlite3.sqlite_utils.CollatingSequences[source]

Bases: object

Taken from https://www.sqlite.org/datatype3.html#collating_sequences.

BINARY: str = 'BINARY'
NOCASE: str = 'NOCASE'
RTRIM: str = 'RTRIM'
mysql_to_sqlite3.sqlite_utils.adapt_decimal(value: Any) str[source]

Convert decimal.Decimal to string.

mysql_to_sqlite3.sqlite_utils.adapt_timedelta(value: Any) str[source]

Convert datetime.timedelta to %H:%M:%S string.

mysql_to_sqlite3.sqlite_utils.convert_date(value: Any) date[source]

Handle SQLite date conversion.

mysql_to_sqlite3.sqlite_utils.convert_decimal(value: Any) Decimal[source]

Convert string to decimal.Decimal.

mysql_to_sqlite3.sqlite_utils.convert_timedelta(value: Any) timedelta[source]

Convert %H:%M:%S string to datetime.timedelta.

mysql_to_sqlite3.sqlite_utils.encode_data_for_sqlite(value: Any) Any[source]

Fix encoding bytes.

mysql_to_sqlite3.transporter module

Use to transfer a MySQL database to SQLite.

class mysql_to_sqlite3.transporter.MySQLtoSQLite(**kwargs: Unpack[MySQLtoSQLiteParams])[source]

Bases: MySQLtoSQLiteAttributes

Use this class to transfer a MySQL database to SQLite.

COLUMN_LENGTH_PATTERN: Pattern[str] = re.compile('\\(\\d+\\)$')
COLUMN_PATTERN: Pattern[str] = re.compile('^[^(]+')
__init__(**kwargs: Unpack[MySQLtoSQLiteParams]) None[source]

Constructor.

transfer() None[source]

The primary and only method with which we transfer all the data.

mysql_to_sqlite3.types module

Types for mysql-to-sqlite3.

class mysql_to_sqlite3.types.MySQLtoSQLiteAttributes[source]

Bases: object

MySQLtoSQLite attributes.

class mysql_to_sqlite3.types.MySQLtoSQLiteParams[source]

Bases: TypedDict

MySQLtoSQLite parameters.

buffered: bool | None
chunk: int | None
collation: str | None
exclude_mysql_tables: Sequence[str] | None
json_as_text: bool | None
limit_rows: int | None
log_file: str | PathLike[Any] | None
mysql_database: str
mysql_host: str
mysql_password: str | bool | None
mysql_port: int
mysql_ssl_disabled: bool | None
mysql_tables: Sequence[str] | None
mysql_user: str
prefix_indices: bool | None
quiet: bool | None
sqlite_file: str | PathLike[Any]
vacuum: bool | None
without_data: bool | None
without_foreign_keys: bool | None
without_tables: bool | None

Module contents

Utility to transfer data from MySQL to SQLite 3.