About SQLEyes
SQLEyes is a CLI tool for analyzing simple, raw SQL queries for common sql anti-patterns.
Usage
This package can be installed using pip install sqleyes. After installation, open a terminal and type sqleyes -h to open a help guide showing all possible options and arguments.
$ sqleyes -h
usage: sqleyes [-h] -q
Analyze raw SQL queries for anti-patterns
optional arguments:
-h, --help show this help message and exit
-q , --query A raw SQL query to analyze
To analyze a query use the -q flag with the query in string format.
$ sqleyes -q "SELECT * FROM product WHERE pCategory <> NULL"
[{"type": "Implict Columns", "detector_type": "anti-pattern"},
{"type": "Fear of the Unknown", "detector_type": "anti-pattern"}]
This package can also be imported into existing projects. Make sure it is installed in your project's virtual environment.
from sqleyes.utils.query_functions import check_single_value_rule
# Use a sqleyes function
has_single_values = check_single_value_rule(["AVG(price)"])
...
from sqleyes.main import main
# Check a query for anti-patterns
anti_patterns = main("SELECT * FROM product")
Repository
This repository contains the main SQLEyes package as well as the unit tests
Contributing
- Make sure you have all the required packages installed. These can be found in
requirements.txtandrequirements_dev.txt. - Create a new feature branch
git checkout -b feature/<FEATURE NAME>. - Install the package in editable mode using
pip install -e ., which installs the package locally. Changes to the package a directly reflected in your environment. - (Optional) In order for the CLI tool to work in editable mode, run
pip install .after step 3. - Implement the desired features.
- Write unit tests inside the
testsdirectory. - Make sure all unit tests pass by running
pytestin the root of the repository. - Make sure linting and static type hinting is proper by running
flake8 sqleyes testsandmypy sqleyes. - Create a pull request describing your feature.
Building and distribution
- Make sure all tests passed, linting and static type hinting are proper (see steps 7 & 8 of Contribution).
- Increase version number accordingly.
- Run
python -m buildin the root directory. Adistfolder will be generated. - Upload the package to PyPI using Twine (
pip install twine) using the following command:twine upload dist/*.
Acknowledgements
This project was developed as a master's graduation project at Eindhoven University of Technology. Code boilerplate and best practices from best-practice-and-impact. This package depends on some of sqlparse features for parsing SQL queries.
Metadata
Release files for sqleyes 0.5.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 |
|---|---|---|---|---|
| sqleyes-0.5.0.tar.gz | 18.4 kB | Without provenance | Details for sqleyes-0.5.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sqleyes-0.5.0-py3-none-any.whl | Python 3 | none | any | Details for sqleyes-0.5.0-py3-none-any.whl |
Total release size: 42.8 kB
Release files / sqleyes-0.5.0.tar.gz
| Download URL | sqleyes-0.5.0.tar.gz |
|---|---|
| Size | 18.4 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1b41750f590ecbeb598e54be30fc5de881a80e1b46d47764ca69d06c90b1ed7a
|
|
BLAKE2b-256 checksum How to use checksums |
4d97765fcbee29c526630f6c6a92c45ecc5a6b6c0cfaf2524ac6dc59d589a277
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.12
|
Release files / sqleyes-0.5.0-py3-none-any.whl
| Download URL | sqleyes-0.5.0-py3-none-any.whl |
|---|---|
| Size | 24.4 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
abf2845bb3edbc9e09a7d384a4d6019e228f4c70f0703dbf3b62a8607e3d8dac
|
|
BLAKE2b-256 checksum How to use checksums |
032249472ac6f335485329e74499ebf40f9549679865a418c711df693e200a45
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/3.8.0 pkginfo/1.8.2 readme-renderer/33.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.63.0 importlib-metadata/4.11.2 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.8.12
|
Security for sqleyes 0.5.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.