Skip to main content

Lightweight, Thread-Safe, Version-Agnostic, SQL Client Implementation

Project description

AnySQL

Lightweight, Thread-Safe, Version-Agnostic, SQL Client Implementation inspired by Databases

Features

  • Lightweight - no use of sqlalchemy or other massive frameworks
  • ThreadSafe - implements threadsafe features for fearless concurrent usage
  • Flexible - acts as a standard frontend for a wide variety of SQL backends
  • Powerful - simple API design with powerful utilities and quality-of-life features

Installation

pip install anysql

Security

It should be noted that anysql implements its own query parameterization to allow for greater API flexibility and performance, rather than rely on individual sql backends or relying on massive frameworks like sqlalchemy to handle query generation.

The existing parameterization has been thoroughly tested with sqlmap, the world standard of sql pentesting-tools, to prevent and detect any possible sql-injection vulnerabilities.

The test-suite used is publically available within the source-code repo within the tests folder.

Example

# Create a database instance, and connect to it.
from anysql import Database
database = Database('sqlite://:memory:')
database.connect()

# Create a table.
query = """CREATE TABLE HighScores (id INTEGER PRIMARY KEY, name VARCHAR(100), score INTEGER)"""
database.execute(query=query)

# Insert some data.
query = "INSERT INTO HighScores(name, score) VALUES (:name, :score)"
values = [
    {"name": "Daisy", "score": 92},
    {"name": "Neil", "score": 87},
    {"name": "Carol", "score": 43},
]
database.execute_many(query=query, values=values)

# Run a database query.
query = "SELECT * FROM HighScores"
rows = database.fetch_all(query=query)
print('High Scores:', rows)

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

anysql-0.0.3.tar.gz (13.4 kB view details)

Uploaded Source

File details

Details for the file anysql-0.0.3.tar.gz.

File metadata

  • Download URL: anysql-0.0.3.tar.gz
  • Upload date:
  • Size: 13.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.3

File hashes

Hashes for anysql-0.0.3.tar.gz
Algorithm Hash digest
SHA256 fe788cc89c9002ceb9a3cde1fe3aa2731502daf1bdbbe9de6fa0b0044d40e113
MD5 252f8424119deb36ee8eca962ee1edf3
BLAKE2b-256 32e64dadb9fb249abf11b33311fecd8369bc381564e92c8acd3b47d508c0d7ee

See more details on using hashes here.

Supported by

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