sqlite-database 0.7.9__tar.gz → 0.7.11__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (124) hide show
  1. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/.github/workflows/pylint.yml +1 -1
  2. {sqlite_database-0.7.9/sqlite_database.egg-info → sqlite_database-0.7.11}/PKG-INFO +8 -6
  3. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/README.md +6 -4
  4. sqlite_database-0.7.11/TODO.md +60 -0
  5. sqlite_database-0.7.11/docs/DatabaseModes.md +8 -0
  6. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/docs/conf.py +3 -2
  7. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/docs/index.rst +19 -8
  8. sqlite_database-0.7.11/docs/sqlite_database.models.errors.rst +7 -0
  9. sqlite_database-0.7.11/docs/sqlite_database.models.helpers.rst +7 -0
  10. sqlite_database-0.7.11/docs/sqlite_database.models.mixin.rst +7 -0
  11. sqlite_database-0.7.11/docs/sqlite_database.models.query_builder.rst +7 -0
  12. sqlite_database-0.7.11/docs/sqlite_database.models.rst +22 -0
  13. sqlite_database-0.7.11/docs/sqlite_database.models.type_checkers.rst +7 -0
  14. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/docs/sqlite_database.rst +17 -4
  15. sqlite_database-0.7.11/docs/sqlite_database.subquery.rst +7 -0
  16. sqlite_database-0.7.11/docs/sqlite_database.workers.connection.rst +7 -0
  17. sqlite_database-0.7.11/docs/sqlite_database.workers.database.rst +7 -0
  18. sqlite_database-0.7.11/docs/sqlite_database.workers.rst +19 -0
  19. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/pyproject.toml +2 -2
  20. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/sqlite_database/__init__.py +1 -1
  21. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/sqlite_database/_utils.py +9 -4
  22. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/sqlite_database/query_builder.py +23 -5
  23. {sqlite_database-0.7.9 → sqlite_database-0.7.11/sqlite_database.egg-info}/PKG-INFO +8 -6
  24. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/sqlite_database.egg-info/SOURCES.txt +11 -2
  25. sqlite_database-0.7.9/Features.md +0 -315
  26. sqlite_database-0.7.9/SimpleGuide.md +0 -190
  27. sqlite_database-0.7.9/TODO.md +0 -36
  28. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/.editorconfig +0 -0
  29. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  30. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
  31. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/.github/ISSUE_TEMPLATE/question.md +0 -0
  32. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/.github/dependabot.yml +0 -0
  33. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/.github/workflows/pytest.yml +0 -0
  34. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/.github/workflows/python-publish.yml +0 -0
  35. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/.gitignore +0 -0
  36. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/.readthedocs.yaml +0 -0
  37. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/.vscode/settings.json +0 -0
  38. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/History.md +0 -0
  39. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/LICENSE +0 -0
  40. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/bin/activate +0 -0
  41. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/bin/check.bat +0 -0
  42. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/bin/check.sh +0 -0
  43. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/bin/include/utility.bash +0 -0
  44. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/bin/install.bash +0 -0
  45. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/bin/need-installed/activate +0 -0
  46. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/bin/need-installed/pre-commit +0 -0
  47. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/bin/summarize-pylint.py +0 -0
  48. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/dev-config/black.toml +0 -0
  49. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/dev-config/pylint.toml +0 -0
  50. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/dev-config/pytest.ini +0 -0
  51. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/dev-requirements.txt +0 -0
  52. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/docs/Makefile +0 -0
  53. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/docs/ModelAPI.md +0 -0
  54. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/docs/SimpleGuide.md +0 -0
  55. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/docs/_.md +0 -0
  56. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/docs/api_reference.rst +0 -0
  57. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/docs/make.bat +0 -0
  58. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/docs/modules.rst +0 -0
  59. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/docs/sqlite_database.column.rst +1 -1
  60. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/docs/sqlite_database.config.rst +0 -0
  61. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/docs/sqlite_database.csv.rst +1 -1
  62. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/docs/sqlite_database.database.rst +1 -1
  63. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/docs/sqlite_database.errors.rst +1 -1
  64. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/docs/sqlite_database.functions.rst +1 -1
  65. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/docs/sqlite_database.locals.rst +1 -1
  66. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/docs/sqlite_database.model.errors.rst +0 -0
  67. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/docs/sqlite_database.model.helpers.rst +0 -0
  68. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/docs/sqlite_database.model.query_builder.rst +0 -0
  69. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/docs/sqlite_database.model.rst +0 -0
  70. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/docs/sqlite_database.operators.rst +1 -1
  71. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/docs/sqlite_database.query_builder.rst +1 -1
  72. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/docs/sqlite_database.signature.rst +1 -1
  73. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/docs/sqlite_database.subexp.rst +0 -0
  74. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/docs/sqlite_database.table.rst +1 -1
  75. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/docs/sqlite_database.typings.rst +1 -1
  76. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/docs/sqlite_database.utils.rst +1 -1
  77. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/docs-requirements.txt +0 -0
  78. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/project-init.bash +0 -0
  79. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/setup.cfg +0 -0
  80. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/setup.py +0 -0
  81. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/sqlite_database/_debug.py +0 -0
  82. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/sqlite_database/column.py +0 -0
  83. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/sqlite_database/csv.py +0 -0
  84. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/sqlite_database/database.py +0 -0
  85. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/sqlite_database/errors.py +0 -0
  86. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/sqlite_database/functions.py +0 -0
  87. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/sqlite_database/locals.py +0 -0
  88. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/sqlite_database/models/__init__.py +0 -0
  89. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/sqlite_database/models/errors.py +0 -0
  90. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/sqlite_database/models/helpers.py +0 -0
  91. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/sqlite_database/models/mixin.py +0 -0
  92. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/sqlite_database/models/query_builder.py +0 -0
  93. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/sqlite_database/models/type_checkers.py +0 -0
  94. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/sqlite_database/operators.py +0 -0
  95. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/sqlite_database/signature.py +0 -0
  96. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/sqlite_database/subquery.py +0 -0
  97. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/sqlite_database/table.py +0 -0
  98. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/sqlite_database/typings.py +0 -0
  99. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/sqlite_database/utils.py +0 -0
  100. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/sqlite_database/workers/__init__.py +0 -0
  101. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/sqlite_database/workers/connection.py +0 -0
  102. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/sqlite_database/workers/database.py +0 -0
  103. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/sqlite_database.egg-info/dependency_links.txt +0 -0
  104. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/sqlite_database.egg-info/requires.txt +0 -0
  105. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/sqlite_database.egg-info/top_level.txt +0 -0
  106. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/sqlite_database.egg-info/zip-safe +0 -0
  107. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/tests/__init__.py +0 -0
  108. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/tests/database/__init__.py +0 -0
  109. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/tests/database/model_api/__init__.py +0 -0
  110. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/tests/database/model_api/test_model_api.py +0 -0
  111. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/tests/database/setup.py +0 -0
  112. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/tests/database/table_api/__init__.py +0 -0
  113. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/tests/database/table_api/test_csv.py +0 -0
  114. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/tests/database/table_api/test_delete.py +0 -0
  115. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/tests/database/table_api/test_insert.py +0 -0
  116. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/tests/database/table_api/test_others.py +0 -0
  117. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/tests/database/table_api/test_select.py +0 -0
  118. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/tests/database/table_api/test_update.py +0 -0
  119. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/tests/database/test_custom.py +0 -0
  120. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/tests/manual_test_performances.py +0 -0
  121. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/tests/test_internals.py +0 -0
  122. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/tests/user_benchmark.py +0 -0
  123. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/tests/user_helpers.py +0 -0
  124. {sqlite_database-0.7.9 → sqlite_database-0.7.11}/transient/README.md +0 -0
