Skip to main content

Production-ready multi-cloud database abstraction layer with connection pooling, retry logic, and thread safety

Project description

AltCodePro PolyDB

AltCodePro PolyDB is a production-ready multi-cloud database abstraction layer for Python.

It provides a single unified API for SQL, NoSQL, object storage, queues, and blockchain storage across major platforms including AWS, Azure, GCP, Vercel, MongoDB, PostgreSQL, and Web3 networks.

PolyDB enables developers to build cloud-portable applications without vendor lock-in.

It is designed for modern distributed systems that require:

  • multi-cloud portability
  • hybrid SQL + NoSQL architectures
  • distributed storage routing
  • event-driven queues
  • object storage abstraction
  • blockchain storage integration
  • enterprise-grade reliability

Architecture

PolyDB unifies multiple storage layers behind a single API.

                    PolyDB
                       │
        ┌──────────────┼──────────────┐
        │              │              │
     SQL DB         NoSQL KV        Queue
   PostgreSQL     Dynamo/Azure    SQS/PubSub
        │              │              │
        └─────── Object Storage ─────┘
                   S3 / Blob
                        │
                    Blockchain
                  (KV / Blob / Queue)

Project Structure

polydb/
 ├ adapters/
 │   ├ aws/
 │   ├ azure/
 │   ├ gcp/
 │   ├ vercel/
 │   └ blockchain/
 │
 ├ core/
 │   ├ database_factory.py
 │   ├ query.py
 │   ├ batch.py
 │
 ├ security/
 ├ monitoring/
 ├ cache/
 └ multitenancy/

Key Features

Multi-Cloud Support

Works across multiple cloud providers with automatic environment detection.

Provider NoSQL Object Storage Queue
AWS DynamoDB S3 SQS
Azure Table Storage Blob Storage Azure Queue
GCP Firestore GCS Pub/Sub
Vercel KV (Redis) Blob Queue
MongoDB MongoDB
PostgreSQL SQL S3-compatible
Blockchain Smart Contract KV IPFS Event Queue

❤️ Support the Project

PolyDB is free and open source.

If you find this project useful, you can support continued development.

Sponsor

Sponsor

Or support the project through AltCodePro:

https://chatgpt.com/g/g-68d6efde65e0819192b9e130fb56b26b-altcodepro-gpt-idea-to-mvps-investor-docs

Your support helps improve:

  • multi-cloud database adapters
  • blockchain storage integrations
  • enterprise scalability features
  • developer tooling and documentation

Hybrid SQL + NoSQL

PolyDB allows applications to use SQL and NoSQL together without changing code.

Example architecture:

Application
     │
PolyDB DatabaseFactory
     │
 ┌──────────────┬──────────────┐
 │              │              │
SQL          NoSQL           Storage
(Postgres)   (DynamoDB)     (S3)

Example:

from polydb import DatabaseFactory

db = DatabaseFactory()

db.create(User, {"name": "Alice"})
db.read(User, {"email": "alice@email.com"})
db.update(User, 1, {"status": "active"})
db.delete(User, 1)

Automatic Cloud Provider Detection

PolyDB automatically detects the cloud provider based on environment variables.

Environment Variable Provider
AZURE_STORAGE_CONNECTION_STRING Azure
AWS_ACCESS_KEY_ID AWS
GOOGLE_CLOUD_PROJECT GCP
VERCEL_ENV Vercel
MONGODB_URI MongoDB
POSTGRES_URL PostgreSQL

You can also manually set:

CLOUD_PROVIDER=aws

Object Storage

PolyDB provides a unified API for cloud storage systems.

Supported backends:

  • AWS S3
  • Azure Blob Storage
  • Google Cloud Storage
  • Vercel Blob
  • IPFS (Blockchain)

Example:

storage = factory.get_object_storage()

storage.upload("file.txt", b"hello world")
storage.download("file.txt")
storage.delete("file.txt")

Queue Abstraction

PolyDB supports distributed message queues.

Supported systems:

  • AWS SQS
  • Azure Queue
  • Google Pub/Sub
  • Vercel Queue
  • Blockchain event queues

Example:

queue = factory.get_queue()

queue.send_message("jobs", {"task": "process"})
msg = queue.receive_message("jobs")
queue.delete_message("jobs", msg)

