Skip to main content

A secure, parameterized database access layer to prevent SQL injection and ensure safe multi-database access.

Project description

smart-securedb 🔐

A secure Python database connector with SQLAlchemy — designed to prevent SQL injection and use encrypted connection strings via smart-encryptor.


🚀 Installation

pip install smart-securedb smart-encryptor

🔧 Usage

1. Encrypt your connection string first

from smart_encryptor import SmartEncryptor, generate_key

# Generate custom key (recommended)
key = generate_key("dbkey.txt")

encryptor = SmartEncryptor(key)
encrypted_conn = encryptor.encrypt("mysql+pymysql://root:MyPass@localhost/mydb")
print("Encrypted:", encrypted_conn)

2. Use encrypted connection in SecureDB

from securedb import SecureDB

# Load your key from file or environment variable
with open("dbkey.txt") as f:
    key = f.read().strip()

db = SecureDB(encrypted_conn_str="<your-encrypted-string>", encryption_key=key)
result = db.execute_query("SELECT * FROM users WHERE id=:id", {"id": 1})

print(result)
db.close()

✅ Features

  • Secure encryption for credentials.
  • Full protection from SQL Injection (parameterized queries).
  • Works with MySQL, PostgreSQL, Oracle, and MSSQL.
  • Integrates seamlessly with smart-encryptor.

⚙️ Supported drivers

  • mysql+pymysql
  • postgresql+psycopg2
  • oracle+cx_oracle
  • mssql+pyodbc

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

smart_securedb-1.0.0.tar.gz (6.4 kB view details)

Uploaded Source

Built Distribution

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

smart_securedb-1.0.0-py3-none-any.whl (7.0 kB view details)

Uploaded Python 3

File details

Details for the file smart_securedb-1.0.0.tar.gz.

File metadata

  • Download URL: smart_securedb-1.0.0.tar.gz
  • Upload date:
  • Size: 6.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.9

File hashes

Hashes for smart_securedb-1.0.0.tar.gz
Algorithm Hash digest
SHA256 5c6ce4093fd88a81eec63dffa19d1e9b346c01a322c01df2ebf7ec2da64da9bf
MD5 cf25cba95c741ac3ba32b0add1ea83f2
BLAKE2b-256 b173eda0c0a14d51c5b8f8b3cb13ef2d822df2e3f4a023f50f322b9d8f35390f

See more details on using hashes here.

File details

Details for the file smart_securedb-1.0.0-py3-none-any.whl.

File metadata

  • Download URL: smart_securedb-1.0.0-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.13.9

File hashes

Hashes for smart_securedb-1.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4f678775772b5780a16822eb39c968fdd85b1c620e2ca9b51212c409291419e3
MD5 82adacbacc4c76749e652d097e4c76fa
BLAKE2b-256 c5634c01b5de2c28886754d29e6776e79741317f3db10010af6d4a98bb15708f

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