Skip to main content

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-agent
  • datus-sqlalchemy
  • pymysql

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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

datus_mysql-0.1.2.tar.gz (8.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

datus_mysql-0.1.2-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file datus_mysql-0.1.2.tar.gz.

File metadata

  • Download URL: datus_mysql-0.1.2.tar.gz
  • Upload date:
  • Size: 8.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for datus_mysql-0.1.2.tar.gz
Algorithm Hash digest
SHA256 39b06c4ba0586b058a7720dda40ac758df2b0b8ba7961ca758d0ae9a994b405a
MD5 0980f1e8629b73d24072a6af97222d9c
BLAKE2b-256 136ae6610c29fad8594e9e9e74f72c201151f0a1bf0e43f9cb8e9143dec2385d

See more details on using hashes here.

File details

Details for the file datus_mysql-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: datus_mysql-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 7.0 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for datus_mysql-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 e48decdee19be1a20373fd02ab05b9eb6296607f62bad069fb262a4dd7f26e8b
MD5 0614aa7c1ff3785bff1eb4227926e6a9
BLAKE2b-256 f110e83febcdd16d30d56fed3cb6bea8d76d67e9509aaeb39f872fbf115dfc04

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page