Blockchain Storage

PolyDB includes experimental blockchain adapters.

Capabilities:

  • Smart contract key-value storage
  • IPFS blob storage
  • Event-based queue systems

Supported networks:

  • Ethereum
  • Polygon
  • BNB Chain
  • Avalanche
  • Local Ganache

Example:

factory = CloudDatabaseFactory(provider="blockchain")

kv = factory.get_nosql_kv()
blob = factory.get_object_storage()
queue = factory.get_queue()

Advanced Query Engine

PolyDB includes a LINQ-style query builder.

Supports:

  • filtering
  • ordering
  • pagination
  • projections
  • count queries

Example:

qb = QueryBuilder().where("age", Operator.GT, 18)

results = db.query_linq(User, qb)

Batch Operations

High-performance bulk operations.

db.batch.bulk_insert(User, users)

db.batch.bulk_update(User, updates)

db.batch.bulk_delete(User, ids)

Multi-Tenancy

PolyDB supports SaaS-style tenant isolation.

Isolation strategies:

  • shared schema
  • separate schema
  • separate database

Components:

  • TenantRegistry
  • TenantContext
  • TenantIsolationEnforcer

Caching

Built-in distributed caching using Redis.

Features:

  • TTL caching
  • LFU tracking
  • cache warming
  • cache invalidation

Monitoring & Observability

PolyDB provides built-in metrics collection.

Tracks:

  • query latency
  • slow queries
  • error rates
  • cache hit rates

Prometheus export supported.


Security

PolyDB includes enterprise-grade security features.

  • field-level encryption
  • row-level security
  • audit logging
  • tenant isolation
  • data masking

Installation

Install from PyPI:

pip install altcodepro-polydb-python

Optional dependencies:

pip install redis boto3 google-cloud-storage web3 ipfshttpclient

Example

from polydb import DatabaseFactory, polydb_model

@polydb_model
class User:
    __polydb__ = {
        "storage": "nosql"
    }

db = DatabaseFactory()

db.create(User, {"name": "Alice"})
users = db.read(User, {"name": "Alice"})

Why PolyDB

PolyDB replaces multiple infrastructure SDKs with one API.

Traditional Approach PolyDB
Multiple cloud SDKs One unified API
Provider lock-in Multi-cloud portability
Separate queue/storage clients Unified infrastructure
Complex data routing Automatic routing

Roadmap

Planned features:

  • GraphQL API layer
  • distributed transactions
  • vector database support
  • AI retrieval pipelines
  • edge database adapters

License

MIT License


Links

PyPI https://pypi.org/project/altcodepro-polydb-python/

Website https://chatgpt.com/g/g-68d6efde65e0819192b9e130fb56b26b-altcodepro-gpt-idea-to-mvps-investor-docs

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

altcodepro_polydb_python-2.3.6.tar.gz (102.2 kB view details)

Uploaded Source

Built Distribution

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

altcodepro_polydb_python-2.3.6-py3-none-any.whl (99.9 kB view details)

Uploaded Python 3

File details

Details for the file altcodepro_polydb_python-2.3.6.tar.gz.

File metadata

  • Download URL: altcodepro_polydb_python-2.3.6.tar.gz
  • Upload date:
  • Size: 102.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.7

File hashes

Hashes for altcodepro_polydb_python-2.3.6.tar.gz
Algorithm Hash digest
SHA256 b210c2a145c863819eedb340cd959592bdbbf7161dd94a00bad850ca59c4cc22
MD5 0aa20deb7c14f78b331a8705b7d7d2e6
BLAKE2b-256 e269f271c12f196a46225a2d8239340d88d6c2dc0fead0c1dd3650ec495bc13f

See more details on using hashes here.

File details

Details for the file altcodepro_polydb_python-2.3.6-py3-none-any.whl.

File metadata

File hashes

Hashes for altcodepro_polydb_python-2.3.6-py3-none-any.whl
Algorithm Hash digest
SHA256 21e159c2d1bc4d38a5fac548c0b751335ed20ddca711e29299ea0faec5167218
MD5 e7696b3fd356b741a567b6e581dabf5a
BLAKE2b-256 16995c64420741ed75b09f1121b2d11e113dc0872dd78a2a72170982c76dfbf7

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