Skip to main content

A lightweight, unified database connector SDK for Python.

Project description

DataLink SDK

A lightweight, unified database connector SDK for Python. Connect to MySQL, PostgreSQL, MongoDB, and Redis using a single consistent interface.


Installation

pip install datalink-sdk

Supported Databases

Driver Key
MySQL mysql
PostgreSQL postgres
MongoDB mongodb
Redis redis

Quick Start

from datalink_sdk import DataLinkClient

# MySQL
conn = DataLinkClient.get_connection("mysql", {
    "host": "localhost",
    "user": "root",
    "password": "secret",
    "database": "mydb",
    "port": 3306,
})

# PostgreSQL
conn = DataLinkClient.get_connection("postgres", {
    "host": "localhost",
    "user": "postgres",
    "password": "secret",
    "database": "mydb",
    "port": 5432,
})

# MongoDB
conn = DataLinkClient.get_connection("mongodb", {
    "uri": "mongodb://localhost:27017",
})

# Redis
conn = DataLinkClient.get_connection("redis", {
    "host": "localhost",
    "port": 6379,
    "password": None,
})

Exception Handling

from datalink_sdk import DataLinkClient, DataLinkConnectionError, UnsupportedDriverError

try:
    conn = DataLinkClient.get_connection("mysql", config)
except DataLinkConnectionError as e:
    print(f"Connection failed: {e}")
except UnsupportedDriverError as e:
    print(f"Unknown driver: {e}")

Exceptions Reference

Exception When raised
DataLinkException Base exception for all DataLink SDK errors
DataLinkConnectionError Connection to the database failed
UnsupportedDriverError Driver type not recognised
DataLinkConfigError Configuration is invalid or missing fields

Project Structure

datalink_sdk/
├── core/
│   ├── base_driver.py       # Abstract base class for all drivers
│   ├── client.py            # DataLinkClient — main entry point
│   └── exceptions.py        # All SDK exceptions
├── drivers/
│   ├── mysql.py
│   ├── postgres.py
│   ├── mongodb.py
│   └── redis.py
└── config/
    └── settings.py

License

MIT

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

datalink_sdk-1.0.0.tar.gz (5.9 kB view details)

Uploaded Source

Built Distribution

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

datalink_sdk-1.0.0-py3-none-any.whl (8.0 kB view details)

Uploaded Python 3

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