auto-rest-api 0.1.6__tar.gz → 0.1.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.
- {auto_rest_api-0.1.6 → auto_rest_api-0.1.11}/LICENSE.md +0 -56
- {auto_rest_api-0.1.6 → auto_rest_api-0.1.11}/PKG-INFO +14 -14
- {auto_rest_api-0.1.6 → auto_rest_api-0.1.11}/auto_rest/app.py +1 -1
- {auto_rest_api-0.1.6 → auto_rest_api-0.1.11}/auto_rest/handlers.py +4 -2
- {auto_rest_api-0.1.6 → auto_rest_api-0.1.11}/auto_rest/interfaces.py +7 -4
- {auto_rest_api-0.1.6 → auto_rest_api-0.1.11}/pyproject.toml +16 -16
- {auto_rest_api-0.1.6 → auto_rest_api-0.1.11}/README.md +0 -0
- {auto_rest_api-0.1.6 → auto_rest_api-0.1.11}/auto_rest/__init__.py +0 -0
- {auto_rest_api-0.1.6 → auto_rest_api-0.1.11}/auto_rest/__main__.py +0 -0
- {auto_rest_api-0.1.6 → auto_rest_api-0.1.11}/auto_rest/cli.py +0 -0
- {auto_rest_api-0.1.6 → auto_rest_api-0.1.11}/auto_rest/models.py +0 -0
- {auto_rest_api-0.1.6 → auto_rest_api-0.1.11}/auto_rest/queries.py +0 -0
- {auto_rest_api-0.1.6 → auto_rest_api-0.1.11}/auto_rest/routers.py +0 -0
|
@@ -617,59 +617,3 @@ Program, unless a warranty or assumption of liability accompanies a
|
|
|
617
617
|
copy of the Program in return for a fee.
|
|
618
618
|
|
|
619
619
|
END OF TERMS AND CONDITIONS
|
|
620
|
-
|
|
621
|
-
## How to Apply These Terms to Your New Programs
|
|
622
|
-
|
|
623
|
-
If you develop a new program, and you want it to be of the greatest
|
|
624
|
-
possible use to the public, the best way to achieve this is to make it
|
|
625
|
-
free software which everyone can redistribute and change under these
|
|
626
|
-
terms.
|
|
627
|
-
|
|
628
|
-
To do so, attach the following notices to the program. It is safest to
|
|
629
|
-
attach them to the start of each source file to most effectively state
|
|
630
|
-
the exclusion of warranty; and each file should have at least the
|
|
631
|
-
"copyright" line and a pointer to where the full notice is found.
|
|
632
|
-
|
|
633
|
-
<one line to give the program's name and a brief idea of what it does.>
|
|
634
|
-
Copyright (C) <year> <name of author>
|
|
635
|
-
|
|
636
|
-
This program is free software: you can redistribute it and/or modify
|
|
637
|
-
it under the terms of the GNU General Public License as published by
|
|
638
|
-
the Free Software Foundation, either version 3 of the License, or
|
|
639
|
-
(at your option) any later version.
|
|
640
|
-
|
|
641
|
-
This program is distributed in the hope that it will be useful,
|
|
642
|
-
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
643
|
-
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
644
|
-
GNU General Public License for more details.
|
|
645
|
-
|
|
646
|
-
You should have received a copy of the GNU General Public License
|
|
647
|
-
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
648
|
-
|
|
649
|
-
Also add information on how to contact you by electronic and paper
|
|
650
|
-
mail.
|
|
651
|
-
|
|
652
|
-
If the program does terminal interaction, make it output a short
|
|
653
|
-
notice like this when it starts in an interactive mode:
|
|
654
|
-
|
|
655
|
-
<program> Copyright (C) <year> <name of author>
|
|
656
|
-
This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
|
|
657
|
-
This is free software, and you are welcome to redistribute it
|
|
658
|
-
under certain conditions; type `show c' for details.
|
|
659
|
-
|
|
660
|
-
The hypothetical commands \`show w' and \`show c' should show the
|
|
661
|
-
appropriate parts of the General Public License. Of course, your
|
|
662
|
-
program's commands might be different; for a GUI interface, you would
|
|
663
|
-
use an "about box".
|
|
664
|
-
|
|
665
|
-
You should also get your employer (if you work as a programmer) or
|
|
666
|
-
school, if any, to sign a "copyright disclaimer" for the program, if
|
|
667
|
-
necessary. For more information on this, and how to apply and follow
|
|
668
|
-
the GNU GPL, see <https://www.gnu.org/licenses/>.
|
|
669
|
-
|
|
670
|
-
The GNU General Public License does not permit incorporating your
|
|
671
|
-
program into proprietary programs. If your program is a subroutine
|
|
672
|
-
library, you may consider it more useful to permit linking proprietary
|
|
673
|
-
applications with the library. If this is what you want to do, use the
|
|
674
|
-
GNU Lesser General Public License instead of this License. But first,
|
|
675
|
-
please read <https://www.gnu.org/licenses/why-not-lgpl.html>.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: auto-rest-api
|
|
3
|
-
Version: 0.1.
|
|
3
|
+
Version: 0.1.11
|
|
4
4
|
Summary: Automatically map database schemas and deploy per-table REST API endpoints.
|
|
5
5
|
License: GPL-3.0-only
|
|
6
6
|
Keywords: Better,HPC,automatic,rest,api
|
|
@@ -18,20 +18,20 @@ Classifier: Topic :: Internet :: WWW/HTTP
|
|
|
18
18
|
Classifier: Topic :: Internet :: WWW/HTTP :: HTTP Servers
|
|
19
19
|
Classifier: Topic :: Software Development
|
|
20
20
|
Classifier: Typing :: Typed
|
|
21
|
-
Requires-Dist: aiomysql (
|
|
22
|
-
Requires-Dist: aioodbc (
|
|
23
|
-
Requires-Dist: aiosqlite (
|
|
24
|
-
Requires-Dist: asgi-correlation-id (
|
|
25
|
-
Requires-Dist: asyncpg (
|
|
21
|
+
Requires-Dist: aiomysql (==0.3.2)
|
|
22
|
+
Requires-Dist: aioodbc (==0.5.0)
|
|
23
|
+
Requires-Dist: aiosqlite (==0.20.0)
|
|
24
|
+
Requires-Dist: asgi-correlation-id (==4.3.4)
|
|
25
|
+
Requires-Dist: asyncpg (==0.30.0)
|
|
26
26
|
Requires-Dist: colorlog (>=6.9.0,<7.0.0)
|
|
27
|
-
Requires-Dist: fastapi (
|
|
28
|
-
Requires-Dist: greenlet (
|
|
29
|
-
Requires-Dist: httpx (
|
|
30
|
-
Requires-Dist: oracledb (
|
|
31
|
-
Requires-Dist: pydantic (
|
|
32
|
-
Requires-Dist: pyyaml (
|
|
33
|
-
Requires-Dist: sqlalchemy (
|
|
34
|
-
Requires-Dist: uvicorn (
|
|
27
|
+
Requires-Dist: fastapi (==0.120.1)
|
|
28
|
+
Requires-Dist: greenlet (==3.2.4)
|
|
29
|
+
Requires-Dist: httpx (==0.28.1)
|
|
30
|
+
Requires-Dist: oracledb (==2.5.1)
|
|
31
|
+
Requires-Dist: pydantic (==2.12.3)
|
|
32
|
+
Requires-Dist: pyyaml (==6.0.3)
|
|
33
|
+
Requires-Dist: sqlalchemy (==2.0.44)
|
|
34
|
+
Requires-Dist: uvicorn (==0.38.0)
|
|
35
35
|
Description-Content-Type: text/markdown
|
|
36
36
|
|
|
37
37
|
# Auto-REST
|
|
@@ -55,7 +55,7 @@ async def logging_middleware(request: Request, call_next: callable) -> Response:
|
|
|
55
55
|
response = await call_next(request)
|
|
56
56
|
|
|
57
57
|
except Exception as exc:
|
|
58
|
-
logger.error(str(
|
|
58
|
+
logger.error(str(exc), exc_info=exc, extra=request_meta)
|
|
59
59
|
raise
|
|
60
60
|
|
|
61
61
|
# Log the outgoing response
|
|
@@ -211,7 +211,9 @@ def create_list_records_handler(engine: DBEngine, table: Table) -> Callable[...,
|
|
|
211
211
|
for param, value in filters:
|
|
212
212
|
if value is not None:
|
|
213
213
|
column = getattr(table.c, param)
|
|
214
|
-
|
|
214
|
+
|
|
215
|
+
# Use a "_null_" parameter value to represent a `None` database value
|
|
216
|
+
if isinstance(value, str) and value.lower() == "_null_":
|
|
215
217
|
query = query.filter(column.is_(None))
|
|
216
218
|
|
|
217
219
|
else:
|
|
@@ -325,7 +327,7 @@ def create_put_record_handler(engine: DBEngine, table: Table) -> Callable[..., A
|
|
|
325
327
|
setattr(record, key, value)
|
|
326
328
|
|
|
327
329
|
await commit_session(session)
|
|
328
|
-
return
|
|
330
|
+
return record
|
|
329
331
|
|
|
330
332
|
return put_record_handler
|
|
331
333
|
|
|
@@ -6,8 +6,11 @@ which force interface fields to be optional or read only.
|
|
|
6
6
|
|
|
7
7
|
!!! example "Example: Creating an Interface"
|
|
8
8
|
|
|
9
|
-
The `
|
|
10
|
-
|
|
9
|
+
The `create_interface` method creates a Pydantic interface class derived
|
|
10
|
+
from a SQLAlchemy table. By default, interface fields are marked as
|
|
11
|
+
required based on the underlying schema. The `mode` argument is used to
|
|
12
|
+
override field definitions and make all fields in the interface either
|
|
13
|
+
`optional` or `required` regardless of the schema definition.
|
|
11
14
|
|
|
12
15
|
```python
|
|
13
16
|
default_interface = create_interface(database_model)
|
|
@@ -52,7 +55,7 @@ def create_field_definition(col: Column, mode: MODE_TYPE = "default") -> tuple[t
|
|
|
52
55
|
Modes:
|
|
53
56
|
default: Values are marked as (not)required based on the column schema.
|
|
54
57
|
required: Values are always marked required.
|
|
55
|
-
|
|
58
|
+
optional: Values are always marked optional.
|
|
56
59
|
|
|
57
60
|
Args:
|
|
58
61
|
col: The column to return values for.
|
|
@@ -91,7 +94,7 @@ def create_interface(table: Table, pk_only: bool = False, mode: MODE_TYPE = "def
|
|
|
91
94
|
Modes:
|
|
92
95
|
default: Values are marked as (not)required based on the column schema.
|
|
93
96
|
required: Values are always marked required.
|
|
94
|
-
|
|
97
|
+
optional: Values are always marked optional.
|
|
95
98
|
|
|
96
99
|
Args:
|
|
97
100
|
table: The SQLAlchemy table to create an interface for.
|
|
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
|
|
|
4
4
|
|
|
5
5
|
[project]
|
|
6
6
|
name = "auto-rest-api"
|
|
7
|
-
version = "0.1.
|
|
7
|
+
version = "0.1.11"
|
|
8
8
|
readme = "README.md"
|
|
9
9
|
description = "Automatically map database schemas and deploy per-table REST API endpoints."
|
|
10
10
|
authors = [{ name = "Better HPC LLC" }]
|
|
@@ -26,20 +26,20 @@ classifiers = [
|
|
|
26
26
|
]
|
|
27
27
|
requires-python = ">=3.11,<4"
|
|
28
28
|
dependencies = [
|
|
29
|
-
"aiomysql
|
|
30
|
-
"aioodbc
|
|
31
|
-
"aiosqlite
|
|
32
|
-
"asgi-correlation-id
|
|
33
|
-
"asyncpg
|
|
29
|
+
"aiomysql==0.3.2",
|
|
30
|
+
"aioodbc==0.5.0",
|
|
31
|
+
"aiosqlite==0.20.0",
|
|
32
|
+
"asgi-correlation-id==4.3.4",
|
|
33
|
+
"asyncpg==0.30.0",
|
|
34
34
|
"colorlog (>=6.9.0,<7.0.0)",
|
|
35
|
-
"fastapi
|
|
36
|
-
"greenlet
|
|
37
|
-
"httpx
|
|
38
|
-
"oracledb
|
|
39
|
-
"pydantic
|
|
40
|
-
"pyyaml
|
|
41
|
-
"sqlalchemy
|
|
42
|
-
"uvicorn
|
|
35
|
+
"fastapi==0.120.1",
|
|
36
|
+
"greenlet==3.2.4",
|
|
37
|
+
"httpx==0.28.1",
|
|
38
|
+
"oracledb==2.5.1",
|
|
39
|
+
"pydantic==2.12.3",
|
|
40
|
+
"pyyaml==6.0.3",
|
|
41
|
+
"sqlalchemy==2.0.44",
|
|
42
|
+
"uvicorn==0.38.0",
|
|
43
43
|
]
|
|
44
44
|
|
|
45
45
|
[tool.poetry]
|
|
@@ -52,8 +52,8 @@ coverage = "*"
|
|
|
52
52
|
|
|
53
53
|
[tool.poetry.group.docs.dependencies]
|
|
54
54
|
mkdocs = "^1.6.1"
|
|
55
|
-
mkdocs-material = "^9.
|
|
56
|
-
mkdocstrings-python = "^1.
|
|
55
|
+
mkdocs-material = "^9.6.23"
|
|
56
|
+
mkdocstrings-python = "^1.18.2"
|
|
57
57
|
|
|
58
58
|
[tool.poetry.scripts]
|
|
59
59
|
auto-rest = "auto_rest.__main__:main"
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|