Safe SQL
Safe SQL offers a safety net around SQL operations. Company data stored in SQL is succesptible to data losses. Deletion and updating are very common operations, but extra care should be taken. Safe SQL address this exact issue. Here are the key features of Safe-SQL :
-
Improved Query Parsing: Before update/delete queries, safe-sql provides a SELECT query for the user to perform sanity check.
-
Mode Specifier: Safe SQL provides 3 modes(read, write, admin), and implements safety checks before query execution.
-
Enhanced Safet Checks: Common pitfalls such as showing number of rows affected, notifying the user when missing WHERE clause with UPDATE and DELETE and checks when data is modified.
-
Schema Validation: Safe SQL checks if all columns used in the query exists.
-
Backup Creation: Before executing unsafe queries, Safe SQL creates a backup of the affected rows in a new table.
-
Query Caching: Safe SQL provides methods to cache query results and retrieve them, for frequently executed read queries. All queries are executed within a transaction.
-
CLI Interface: Safe SQL is managed through poetry dependency manager, and a robust CLI is provided to execute queries.
Why Safe SQL?
Working with database is complicated because of the stakes involved. Company data is valuable, and although backups always exist, there needs to be a tool to perform sanity checks on common pitfalls. Safe SQL is a tool that tries to address some of the problems. Contributions are always welcome.
Installation and Usage
Development
Safe SQL is managed through poetry, so to install the package use the following command(after cloning the repository and cd-ing into the project folder):
poetry install
To run the Safe SQL using query using the command line, use :
poetry run safe_sql execute --connection-string "your_connection_string" --mode write --query "Your SQL query"
Main
Safe SQL is available on PyPI, and can be installed with the follwing command :
pip install safe-sql
Behind the scene, Safe SQL uses SQLAlchemy to interact with the database, so you don't have to deal with different dialect of MySQL, PostgreSQL, Oracle and can more efficiently query your data.
Safe SQL manages all the interaction with the databased based on the --connection-string CLI argument. After that, just set the mode and give the query, and leave the rest to Safe SQL.
Future Work
PRs are always welcome. You can always work on these tasks :
- Adding functionality for other common pitfalls.
Metadata
Release files for safe-sql 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| safe_sql-0.1.0.tar.gz | 5.0 kB | Without provenance | Details for safe_sql-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| safe_sql-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for safe_sql-0.1.0-py3-none-any.whl |
Total release size: 10.6 kB
Release files / safe_sql-0.1.0.tar.gz
| Download URL | safe_sql-0.1.0.tar.gz |
|---|---|
| Size | 5.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
e18b9893033b077b752d00622200b43d16e92e894b05ee52ae137a36e5532fde
|
|
BLAKE2b-256 checksum How to use checksums |
c458e53e5afac7fb1d672aadc37131778e18248fcf97b971c4551c814778cac6
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.11.4 Windows/10
|
Release files / safe_sql-0.1.0-py3-none-any.whl
| Download URL | safe_sql-0.1.0-py3-none-any.whl |
|---|---|
| Size | 5.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c20c3712e80c625f39b844ae512b5e94075e20de1901279efc141e7d289d1999
|
|
BLAKE2b-256 checksum How to use checksums |
7539b558c351fc3cf6714743058a97be637beaced16acf50403ec29bab98091f
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
poetry/1.8.3 CPython/3.11.4 Windows/10
|
Security for safe-sql 0.1.0
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.