Skip to content

Commit 8863cf6

Browse files
committed
📝 add docs
1 parent 7bf64ef commit 8863cf6

9 files changed

+340
-0
lines changed

docs/Makefile

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Minimal makefile for Sphinx documentation
2+
#
3+
4+
# You can set these variables from the command line, and also
5+
# from the environment for the first two.
6+
SPHINXOPTS ?=
7+
SPHINXBUILD ?= sphinx-build
8+
SOURCEDIR = .
9+
BUILDDIR = _build
10+
11+
# Put it first so that "make" without argument is like "make help".
12+
help:
13+
@$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
14+
15+
.PHONY: help Makefile
16+
17+
# Catch-all target: route all unknown targets to Sphinx using the new
18+
# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
19+
%: Makefile
20+
@$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)

docs/README.rst

Lines changed: 98 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,98 @@
1+
Usage
2+
-----
3+
4+
Options
5+
^^^^^^^
6+
7+
The command line options for the ``mysql2sqlite`` tool are as follows:
8+
9+
.. code-block:: bash
10+
11+
mysql2sqlite [OPTIONS]
12+
13+
Required Options
14+
""""""""""""""""
15+
16+
- ``-f, --sqlite-file PATH``: SQLite3 database file. This option is required.
17+
- ``-d, --mysql-database TEXT``: MySQL database name. This option is required.
18+
- ``-u, --mysql-user TEXT``: MySQL user. This option is required.
19+
20+
Password Options
21+
""""""""""""""""
22+
23+
- ``-p, --prompt-mysql-password``: Prompt for MySQL password.
24+
- ``--mysql-password TEXT``: MySQL password.
25+
26+
Table Options
27+
"""""""""""""
28+
29+
- ``-t, --mysql-tables TUPLE``: Transfer only these specific tables (space separated table names). Implies --without-foreign-keys which inhibits the transfer of foreign keys. Can not be used together with --exclude-mysql-tables.
30+
- ``-e, --exclude-mysql-tables TUPLE``: Transfer all tables except these specific tables (space separated table names). Implies --without-foreign-keys which inhibits the transfer of foreign keys. Can not be used together with --mysql-tables.
31+
32+
Transfer Options
33+
""""""""""""""""
34+
35+
- ``-L, --limit-rows INTEGER``: Transfer only a limited number of rows from each table.
36+
- ``-C, --collation [BINARY|NOCASE|RTRIM]``: Create datatypes of TEXT affinity using a specified collation sequence. The default is BINARY.
37+
- ``-K, --prefix-indices``: Prefix indices with their corresponding tables. This ensures that their names remain unique across the SQLite database.
38+
- ``-X, --without-foreign-keys``: Do not transfer foreign keys.
39+
- ``-W, --without-data``: Do not transfer table data, DDL only.
40+
41+
Connection Options
42+
""""""""""""""""""
43+
44+
- ``-h, --mysql-host TEXT``: MySQL host. Defaults to localhost.
45+
- ``-P, --mysql-port INTEGER``: MySQL port. Defaults to 3306.
46+
- ``-S, --skip-ssl``: Disable MySQL connection encryption.
47+
48+
Other Options
49+
"""""""""""""
50+
51+
- ``-c, --chunk INTEGER``: Chunk reading/writing SQL records.
52+
- ``-l, --log-file PATH``: Log file.
53+
- ``--json-as-text``: Transfer JSON columns as TEXT.
54+
- ``-V, --vacuum``: Use the VACUUM command to rebuild the SQLite database file, repacking it into a minimal amount of disk space.
55+
- ``--use-buffered-cursors``: Use MySQLCursorBuffered for reading the MySQL database. This can be useful in situations where multiple queries, with small result sets, need to be combined or computed with each other.
56+
- ``-q, --quiet``: Quiet. Display only errors.
57+
- ``--debug``: Debug mode. Will throw exceptions.
58+
- ``--version``: Show the version and exit.
59+
- ``--help``: Show this message and exit.
60+
61+
Docker
62+
^^^^^^
63+
64+
If you don’t want to install the tool on your system, you can use the
65+
Docker image instead.
66+
67+
.. code:: bash
68+
69+
docker run -it \
70+
--workdir $(pwd) \
71+
--volume $(pwd):$(pwd) \
72+
--rm ghcr.io/techouse/mysql-to-sqlite3:latest \
73+
--sqlite-file baz.db \
74+
--mysql-user foo \
75+
--mysql-password bar \
76+
--mysql-database baz \
77+
--mysql-host host.docker.internal
78+
79+
This will mount your host current working directory (pwd) inside the
80+
Docker container as the current working directory. Any files Docker
81+
would write to the current working directory are written to the host
82+
directory where you did docker run. Note that you have to also use a
83+
`special
84+
hostname <https://docs.docker.com/desktop/networking/#use-cases-and-workarounds-for-all-platforms>`__
85+
``host.docker.internal`` to access your host machine from inside the
86+
Docker container.
87+
88+
Homebrew
89+
^^^^^^^^
90+
91+
If you’re on macOS, you can install the tool using
92+
`Homebrew <https://brew.sh/>`__.
93+
94+
.. code:: bash
95+
96+
brew tap techouse/mysql-to-sqlite3
97+
brew install mysql-to-sqlite3
98+
mysql2sqlite --help

docs/conf.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Configuration file for the Sphinx documentation builder.
2+
#
3+
# For the full list of built-in configuration values, see the documentation:
4+
# https://www.sphinx-doc.org/en/master/usage/configuration.html
5+
import os
6+
import sys
7+
8+
9+
sys.path.insert(0, os.path.abspath(".."))
10+
11+
from mysql_to_sqlite3 import __version__
12+
13+
14+
# -- Project information -----------------------------------------------------
15+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
16+
17+
project = "mysql-to-sqlite3"
18+
copyright = "2024, Klemen Tusar"
19+
author = "Klemen Tusar"
20+
release = __version__
21+
22+
# -- General configuration ---------------------------------------------------
23+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
24+
25+
extensions = ["sphinx.ext.autodoc", "sphinx.ext.viewcode", "sphinx.ext.napoleon"]
26+
27+
napoleon_google_docstring = True
28+
napoleon_include_init_with_doc = True
29+
30+
templates_path = ["_templates"]
31+
exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"]
32+
33+
34+
# -- Options for HTML output -------------------------------------------------
35+
# https://www.sphinx-doc.org/en/master/usage/configuration.html#options-for-html-output
36+
37+
html_theme = "alabaster"
38+
html_static_path = ["_static"]

docs/index.rst

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
MySQL to SQLite3
2+
================
3+
4+
A simple Python tool to transfer data from MySQL to SQLite 3
5+
6+
|PyPI| |PyPI - Downloads| |PyPI - Python Version| |MySQL Support|
7+
|MariaDB Support| |GitHub license| |Contributor Covenant| |PyPI - Format|
8+
|Code style: black| |Codacy Badge| |Test Status| |CodeQL Status|
9+
|Publish PyPI Package Status| |codecov| |GitHub Sponsors| |GitHub stars|
10+
11+
Installation
12+
------------
13+
14+
.. code:: bash
15+
16+
pip install mysql-to-sqlite3
17+
18+
Basic Usage
19+
-----------
20+
21+
.. code:: bash
22+
23+
mysql2sqlite -f path/to/foo.sqlite -d foo_db -u foo_user -p
24+
25+
.. toctree::
26+
:maxdepth: 2
27+
:caption: Contents:
28+
29+
README
30+
modules
31+
32+
Indices and tables
33+
==================
34+
35+
* :ref:`genindex`
36+
* :ref:`modindex`
37+
* :ref:`search`
38+
39+
.. |PyPI| image:: https://img.shields.io/pypi/v/mysql-to-sqlite3
40+
:target: https://pypi.org/project/mysql-to-sqlite3/
41+
.. |PyPI - Downloads| image:: https://img.shields.io/pypi/dm/mysql-to-sqlite3
42+
:target: https://pypistats.org/packages/mysql-to-sqlite3
43+
.. |PyPI - Python Version| image:: https://img.shields.io/pypi/pyversions/mysql-to-sqlite3
44+
:target: https://pypi.org/project/mysql-to-sqlite3/
45+
.. |MySQL Support| image:: https://img.shields.io/static/v1?label=MySQL&message=5.5+%7C+5.6+%7C+5.7+%7C+8.0&color=2b5d80
46+
:target: https://img.shields.io/static/v1?label=MySQL&message=5.6+%7C+5.7+%7C+8.0&color=2b5d80
47+
.. |MariaDB Support| image:: https://img.shields.io/static/v1?label=MariaDB&message=5.5+%7C+10.0+%7C+10.1+%7C+10.2+%7C+10.3+%7C+10.4+%7C+10.5+%7C+10.6%7C+10.11&color=C0765A
48+
:target: https://img.shields.io/static/v1?label=MariaDB&message=10.0+%7C+10.1+%7C+10.2+%7C+10.3+%7C+10.4+%7C+10.5&color=C0765A
49+
.. |GitHub license| image:: https://img.shields.io/github/license/techouse/mysql-to-sqlite3
50+
:target: https://github.com/techouse/mysql-to-sqlite3/blob/master/LICENSE
51+
.. |Contributor Covenant| image:: https://img.shields.io/badge/Contributor%20Covenant-2.1-4baaaa.svg
52+
:target: CODE-OF-CONDUCT.md
53+
.. |PyPI - Format| image:: https://img.shields.io/pypi/format/mysql-to-sqlite3
54+
:target: https://pypi.org/project/sqlite3-to-mysql/
55+
.. |Code style: black| image:: https://img.shields.io/badge/code%20style-black-000000.svg
56+
:target: https://github.com/ambv/black
57+
.. |Codacy Badge| image:: https://api.codacy.com/project/badge/Grade/64aae8e9599746d58d277852b35cc2bd
58+
:target: https://www.codacy.com/manual/techouse/mysql-to-sqlite3?utm_source=github.com&utm_medium=referral&utm_content=techouse/mysql-to-sqlite3&utm_campaign=Badge_Grade
59+
.. |Test Status| image:: https://github.com/techouse/mysql-to-sqlite3/actions/workflows/test.yml/badge.svg
60+
:target: https://github.com/techouse/mysql-to-sqlite3/actions/workflows/test.yml
61+
.. |CodeQL Status| image:: https://github.com/techouse/mysql-to-sqlite3/actions/workflows/codeql-analysis.yml/badge.svg
62+
:target: https://github.com/techouse/mysql-to-sqlite3/actions/workflows/codeql-analysis.yml
63+
.. |Publish PyPI Package Status| image:: https://github.com/techouse/mysql-to-sqlite3/actions/workflows/publish.yml/badge.svg
64+
:target: https://github.com/techouse/mysql-to-sqlite3/actions/workflows/publish.yml
65+
.. |codecov| image:: https://codecov.io/gh/techouse/mysql-to-sqlite3/branch/master/graph/badge.svg
66+
:target: https://codecov.io/gh/techouse/mysql-to-sqlite3
67+
.. |GitHub Sponsors| image:: https://img.shields.io/github/sponsors/techouse
68+
:target: https://github.com/sponsors/techouse
69+
.. |GitHub stars| image:: https://img.shields.io/github/stars/techouse/mysql-to-sqlite3.svg?style=social&label=Star&maxAge=2592000
70+
:target: https://github.com/techouse/mysql-to-sqlite3/stargazers

docs/make.bat

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
@ECHO OFF
2+
3+
pushd %~dp0
4+
5+
REM Command file for Sphinx documentation
6+
7+
if "%SPHINXBUILD%" == "" (
8+
set SPHINXBUILD=sphinx-build
9+
)
10+
set SOURCEDIR=.
11+
set BUILDDIR=_build
12+
13+
%SPHINXBUILD% >NUL 2>NUL
14+
if errorlevel 9009 (
15+
echo.
16+
echo.The 'sphinx-build' command was not found. Make sure you have Sphinx
17+
echo.installed, then set the SPHINXBUILD environment variable to point
18+
echo.to the full path of the 'sphinx-build' executable. Alternatively you
19+
echo.may add the Sphinx directory to PATH.
20+
echo.
21+
echo.If you don't have Sphinx installed, grab it from
22+
echo.https://www.sphinx-doc.org/
23+
exit /b 1
24+
)
25+
26+
if "%1" == "" goto help
27+
28+
%SPHINXBUILD% -M %1 %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
29+
goto end
30+
31+
:help
32+
%SPHINXBUILD% -M help %SOURCEDIR% %BUILDDIR% %SPHINXOPTS% %O%
33+
34+
:end
35+
popd

docs/modules.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
mysql_to_sqlite3
2+
================
3+
4+
.. toctree::
5+
:maxdepth: 4
6+
7+
mysql_to_sqlite3

docs/mysql_to_sqlite3.rst

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
mysql\_to\_sqlite3 package
2+
==========================
3+
4+
Submodules
5+
----------
6+
7+
mysql\_to\_sqlite3.cli module
8+
-----------------------------
9+
10+
.. automodule:: mysql_to_sqlite3.cli
11+
:members:
12+
:undoc-members:
13+
:show-inheritance:
14+
15+
mysql\_to\_sqlite3.click\_utils module
16+
--------------------------------------
17+
18+
.. automodule:: mysql_to_sqlite3.click_utils
19+
:members:
20+
:undoc-members:
21+
:show-inheritance:
22+
23+
mysql\_to\_sqlite3.debug\_info module
24+
-------------------------------------
25+
26+
.. automodule:: mysql_to_sqlite3.debug_info
27+
:members:
28+
:undoc-members:
29+
:show-inheritance:
30+
31+
mysql\_to\_sqlite3.mysql\_utils module
32+
--------------------------------------
33+
34+
.. automodule:: mysql_to_sqlite3.mysql_utils
35+
:members:
36+
:undoc-members:
37+
:show-inheritance:
38+
39+
mysql\_to\_sqlite3.sqlite\_utils module
40+
---------------------------------------
41+
42+
.. automodule:: mysql_to_sqlite3.sqlite_utils
43+
:members:
44+
:undoc-members:
45+
:show-inheritance:
46+
47+
mysql\_to\_sqlite3.transporter module
48+
-------------------------------------
49+
50+
.. automodule:: mysql_to_sqlite3.transporter
51+
:members:
52+
:undoc-members:
53+
:show-inheritance:
54+
55+
mysql\_to\_sqlite3.types module
56+
-------------------------------
57+
58+
.. automodule:: mysql_to_sqlite3.types
59+
:members:
60+
:undoc-members:
61+
:show-inheritance:
62+
63+
Module contents
64+
---------------
65+
66+
.. automodule:: mysql_to_sqlite3
67+
:members:
68+
:undoc-members:
69+
:show-inheritance:

docs/requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Sphinx==7.3.7

pyproject.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,7 @@ exclude = '''
8989
| buck-out
9090
| build
9191
| dist
92+
| docs
9293
)/
9394
| foo.py
9495
)
@@ -120,6 +121,7 @@ mypy_path = "src"
120121
python_version = "3.8"
121122
exclude = [
122123
"tests",
124+
"docs",
123125
"build",
124126
"dist",
125127
"venv",

0 commit comments

Comments
 (0)