MySQL database adapter for Datus
Project description
datus-mysql
MySQL database adapter for Datus.
Installation
pip install datus-mysql
This will automatically install the required dependencies:
datus-agentdatus-sqlalchemypymysql
Usage
The adapter is automatically registered with Datus when installed. Configure your database connection in your Datus configuration:
database:
type: mysql
host: localhost
port: 3306
username: root
password: your_password
database: your_database
Or use programmatically:
from datus_mysql import MySQLConnector
# Create connector
connector = MySQLConnector(
host="localhost",
port=3306,
user="root",
password="your_password",
database="mydb"
)
# Test connection
connector.test_connection()
# Execute query
result = connector.execute_query("SELECT * FROM users LIMIT 10")
print(result.sql_return)
# Get table list
tables = connector.get_tables()
print(f"Tables: {tables}")
# Get table schema
schema = connector.get_schema(table_name="users")
for column in schema:
print(f"{column['name']}: {column['type']}")
Features
- Full CRUD operations (SELECT, INSERT, UPDATE, DELETE)
- DDL execution (CREATE, ALTER, DROP)
- Metadata retrieval (tables, views, schemas)
- Sample data extraction
- Multiple result formats (pandas, arrow, csv, list)
- Connection pooling and management
- Comprehensive error handling
Requirements
- Python >= 3.10
- MySQL >= 5.7 or MariaDB >= 10.2
- datus-agent >= 0.3.0
- datus-sqlalchemy >= 0.1.0
- pymysql >= 1.0.0
License
Apache License 2.0
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file datus_mysql-0.1.1.tar.gz.
File metadata
- Download URL: datus_mysql-0.1.1.tar.gz
- Upload date:
- Size: 8.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f3d1ed5a00e9f9dfc506b7b547f1f4b8a3f8fec37fd637a4a4e54623da642792
|
|
| MD5 |
6db290b524e4868e2f27374c1926bac1
|
|
| BLAKE2b-256 |
75643e958b4b31289d045b7abdf12a5ce051db3edb90f44aa4c844181a85e4d1
|
File details
Details for the file datus_mysql-0.1.1-py3-none-any.whl.
File metadata
- Download URL: datus_mysql-0.1.1-py3-none-any.whl
- Upload date:
- Size: 6.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.12.10
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
0c94869609765dbf827acc0c504b9e3aacee1c10d36ef7d5ef6d5c66c1a0f4b3
|
|
| MD5 |
d40a0d95a1f118ba0e8e8a4c2a501cf9
|
|
| BLAKE2b-256 |
296c5899f32b7747d435ee0290dfdd7a105f6562ee06ae60acd1f26ed3249d01
|