@@ -28,4 +28,4 @@ jobs:
28
28
  pip install -r ./dev-requirements.txt
29
29
  - name: Analysing the code with pylint
30
30
  run: |
31
- pylint sqlite_database --rcfile dev-config/pylint.toml
31
+ pylint sqlite_database --rcfile dev-config/pylint.toml -f github
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sqlite_database
3
- Version: 0.7.9
4
- Summary: A weird wrapper for SQLite Connection
3
+ Version: 0.7.11
4
+ Summary: Easy to use SQLite wrapper
5
5
  Home-page: https://github.com/RimuEirnarn/sqlite_database
6
6
  Author: RimuEirnarn
7
7
  Author-email: Rimu Eirnarn <rimuru720@proton.me>
@@ -50,7 +50,7 @@ Dynamic: license-file
50
50
 
51
51
  </div>
52
52
 
53
- SQLite Database is a weird wrapper for SQLite Connection. It's intended to be easy to use and simple.
53
+ SQLite Database is an easy and simple way to use SQLite, almost as easy as using Laravel Eloquent ORM.
54
54
 
55
55
  > [!WARNING]
56
56
  > This project as per version number (<1.0) is not either efficient (in term of memory usage) and fast. If you found a serious problem, please let us know.
@@ -67,7 +67,7 @@ From previous versions, installations can be done using `pip install https://git
67
67
 
68
68
  ## Features
69
69
 
70
- Feature overview can be found in [Features.md](https://github.com/RimuEirnarn/sqlite_database/blob/main/Features.md)
70
+ Feature overview can be found in [Features.md](https://github.com/RimuEirnarn/sqlite_database/blob/main/docs/SimpleGuide.md)
71
71
 
72
72
  It's still recommended to see the [short docs](https://sqlite-database.rtfd.io/)
73
73
 
@@ -81,9 +81,11 @@ You can submit any issue if you found a good issue. You can submit a pull reques
81
81
 
82
82
  ## Development
83
83
 
84
- When pulling this repository with latest commit, make sure to install all `dev-requirements.txt` depending on your intentions. It's mostly pylint and pytest.
84
+ Thanks for considering in contributing to sqlite_database!
85
85
 
86
- When using `pytest`, do this: `pytest --config-file=./dev-config/pytest.ini` or check any check scripts in `bin/`
86
+ For development kits, you only need `pytest` and `pylint`, `sphinx` is required for documentation. Please refer to their own `dev-requirements.txt` and `docs-requirements.txt`
87
+
88
+ When using `pytest`, do this: `pytest --config-file=./dev-config/pytest.ini` or check any check scripts in `bin/` (e.g `bin/check.sh`)
87
89
 
88
90
  ### How to install?
89
91
 
@@ -24,7 +24,7 @@
24
24
 
25
25
  </div>
26
26
 
27
- SQLite Database is a weird wrapper for SQLite Connection. It's intended to be easy to use and simple.
27
+ SQLite Database is an easy and simple way to use SQLite, almost as easy as using Laravel Eloquent ORM.
28
28
 
29
29
  > [!WARNING]
30
30
  > This project as per version number (<1.0) is not either efficient (in term of memory usage) and fast. If you found a serious problem, please let us know.
@@ -41,7 +41,7 @@ From previous versions, installations can be done using `pip install https://git
41
41
 
