sqlite3_to_mysql package

Submodules

sqlite3_to_mysql.cli module

The command line interface of SQLite3toMySQL.

sqlite3_to_mysql.click_utils module

Click utilities.

class sqlite3_to_mysql.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.

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

Prompt for password.

sqlite3_to_mysql.debug_info module

Module containing bug report helper(s).

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

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

Generate information for a bug report.

sqlite3_to_mysql.mysql_utils module

MySQL helpers.

class sqlite3_to_mysql.mysql_utils.CharSet(id: int, charset: str, collation: str)[source]

Bases: NamedTuple

MySQL character set as a named tuple.

charset: str

Alias for field number 1

collation: str

Alias for field number 2

id: int

Alias for field number 0

sqlite3_to_mysql.mysql_utils.check_mysql_fulltext_support(version_string: str) bool[source]

Check for FULLTEXT indexing support.

sqlite3_to_mysql.mysql_utils.check_mysql_json_support(version_string: str) bool[source]

Check for MySQL JSON support.

sqlite3_to_mysql.mysql_utils.check_mysql_values_alias_support(version_string: str) bool[source]

Check for VALUES alias support.

Returns:

True if VALUES alias is supported (MySQL 8.0.19+), False for MariaDB or older MySQL versions.

Return type:

bool

sqlite3_to_mysql.mysql_utils.get_mysql_version(version_string: str) Version[source]

Get MySQL version.

sqlite3_to_mysql.mysql_utils.mysql_supported_character_sets(charset: str | None = None) Iterator[CharSet][source]

Get supported MySQL character sets.

sqlite3_to_mysql.mysql_utils.safe_identifier_length(identifier_name: str, max_length: int = 64) str[source]

https://dev.mysql.com/doc/refman/8.0/en/identifier-length.html.

sqlite3_to_mysql.sqlite_utils module

SQLite adapters and converters for unsupported data types.

sqlite3_to_mysql.sqlite_utils.adapt_decimal(value) str[source]

Convert decimal.Decimal to string.

sqlite3_to_mysql.sqlite_utils.adapt_timedelta(value) str[source]

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

sqlite3_to_mysql.sqlite_utils.check_sqlite_table_xinfo_support(version_string: str) bool[source]

Check for SQLite table_xinfo support.

sqlite3_to_mysql.sqlite_utils.convert_date(value: str | bytes) date[source]

Handle SQLite date conversion.

sqlite3_to_mysql.sqlite_utils.convert_decimal(value) Decimal[source]

Convert string to decimalDecimal.

sqlite3_to_mysql.sqlite_utils.convert_timedelta(value) timedelta[source]

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

sqlite3_to_mysql.sqlite_utils.unicase_compare(string_1: str, string_2: str) int[source]

Taken from https://github.com/patarapolw/ankisync2/issues/3#issuecomment-768687431.

sqlite3_to_mysql.transporter module

Use to transfer an SQLite 3 database to MySQL.

class sqlite3_to_mysql.transporter.SQLite3toMySQL(**kwargs: Unpack[SQLite3toMySQLParams])[source]

Bases: SQLite3toMySQLAttributes

Use this class to transfer an SQLite 3 database to MySQL.

COLUMN_LENGTH_PATTERN: Pattern[str] = re.compile('\\(\\d+\\)')
COLUMN_PATTERN: Pattern[str] = re.compile('^[^(]+')
COLUMN_PRECISION_AND_SCALE_PATTERN: Pattern[str] = re.compile('\\(\\d+,\\d+\\)')
COLUMN_UNSIGNED_PATTERN: Pattern[str] = re.compile('\\bUNSIGNED\\b', re.IGNORECASE)
MYSQL_CONNECTOR_VERSION: Version = <Version('9.1.0')>
__init__(**kwargs: Unpack[SQLite3toMySQLParams])[source]

Constructor.

transfer() None[source]

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

sqlite3_to_mysql.types module

Types for sqlite3-to-mysql.

class sqlite3_to_mysql.types.SQLite3toMySQLAttributes[source]

Bases: object

SQLite3toMySQL attributes.

class sqlite3_to_mysql.types.SQLite3toMySQLParams[source]

Bases: TypedDict

SQLite3toMySQL parameters.

chunk: int | None
ignore_duplicate_keys: bool | None
log_file: str | PathLike[Any] | None
mysql_charset: str | None
mysql_collation: str | None
mysql_create_tables: bool | None
mysql_database: str | None
mysql_host: str | None
mysql_insert_method: str | None
mysql_integer_type: str | None
mysql_password: str | bool | None
mysql_port: int | None
mysql_ssl_disabled: bool | None
mysql_string_type: str | None
mysql_text_type: str | None
mysql_transfer_data: bool | None
mysql_truncate_tables: bool | None
mysql_user: str | None
quiet: bool | None
sqlite_file: str | PathLike[Any]
sqlite_tables: Sequence[str] | None
use_fulltext: bool | None
with_rowid: bool | None
without_foreign_keys: bool | None

Module contents

Utility to transfer data from SQLite 3 to MySQL.