Skip to main content

Python module to escape SQL special characters and quotes in strings

install: pip install sqlescapy

Assuming dangerous_input is a variable coming from a user input, a bad actor can exploit it to start injecting your database.

from sqlescapy import sqlescape

dangerous_input = "JhonWick'"

protected_raw_statement = "\"foo_table\".username='%s'" % sqlescape(dangerous_input)

protected_query = """

SELECT "foo_table".*, "bar_table".*
FROM "foo_table", "bar_table"
WHERE "foo_table".id = "bar_table".id
      AND %s
""" % protected_raw_statement

Metadata

Release files for sqlescapy 1.0.1

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for sqlescapy 1.0.1
File Size Uploaded Provenance Actions
sqlescapy-1.0.1.tar.gz 1.5 kB Without provenance Details for sqlescapy-1.0.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for sqlescapy 1.0.1
File Interpreter ABI Platform Actions
sqlescapy-1.0.1-py3-none-any.whl Python 3 none any Details for sqlescapy-1.0.1-py3-none-any.whl

Total release size: 4.3 kB

Release files / sqlescapy-1.0.1.tar.gz

Download URL sqlescapy-1.0.1.tar.gz
Size 1.5 kB
Tags Source
SHA-256 checksum
How to use checksums
281c27266e9f6934a7728a7272b2299bce395d0aeb12a314641add1ffd7e0872
BLAKE2b-256 checksum
How to use checksums
43bbd5077ee1599474af84393bc000212d2aa29e846e10044c4a5eb0813f2339
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.7.4

Release files / sqlescapy-1.0.1-py3-none-any.whl

Download URL sqlescapy-1.0.1-py3-none-any.whl
Size 2.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
3a50b4b1eb8971b51a3c097c37cd58921a8f9e296619534aed515116356f5fbf
BLAKE2b-256 checksum
How to use checksums
c46abd5df7aeed348a0ac9d2d0417128ed82af6291bd76afb16254379a55ad3f
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/1.14.0 pkginfo/1.5.0.1 requests/2.22.0 setuptools/41.2.0 requests-toolbelt/0.9.1 tqdm/4.35.0 CPython/3.7.4

Security for sqlescapy 1.0.1

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

1.0.1 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page