42
42
  ## Features
43
43
 
44
- Feature overview can be found in [Features.md](https://github.com/RimuEirnarn/sqlite_database/blob/main/Features.md)
44
+ Feature overview can be found in [Features.md](https://github.com/RimuEirnarn/sqlite_database/blob/main/docs/SimpleGuide.md)
45
45
 
46
46
  It's still recommended to see the [short docs](https://sqlite-database.rtfd.io/)
47
47
 
@@ -55,9 +55,11 @@ You can submit any issue if you found a good issue. You can submit a pull reques
55
55
 
56
56
  ## Development
57
57
 
58
- When pulling this repository with latest commit, make sure to install all `dev-requirements.txt` depending on your intentions. It's mostly pylint and pytest.
58
+ Thanks for considering in contributing to sqlite_database!
59
59
 
60
- When using `pytest`, do this: `pytest --config-file=./dev-config/pytest.ini` or check any check scripts in `bin/`
60
+ For development kits, you only need `pytest` and `pylint`, `sphinx` is required for documentation. Please refer to their own `dev-requirements.txt` and `docs-requirements.txt`
61
+
62
+ When using `pytest`, do this: `pytest --config-file=./dev-config/pytest.ini` or check any check scripts in `bin/` (e.g `bin/check.sh`)
61
63
 
62
64
  ### How to install?
63
65
 
@@ -0,0 +1,60 @@
1
+ # TODO
2
+
3
+ **NOTE**: This TODO need to be written in markdown. use `[ ]` or `[x]` to mark todos
4
+
5
+ **High velocity** is required but make sure to do it with low overhead.
6
+
7
+ ## API Overview
8
+
9
+ **Table API** is dictionary-driven API for low-level operators such as Sub Query, functions, generic CRUD, and any other else.
10
+
11
+ **Model API** is a Model-driven API for higher-level operators with simplified usage, mimicking Laravel Eloquent ORM. Accessing Table API from Model API is as simple as calling `Model.get_table()`
12
+
13
+ ## SQLite API
14
+
15
+ What API should we bring? This todo is for simplification; you can do anything with `Database.sql` property
16
+
17
+ - [x] Table API function support
18
+ - [x] Pragmas (Database, only select few)
19
+ - [x] Table API subquery
20
+ - [ ] Table API `as` keyword
21
+ - [x] sqlite select data squash[^1] (squash=True, Table API)
22
+ - [x] sqlite select `what` data. Instead of using `select *`, we should also have `what`. Bring up few data than select everything.[^2]
23
+ - [x] Provide caching functions; not to cache sql returns but sql query, etc.[^3]
24
+ - [ ] Model API automatic migration helpers (Design schematic is ass, hard to implement)[^4]
25
+
26
+ ## Other functionality
27
+
28
+ The functionality here is outside of sqlite features such as export and import.
29
+
30
+ - [x] CSV Export
31
+ - [x] CSV Import
32
+
33
+
34
+ ---
35
+
36
+ [^1]: The term data crunching is when `select*` is used, typically the functions returns list of `Row`, by using `crunch=True`, the return value should be `Row[str, tuple[Any]]`
37
+
38
+ [^2]: If `what` parameter is specified to 1, we should return `tuple[Any, ...]` instead of `list[Row[str, Any]]` or `Row[str, Any]`
39
+
40
+ [^3]: Caching should **NOT** cache query data! Provide using `combine_keyvals` to create named params
41
+
42
+ [^4]: I need a way to implement migrations to advance to version `v0.7.10`, I need to know how migration works, how a Python code can translate into SQL, though I can just ask Table API query builder to parse columns. However, Table API's query builder sucks when we parse SQL query into Python objects, it can't translate inline column definitions for now. Can it? Maybe, if it can, some metadata is guaranteed lost if constraints are inlined. Table API has `rename_column` and `add_column` for convenience. Modify? Remove? not now.
43
+
44
+ Migration schematics:
45
+
46
+ The Schema table is described using Table API Builder column:
47
+
48
+ ```python
49
+ db.create_table("_schema_meta", [
50
+ text("table_name").primary(),
51
+ integer("version").default(1),
52
+ text("schema_json"),
53
+ real("created_at"),
54
+ real("updated_at")
55
+ ])
56
+ ```
57
+
58
+ The columns must be then normalized back to `Column` and manually compare which changes and which didn't.
59
+
60
+ Any fields that was significantly changed will force new table creation, subsequently followed up and refilled. If new entries are unique, the ORM is simply fucked unless provided with custom unique field generator (i.e, uuid4())
@@ -0,0 +1,8 @@
1
+ # Database Modes
2
+
3
+ The basic `Database` class has different flavor, but they all works as usual.
4
+
5
+ There's at least 2 implemented Databases, for now:
6
+
7
+ 1. Generic `Database` is what you'll use the most, single-threaded database that doesn't need explicit `.close()`
8
+ 2. Database Thread Worker `DatabaseWorker` found in `sqlite_database.workers`, intended multithreaded environment, just remember to `.close()` like regular threads.
@@ -21,8 +21,8 @@ import sqlite_database
21
21
  sqlite_database.test_installed()
22
22
 
23
23
  project = 'sqlite_database'
24
- copyright = '2023, RimuEirnarn'
25
- author = 'RimuEirnarn'
24
+ copyright = '2025, Rimu Aerisya (Rimu Eirnarn)'
25
+ author = 'Rimu Aerisya (Rimu Eirnarn)'
26
26
 
27
27
  # -- General configuration ---------------------------------------------------
28
28
  # https://www.sphinx-doc.org/en/master/usage/configuration.html#general-configuration
@@ -34,6 +34,7 @@ extensions = [
34
34
  'sphinx.ext.viewcode',
35
35
  'myst_parser',
36
36
  'sphinx.ext.napoleon',
37
+
37
38
  ]
38
39
 
39
40
  templates_path = ['_templates']
@@ -1,20 +1,30 @@
1
1
  .. sqlite_database documentation master file, created by
2
- sphinx-quickstart on Wed Apr 26 14:53:11 2023.
2
+ sphinx-quickstart on Sat Jul 26 19:21:12 2025.
3
3
  You can adapt this file completely to your liking, but it should at least
4
4
  contain the root `toctree` directive.
5
5
 
6
- sqlite-database Documentation
6
+ sqlite_database Documentation
7
7
  =============================
8
8
 
9
- SQLite Database
10
- ---------------
9
+ .. toctree::
10
+ :maxdepth: 12
11
+
12
+ :caption: SQLite Database
13
+
14
+ SimpleGuide
15
+ ModelAPI
16
+ DatabaseModes
17
+
18
+
19
+ API Documentation
20
+ =============================
11
21
 
12
22
  .. toctree::
13
- :maxdepth: 4
14
- :caption: SQLite Database
23
+ :maxdepth: 1
15
24
 
16
- SimpleGuide
17
- ModelAPI
25
+ :caption: API Documentation
26
+
27
+ api_reference
18
28
 
19
29
 
20
30
  Indices and tables
@@ -23,3 +33,4 @@ Indices and tables
23
33
  * :ref:`genindex`
24
34
  * :ref:`modindex`
25
35
  * :ref:`search`
36
+
@@ -0,0 +1,7 @@
1
+ sqlite\_database.models.errors module
2
+ =====================================
3
+
4
+ .. automodule:: sqlite_database.models.errors
5
+ :members:
6
+ :show-inheritance:
7
+ :undoc-members:
@@ -0,0 +1,7 @@
1
+ sqlite\_database.models.helpers module
2
+ ======================================
3
+
4
+ .. automodule:: sqlite_database.models.helpers
5
+ :members:
6
+ :show-inheritance:
7
+ :undoc-members:
@@ -0,0 +1,7 @@
1
+ sqlite\_database.models.mixin module
2
+ ====================================
3
+
4
+ .. automodule:: sqlite_database.models.mixin
5
+ :members:
6
+ :show-inheritance:
7
+ :undoc-members:
@@ -0,0 +1,7 @@
1
+ sqlite\_database.models.query\_builder module
2
+ =============================================
3
+
4
+ .. automodule:: sqlite_database.models.query_builder
5
+ :members:
6
+ :show-inheritance:
7
+ :undoc-members:
@@ -0,0 +1,22 @@
1
+ sqlite\_database.models package
2
+ ===============================
3
+
4
+ Submodules
5
+ ----------
6
+
7
+ .. toctree::
8
+ :maxdepth: 12
9
+
10
+ sqlite_database.models.errors
11
+ sqlite_database.models.helpers
12
+ sqlite_database.models.mixin
13
+ sqlite_database.models.query_builder
14
+ sqlite_database.models.type_checkers
15
+
16
+ Module contents
17
+ ---------------
18
+
19
+ .. automodule:: sqlite_database.models
20
+ :members:
21
+ :show-inheritance:
22
+ :undoc-members:
@@ -0,0 +1,7 @@
1
+ sqlite\_database.models.type\_checkers module
2
+ =============================================
3
+
4
+ .. automodule:: sqlite_database.models.type_checkers
5
+ :members:
6
+ :show-inheritance:
7
+ :undoc-members:
@@ -1,26 +1,39 @@
1
- SQLite Database
2
- ===============
1
+ API Documentation (sqlite_database)
2
+ ========================
3
+
4
+ Subpackages
5
+ -----------
6
+
7
+ .. toctree::
8
+ :maxdepth: 12
9
+
10
+ sqlite_database.models
11
+ sqlite_database.workers
3
12
 
4
13
  Submodules
5
14
  ----------
6
15
 
7
16
  .. toctree::
8
- :maxdepth: 4
17
+ :maxdepth: 12
9
18
 
10
19
  sqlite_database.column
11
20
  sqlite_database.csv
21
+ sqlite_database.database
12
22
  sqlite_database.errors
23
+ sqlite_database.functions
13
24
  sqlite_database.locals
14
25
  sqlite_database.operators
15
26
  sqlite_database.query_builder
16
27
  sqlite_database.signature
28
+ sqlite_database.subquery
17
29
  sqlite_database.table
18
30
  sqlite_database.typings
31
+ sqlite_database.utils
19
32
 
20
33
  Module contents
21
34
  ---------------
22
35
 
23
36
  .. automodule:: sqlite_database
24
37
  :members:
25
- :undoc-members:
26
38
  :show-inheritance:
39
+ :undoc-members:
@@ -0,0 +1,7 @@
1
+ sqlite\_database.subquery module
2
+ ================================
3
+
4
+ .. automodule:: sqlite_database.subquery
5
+ :members:
6
+ :show-inheritance:
7
+ :undoc-members:
@@ -0,0 +1,7 @@
1
+ sqlite\_database.workers.connection module
2
+ ==========================================
3
+
4
+ .. automodule:: sqlite_database.workers.connection
5
+ :members:
6
+ :show-inheritance:
7
+ :undoc-members:
@@ -0,0 +1,7 @@
1
+ sqlite\_database.workers.database module
2
+ ========================================
3
+
4
+ .. automodule:: sqlite_database.workers.database
5
+ :members:
6
+ :show-inheritance:
7
+ :undoc-members:
@@ -0,0 +1,19 @@
1
+ sqlite\_database.workers package
2
+ ================================
3
+
4
+ Submodules
5
+ ----------
6
+
7
+ .. toctree::
8
+ :maxdepth: 12
9
+
10
+ sqlite_database.workers.connection
11
+ sqlite_database.workers.database
12
+
13
+ Module contents
14
+ ---------------
15
+
16
+ .. automodule:: sqlite_database.workers
17
+ :members:
18
+ :show-inheritance:
19
+ :undoc-members:
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "sqlite_database"
7
- description = "A weird wrapper for SQLite Connection"
7
+ description = "Easy to use SQLite wrapper"
8
8
  authors = [
9
9
  {name = "Rimu Eirnarn", email = "rimuru720@proton.me"}
10
10
  ]
@@ -25,7 +25,7 @@ Repository = "https://github.com/RimuEirnarn/sqlite_database.git"
25
25
 
26
26
  [tool.setuptools]
27
27
  zip-safe = true
28
- packages = ["sqlite_database", "sqlite_database.models"]
28
+ packages = ["sqlite_database", "sqlite_database.models", "sqlite_database.workers"]
29
29
 
30
30
  [project.optional-dependencies]
31
31
  dev = ["pytest", "pylint", "black"]
@@ -15,7 +15,7 @@ def test_installed():
15
15
  return True
16
16
 
17
17
 
18
- __version__ = "0.7.9"
18
+ __version__ = "0.7.11"
19
19
  __all__ = [
20
20
  "Database",
21
21
  "Table",
@@ -108,20 +108,25 @@ def matches(pattern: Pattern, value: str):
108
108
  return True
109
109
 
110
110
 
111
- def check_one(data: str):
111
+ def check_one(data: str, bypass_list: tuple[str, ...] | None = None):
112
112
  """check one to check if a string contains illegal character OR
113
113
  if it is a reserved SQL keyword"""
114
114
  if matches(_re_valid, data) is True:
115
- raise SecurityError("Cannot parse unsafe data.")
115
+ exc = SecurityError("Cannot parse unsafe data.")
116
+ exc.add_note(f"Target: {data}")
117
+ raise exc
118
+ bp = bypass_list or []
116
119
  if data.upper() in _SQLITE_KEYWORDS:
120
+ if data in bp:
121
+ return data
117
122
  raise SecurityError(f'"{data}" is a reserved SQL keyword and cannot be used.')
118
123
  return data
119
124
 
120
125
 
121
- def check_iter(data: Iterable[str]):
126
+ def check_iter(data: Iterable[str], bypass_list: tuple[str, ...] | None = None):
122
127
  """An iterable checks as it's check_one"""
123
128
  for val in data:
124
- yield check_one(val)
129
+ check_one(val, bypass_list)
125
130
 
126
131
 
127
132
  class WithCursor(Cursor):
@@ -95,6 +95,12 @@ class QueryParams:
95
95
  order: Optional[CacheOrders] = None
96
96
  data: Optional[CacheData] = None
97
97
 
98
+ def __post_init__(self):
99
+ if not all(
100
+ (isinstance(getattr(self, item), int) for item in ("limit", "offset"))
101
+ ):
102
+ raise TypeError("Expected limit/offset to be integer")
103
+
98
104
  def __hash__(self):
99
105
  """Custom hash function to ensure compatibility with lru_cache."""
100
106
  return hash(
@@ -222,6 +228,7 @@ def extract_signature( # pylint: disable=too-many-locals
222
228
  data: dict[str, Any] = {}
223
229
 
224
230
  for key, value in filter_.items():
231
+ check_one(key)
225
232
  condition_id = generate_ids()
226
233
  if not isinstance(value, Signature):
227
234
  value = Signature(value, "=")
@@ -229,7 +236,8 @@ def extract_signature( # pylint: disable=too-many-locals
229
236
 
230
237
  val = (
231
238
  Signature(
232
- ":"+NAMING_FORMAT.format(
239
+ ":"
240
+ + NAMING_FORMAT.format(
233
241
  key=key,
234
242
  suffix=suffix,
235
243
  call_id=call_id,
@@ -497,7 +505,8 @@ def extract_subquery(subquery: SubQuery, depth: int = 1):
497
505
  subquery.where,
498
506
  subquery.cols,
499
507
  subquery.limit,
500
- subquery.orders, # type: ignore
508
+ 0, # type: ignore
509
+ subquery.orders # type: ignore
501
510
  ),
502
511
  depth=depth,
503
512
  )
@@ -542,9 +551,16 @@ def _setup_limit_patch(table_name: str, condition: str, limit):
542
551
  def _parse_orders(order: CacheOrders):
543
552
  if isinstance(order, tuple) and not isinstance(order[0], tuple):
544
553
  ord_, order_by = order
554
+ # print('here')
555
+ check_iter(order, ("asc", "desc")) # type: ignore
545
556
  return f"{ord_} {order_by}"
546
557
  if isinstance(order, tuple) and isinstance(order[0], tuple):
547
- return ", ".join(f"{ord_} {order_by}" for ord_, order_by in order)
558
+
559
+ return ", ".join(
560
+ f"{ord_} {order_by}"
561
+ for ord_, order_by in order
562
+ if check_iter((ord_, order_by), ("asc", "desc"))
563
+ )
548
564
  raise TypeError("What?", type(order))
549
565
 
550
566
 
@@ -570,12 +586,14 @@ def _build_select(query_params: QueryParams, depth: int = 0):
570
586
  )
571
587
  check_one(query_params.table_name)
572
588
  cond, data = extract_signature(query_params.condition, depth=depth)
573
- check_iter(query_params.only or ()) # type: ignore
574
589
  only_ = "*"
575
590
  if query_params.only and isinstance(query_params.only, ParsedFn):
576
591
  only_, _ = query_params.only.parse_sql()
592
+ check_iter(
593
+ (query_params.only.name, *(a for a in query_params.only.values if a != "*"))
594
+ )
577
595
  elif isinstance(query_params.only, tuple):
578
- only_ = f"{', '.join(column_name for column_name in query_params.only)}"
596
+ only_ = f"{', '.join(column_name for column_name in query_params.only if check_one(column_name))}"
579
597
  elif query_params.only != "*" and isinstance(query_params.only, str):
580
598
  only_ = check_one(query_params.only) # type: ignore
581
599
 
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: sqlite_database
3
- Version: 0.7.9
4
- Summary: A weird wrapper for SQLite Connection
3
+ Version: 0.7.11
4
+ Summary: Easy to use SQLite wrapper
5
5
  Home-page: https://github.com/RimuEirnarn/sqlite_database
6
6
  Author: RimuEirnarn
7
7
  Author-email: Rimu Eirnarn <rimuru720@proton.me>
@@ -50,7 +50,7 @@ Dynamic: license-file
50
50
 
51
51
  </div>
52
52
 
53
- SQLite Database is a weird wrapper for SQLite Connection. It's intended to be easy to use and simple.
53
+ SQLite Database is an easy and simple way to use SQLite, almost as easy as using Laravel Eloquent ORM.
54
54
 
55
55
  > [!WARNING]
56
56
  > This project as per version number (<1.0) is not either efficient (in term of memory usage) and fast. If you found a serious problem, please let us know.
@@ -67,7 +67,7 @@ From previous versions, installations can be done using `pip install https://git
67
67
 
68
68
  ## Features
69
69
 
70
- Feature overview can be found in [Features.md](https://github.com/RimuEirnarn/sqlite_database/blob/main/Features.md)
70
+ Feature overview can be found in [Features.md](https://github.com/RimuEirnarn/sqlite_database/blob/main/docs/SimpleGuide.md)
71
71
 
72
72
  It's still recommended to see the [short docs](https://sqlite-database.rtfd.io/)
73
73
 
@@ -81,9 +81,11 @@ You can submit any issue if you found a good issue. You can submit a pull reques
81
81
 
82
82
  ## Development
83
83
 
84
- When pulling this repository with latest commit, make sure to install all `dev-requirements.txt` depending on your intentions. It's mostly pylint and pytest.
84
+ Thanks for considering in contributing to sqlite_database!
85
85
 
86
- When using `pytest`, do this: `pytest --config-file=./dev-config/pytest.ini` or check any check scripts in `bin/`
86
+ For development kits, you only need `pytest` and `pylint`, `sphinx` is required for documentation. Please refer to their own `dev-requirements.txt` and `docs-requirements.txt`
87
+
88
+ When using `pytest`, do this: `pytest --config-file=./dev-config/pytest.ini` or check any check scripts in `bin/` (e.g `bin/check.sh`)
87
89
 
88
90
  ### How to install?
89
91
 
@@ -1,11 +1,9 @@
1
1
  .editorconfig
2
2
  .gitignore
3
3
  .readthedocs.yaml
4
- Features.md
5
4
  History.md
6
5
  LICENSE
7
6
  README.md
8
- SimpleGuide.md
9
7
  TODO.md
10
8
  dev-requirements.txt
11
9
  docs-requirements.txt
@@ -32,6 +30,7 @@ bin/need-installed/pre-commit
32
30
  dev-config/black.toml
33
31
  dev-config/pylint.toml
34
32
  dev-config/pytest.ini
33
+ docs/DatabaseModes.md
35
34
  docs/Makefile
36
35
  docs/ModelAPI.md
37
36
  docs/SimpleGuide.md
@@ -52,14 +51,24 @@ docs/sqlite_database.model.errors.rst
52
51
  docs/sqlite_database.model.helpers.rst
53
52
  docs/sqlite_database.model.query_builder.rst
54
53
  docs/sqlite_database.model.rst
54
+ docs/sqlite_database.models.errors.rst
55
+ docs/sqlite_database.models.helpers.rst
56
+ docs/sqlite_database.models.mixin.rst
57
+ docs/sqlite_database.models.query_builder.rst
58
+ docs/sqlite_database.models.rst
59
+ docs/sqlite_database.models.type_checkers.rst
55
60
  docs/sqlite_database.operators.rst
56
61
  docs/sqlite_database.query_builder.rst
57
62
  docs/sqlite_database.rst
58
63
  docs/sqlite_database.signature.rst
59
64
  docs/sqlite_database.subexp.rst
65
+ docs/sqlite_database.subquery.rst
60
66
  docs/sqlite_database.table.rst
61
67
  docs/sqlite_database.typings.rst
62
68
  docs/sqlite_database.utils.rst
69
+ docs/sqlite_database.workers.connection.rst
70
+ docs/sqlite_database.workers.database.rst
71
+ docs/sqlite_database.workers.rst
63
72
  sqlite_database/__init__.py
64
73
  sqlite_database/_debug.py
65
74
  sqlite_database/_utils.py