Skip to content

Commit 3b425a0

Browse files
committed
add sql_type to declare db
1 parent 99c93a3 commit 3b425a0

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/fastapi_quickcrud/crud_router.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ def crud_router_builder(
4040
dependencies: Optional[List[callable]] = None,
4141
crud_models: Optional[CRUDModel] = None,
4242
async_mode: Optional[bool] = None,
43+
sql_type: Optional[str] = None,
4344
**router_kwargs: Any) -> APIRouter:
4445
"""
4546
:param db_session: Callable function
@@ -110,9 +111,9 @@ def get_transaction_session():
110111
if async_mode:
111112
async def async_runner(f):
112113
return [i.bind.name async for i in f()]
113-
114-
sql_type, = asyncio.get_event_loop().run_until_complete(async_runner(db_session))
115-
else:
114+
if sql_type is None:
115+
sql_type, = asyncio.get_event_loop().run_until_complete(async_runner(db_session))
116+
elif sql_type is None:
116117
sql_type, = [i.bind.name for i in db_session()]
117118

118119
if not crud_methods and NO_PRIMARY_KEY == False:

0 commit comments

Comments
 (0)