moss-connector-mysql
MySQL / MariaDB source connector for Moss. Uses PyMySQL so it works against regular MySQL, MariaDB, and PlanetScale.
Install
pip install moss-connector-mysql
This installs pymysql automatically.
Usage
import asyncio
from moss import DocumentInfo
from moss_connector_mysql import MySQLConnector, ingest
async def main():
source = MySQLConnector(
host="localhost",
user="root",
password="secret",
database="mydb",
query="SELECT id, title, body FROM articles",
mapper=lambda row: DocumentInfo(
id=str(row["id"]),
text=row["body"],
metadata={"title": row["title"]},
),
port=3306,
)
result = await ingest(
source,
project_id="your_project_id",
project_key="your_project_key",
index_name="articles",
)
print(f"copied {result.doc_count} rows")
asyncio.run(main())
Layout
src/
├── __init__.py # re-exports MySQLConnector and ingest
├── connector.py # MySQLConnector class
└── ingest.py # ingest() - keep in sync with the other connector packages
Tests
pip install -e ".[dev]"
pytest tests/test_mysql.py -v # mocked, no network or DB needed
pytest tests/test_integration_mysql_moss.py -v -s # live MySQL + Moss (requires MYSQL_URL, MOSS_PROJECT_ID, MOSS_PROJECT_KEY)
Release files for moss-connector-mysql 0.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| moss_connector_mysql-0.0.1.tar.gz | 6.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| moss_connector_mysql-0.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 10.5 kB
Release files / moss_connector_mysql-0.0.1.tar.gz
| Download URL | moss_connector_mysql-0.0.1.tar.gz |
|---|---|
| Size | 6.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
80b6c67c68ebd8e2a0f73f4346b9286de7f1cdf6e3d10f2f9775e9b70f8adfb2
|
|
BLAKE2b-256 checksum How to use checksums |
7d7b1f15c76a46cf26ef73afcd8fcfdbfe9edf9afda861bc9f6c031a94b1fb61
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.15
|
Release files / moss_connector_mysql-0.0.1-py3-none-any.whl
| Download URL | moss_connector_mysql-0.0.1-py3-none-any.whl |
|---|---|
| Size | 3.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
779941693b8c602606e95f7200ad20b010511b1882a48f3ab1e1d70ad929bb69
|
|
BLAKE2b-256 checksum How to use checksums |
eba915edd56bdd49f204d9d4e04a784aba47d777440f3a767c4461095058ea6f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.15
|