@@ -161,17 +161,15 @@ from fastapi_quickcrud import CrudMethods
161161from fastapi_quickcrud import sqlalchemy_to_pydantic
162162from fastapi_quickcrud.misc.memory_sql import sync_memory_db
163163
164- app = FastAPI()
165-
166- Base = declarative_base()
167- metadata = Base.metadata
168-
169164from sqlalchemy import CHAR , Column, Integer
170165from sqlalchemy.ext.declarative import declarative_base
171166
167+ app = FastAPI()
168+
172169Base = declarative_base()
173170metadata = Base.metadata
174171
172+
175173class Child (Base ):
176174 __tablename__ = ' right'
177175 id = Column(Integer, primary_key = True )
@@ -190,14 +188,15 @@ friend_model_set = sqlalchemy_to_pydantic(db_model=Child,
190188 ],
191189 exclude_columns = [])
192190
193- post_model = friend_model_set.POST [CrudMethods.CREATE_ONE ]
194191
192+ post_model = friend_model_set.POST [CrudMethods.CREATE_ONE ]
195193sync_memory_db.create_memory_table(Child)
194+
196195@app.post (" /hello" ,
197- status_code = 201 ,
196+ status_code = 201 ,
198197 tags = [" Child" ],
199- response_model = post_model.responseModel,
200- dependencies = [])
198+ response_model = post_model.responseModel,
199+ dependencies = [])
201200async def my_api (
202201 query : post_model.requestBodyModel = Depends(post_model.requestBodyModel),
203202 session = Depends(sync_memory_db.get_memory_db_session)
@@ -208,6 +207,8 @@ async def my_api(
208207 session.refresh(db_item)
209208 return db_item.__dict__
210209
210+
211+
211212uvicorn.run(app, host = " 0.0.0.0" , port = 8000 , debug = False )
212213
213214```
0 commit comments