diff --git a/.gitignore b/.gitignore index b94a2fb..c129132 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,7 @@ /venv /.vscode -/.pytest_cache \ No newline at end of file +/.pytest_cache +dist/ +*.egg-info/ +**__pycache__/ +db/sqlite3 \ No newline at end of file diff --git a/sql-package/LICENSE b/LICENSE similarity index 100% rename from sql-package/LICENSE rename to LICENSE diff --git a/sql-package/__init__.py b/__init__.py similarity index 100% rename from sql-package/__init__.py rename to __init__.py diff --git a/sql-package/pyproject.toml b/pyproject.toml similarity index 100% rename from sql-package/pyproject.toml rename to pyproject.toml diff --git a/pytest.ini b/pytest.ini index ad21473..252c5f1 100644 --- a/pytest.ini +++ b/pytest.ini @@ -2,4 +2,4 @@ python_files = test_*.py DJANGO_SETTINGS_MODULE = settings django_find_project = false -pythonpath = ./sql-package/tests \ No newline at end of file +pythonpath = ./tests \ No newline at end of file diff --git a/requirements.txt b/requirements.txt index dfb92ca..5221a76 100644 --- a/requirements.txt +++ b/requirements.txt @@ -34,7 +34,6 @@ rfc3986==2.0.0 rich==13.6.0 SecretStorage==3.3.3 six==1.16.0 -sql-inspector==1.0.0.3 sqlparse==0.4.4 twine==4.0.2 urllib3==2.0.7 diff --git a/sql-package/sql-inspector/__init__.py b/sql-inspector/__init__.py similarity index 100% rename from sql-package/sql-inspector/__init__.py rename to sql-inspector/__init__.py diff --git a/sql-package/sql-inspector/middleware.py b/sql-inspector/middleware.py similarity index 100% rename from sql-package/sql-inspector/middleware.py rename to sql-inspector/middleware.py diff --git a/sql-package/README.md b/sql-package/README.md deleted file mode 100644 index b2099e5..0000000 --- a/sql-package/README.md +++ /dev/null @@ -1,60 +0,0 @@ -# SQLInspector Middleware for Django - -[![Version](https://img.shields.io/badge/version-0.5-brightgreen)](https://pypi.org/project/sqlinspector/) - -## Description - -SQLInspector is a Django middleware that provides developers with insights into the SQL queries generated by Django's ORM. By integrating SQLInspector into your Django project, you can: - -- Monitor and capture all SQL queries in real-time. -- Analyze the efficiency and performance of database operations. -- Understand the underlying SQL interactions even when using Django's ORM for database operations. -- Ensure that the application's database interactions are optimized for scalability and performance. - -SQLInspector acts as a valuable tool for developers aiming to ensure the optimal performance of their Django applications, especially when dealing with complex database operations and multiple related models. - -## Features - -- **Monitor and Log SQL Queries:** Every SQL query made by your Django application is recorded. - -- **Performance Optimization:** Get insights into the most efficient ways of fetching data from your database and optimizing your queries accordingly. - -- **Diagnostic Aid:** Helps in diagnosing non-performant SQL queries and offers insights into potential optimizations. - -- **Ease of Integration:** Being a middleware, it seamlessly integrates into any Django project. - -## Installation - -To install the SQLInspector middleware via pip, use: - -```bash -pip install -i https://test.pypi.org/simple/ sql-inspector -``` - -## How to Use - -Integrating SQLInspector into your Django project is straightforward. Once you've installed the middleware, the next steps ensure its proper functioning: - -### Integration Steps: - -1. **Add to MIDDLEWARE in settings.py:** - - After you have installed the SQLInspector via pip, you need to add it to your Django application's `MIDDLEWARE` settings. - - Open your `settings.py` file and locate the `MIDDLEWARE` section. Add the following line: - - ```python - 'sql-inspector.middleware.querychecker_middleware', - ``` - - Ensure you add it in the appropriate order. For instance, if you have other middleware that processes database queries, you might want to adjust the order to ensure SQLInspector captures the raw queries before any other processing takes place. - -2. **Monitor Your Queries:** - - With SQLInspector now integrated, you can monitor, analyze, and optimize your SQL queries in real-time as your application runs. - -Remember, SQLInspector doesn't just capture the queries; it provides valuable insights into their performance and efficiency. By understanding the underlying SQL, you can make the necessary adjustments to your Django ORM operations, ensuring optimal database interactions. - -Happy optimizing! - - diff --git a/sql-package/__pycache__/__init__.cpython-311.pyc b/sql-package/__pycache__/__init__.cpython-311.pyc deleted file mode 100644 index d178696..0000000 Binary files a/sql-package/__pycache__/__init__.cpython-311.pyc and /dev/null differ diff --git a/sql-package/__pycache__/test_new.cpython-311-pytest-7.4.3.pyc b/sql-package/__pycache__/test_new.cpython-311-pytest-7.4.3.pyc deleted file mode 100644 index d0b21b5..0000000 Binary files a/sql-package/__pycache__/test_new.cpython-311-pytest-7.4.3.pyc and /dev/null differ diff --git a/sql-package/tests/__pycache__/settings.cpython-311.pyc b/sql-package/tests/__pycache__/settings.cpython-311.pyc deleted file mode 100644 index 324be9e..0000000 Binary files a/sql-package/tests/__pycache__/settings.cpython-311.pyc and /dev/null differ diff --git a/sql-package/tests/__pycache__/test_new.cpython-311-pytest-7.4.3.pyc b/sql-package/tests/__pycache__/test_new.cpython-311-pytest-7.4.3.pyc deleted file mode 100644 index 049ba44..0000000 Binary files a/sql-package/tests/__pycache__/test_new.cpython-311-pytest-7.4.3.pyc and /dev/null differ diff --git a/sql-package/tests/test_app/__pycache__/__init__.cpython-311.pyc b/sql-package/tests/test_app/__pycache__/__init__.cpython-311.pyc deleted file mode 100644 index cb4d58c..0000000 Binary files a/sql-package/tests/test_app/__pycache__/__init__.cpython-311.pyc and /dev/null differ diff --git a/sql-package/tests/test_app/__pycache__/models.cpython-311.pyc b/sql-package/tests/test_app/__pycache__/models.cpython-311.pyc deleted file mode 100644 index b405386..0000000 Binary files a/sql-package/tests/test_app/__pycache__/models.cpython-311.pyc and /dev/null differ diff --git a/sql-package/tests/test_app/__pycache__/urls.cpython-311.pyc b/sql-package/tests/test_app/__pycache__/urls.cpython-311.pyc deleted file mode 100644 index cb207ec..0000000 Binary files a/sql-package/tests/test_app/__pycache__/urls.cpython-311.pyc and /dev/null differ diff --git a/sql-package/tests/test_app/__pycache__/views.cpython-311.pyc b/sql-package/tests/test_app/__pycache__/views.cpython-311.pyc deleted file mode 100644 index 8d4dd2c..0000000 Binary files a/sql-package/tests/test_app/__pycache__/views.cpython-311.pyc and /dev/null differ diff --git a/sql-package/tests/test_app/settings.py b/tests/settings.py similarity index 100% rename from sql-package/tests/test_app/settings.py rename to tests/settings.py diff --git a/sql-package/tests/test_app/__init__.py b/tests/test_app/__init__.py similarity index 100% rename from sql-package/tests/test_app/__init__.py rename to tests/test_app/__init__.py diff --git a/sql-package/tests/test_app/models.py b/tests/test_app/models.py similarity index 100% rename from sql-package/tests/test_app/models.py rename to tests/test_app/models.py diff --git a/sql-package/tests/test_app/urls.py b/tests/test_app/urls.py similarity index 100% rename from sql-package/tests/test_app/urls.py rename to tests/test_app/urls.py diff --git a/sql-package/tests/test_app/views.py b/tests/test_app/views.py similarity index 100% rename from sql-package/tests/test_app/views.py rename to tests/test_app/views.py diff --git a/sql-package/tests/test_new.py b/tests/test_new.py similarity index 100% rename from sql-package/tests/test_new.py rename to tests/test_new.py