auto-rest-api 0.1.6__py3-none-any.whl → 0.1.11__py3-none-any.whl

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/app.py CHANGED
@@ -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(exec), exc_info=exc, extra=request_meta)
58
+ logger.error(str(exc), exc_info=exc, extra=request_meta)
59
59
  raise
60
60
 
61
61
  # Log the outgoing response
auto_rest/handlers.py CHANGED
@@ -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
- if value.lower() == "_null_":
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 interface.model_validate(record.__dict__)
330
+ return record
329
331
 
330
332
  return put_record_handler
331
333
 
auto_rest/interfaces.py CHANGED
@@ -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 `create_interface_default` method creates an interface class
10
- based on a SQLAlchemy table.
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
- required: Values are always marked optional.
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
- required: Values are always marked optional.
97
+ optional: Values are always marked optional.
95
98
 
96
99
  Args:
97
100
  table: The SQLAlchemy table to create an interface for.
@@ -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.6
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 (>=0.2,<1.0)
22
- Requires-Dist: aioodbc (>=0.5,<1.0)
23
- Requires-Dist: aiosqlite (>=0.20,<1.0)
24
- Requires-Dist: asgi-correlation-id (>=4.3.4,<5.0.0)
25
- Requires-Dist: asyncpg (>=0.30,<1.0)
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 (>=0.115,<1.0)
28
- Requires-Dist: greenlet (>=3.1,<4.0)
29
- Requires-Dist: httpx (>=0.28,<1.0)
30
- Requires-Dist: oracledb (>=2.5,<3.0)
31
- Requires-Dist: pydantic (>=2.10,<3.0)
32
- Requires-Dist: pyyaml (>=6.0.2,<7.0.0)
33
- Requires-Dist: sqlalchemy (>=2.0,<3.0)
34
- Requires-Dist: uvicorn (>=0.34,<1.0)
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
@@ -0,0 +1,14 @@
1
+ auto_rest/__init__.py,sha256=9ICmv2urSoAo856FJylKdorF19UsUGc4eyORYLptf1Q,69
2
+ auto_rest/__main__.py,sha256=VkLZ9j1Q9I0isYvO0Bj1HHCQ9Ew_r5O7a0Dn4fUi5Lo,2233
3
+ auto_rest/app.py,sha256=OgER3IUwX_IrbZWA8kzcBMNm-XXaP8hHK_wnVrNtgdw,3189
4
+ auto_rest/cli.py,sha256=k07_ucmsxholhiikL41VgrAEPKHX3_ay-qGvRvmQwxA,6250
5
+ auto_rest/handlers.py,sha256=rYcrPHKLzVDuM1KqhSZAjgSp4K32RBQD5Lpk9mBuU7Y,13429
6
+ auto_rest/interfaces.py,sha256=OZdgNYWfeDkB7LTJIIZC-3fdUne3BMX5fTzYnI8d_vQ,4043
7
+ auto_rest/models.py,sha256=g_oLzgxl39WfNWzf3yAu4_HiPF5ht30yydjsGfB4pJA,6017
8
+ auto_rest/queries.py,sha256=2e6f_S4n1xvaSY8rYJG-koDmqiXHreOIRUteRuqZlv8,3058
9
+ auto_rest/routers.py,sha256=SZoOugauKdCk2Kqzzp9o6tGENusAsP1-YP-6Aam53tc,5636
10
+ auto_rest_api-0.1.11.dist-info/LICENSE.md,sha256=JSgRKnSxtSj_-6cOmmvoBeiJzl9ZP0k-2iM-f42pIqM,32175
11
+ auto_rest_api-0.1.11.dist-info/METADATA,sha256=dOdoSWQFWLzWciRM1HdCuqLeeKx_ejrGzzLIXyPdDDE,2869
12
+ auto_rest_api-0.1.11.dist-info/WHEEL,sha256=RaoafKOydTQ7I_I3JTrPCg6kUmTgtm4BornzOqyEfJ8,88
13
+ auto_rest_api-0.1.11.dist-info/entry_points.txt,sha256=zFynmBrHyYo3Ds0Uo4-bTFe1Tdr5mIXV4dPQOFb-W1w,53
14
+ auto_rest_api-0.1.11.dist-info/RECORD,,
@@ -1,14 +0,0 @@
1
- auto_rest/__init__.py,sha256=9ICmv2urSoAo856FJylKdorF19UsUGc4eyORYLptf1Q,69
2
- auto_rest/__main__.py,sha256=VkLZ9j1Q9I0isYvO0Bj1HHCQ9Ew_r5O7a0Dn4fUi5Lo,2233
3
- auto_rest/app.py,sha256=1R8niLADFPI9Zpegdrpt9ITFMHaIj0E6tsgF59dRr38,3190
4
- auto_rest/cli.py,sha256=k07_ucmsxholhiikL41VgrAEPKHX3_ay-qGvRvmQwxA,6250
5
- auto_rest/handlers.py,sha256=QgiVnNxxi_LWon5pb0CktV347EPD1kcahSW726vAreA,13350
6
- auto_rest/interfaces.py,sha256=WB_0eMDjGF8DpnDN9INHqo7u4x3aklvzAYK4t3JwC7s,3779
7
- auto_rest/models.py,sha256=g_oLzgxl39WfNWzf3yAu4_HiPF5ht30yydjsGfB4pJA,6017
8
- auto_rest/queries.py,sha256=2e6f_S4n1xvaSY8rYJG-koDmqiXHreOIRUteRuqZlv8,3058
9
- auto_rest/routers.py,sha256=SZoOugauKdCk2Kqzzp9o6tGENusAsP1-YP-6Aam53tc,5636
10
- auto_rest_api-0.1.6.dist-info/LICENSE.md,sha256=zFRw_u1mGSOH8GrpOu0L1P765aX9fB5UpKz06mTxAos,34893
11
- auto_rest_api-0.1.6.dist-info/METADATA,sha256=Cv0Zw-T0nGfp9TpK-Hw0d6NQICOwtURzyifpwi3tM9k,2914
12
- auto_rest_api-0.1.6.dist-info/WHEEL,sha256=RaoafKOydTQ7I_I3JTrPCg6kUmTgtm4BornzOqyEfJ8,88
13
- auto_rest_api-0.1.6.dist-info/entry_points.txt,sha256=zFynmBrHyYo3Ds0Uo4-bTFe1Tdr5mIXV4dPQOFb-W1w,53
14
- auto_rest_api-0.1.6.dist-info/RECORD,,