Repository: LuisLuii/fastapi-crud-template-generator (language: python)

Issue:
Feature/fix template



Discussion / hints:

Fix patch:
diff --git a/src/fastapi_quickcrud_codegen/model/template/route/find_many.jinja2 b/src/fastapi_quickcrud_codegen/model/template/route/find_many.jinja2
index 756ea4c..b851901 100644
--- a/src/fastapi_quickcrud_codegen/model/template/route/find_many.jinja2
+++ b/src/fastapi_quickcrud_codegen/model/template/route/find_many.jinja2
@@ -31,7 +31,7 @@
         if order_by_query_list:
             stmt = stmt.order_by(*order_by_query_list)
 
-    sql_executed_result_without_paginate = await session.execute(stmt)
+    sql_executed_result_without_paginate = {{ 'await ' if is_async else '' }}session.execute(stmt)
     total = len(sql_executed_result_without_paginate.fetchall())
 
     if total < 1:


Test patch:
diff --git a/test/test_memory_db_sync_find_many.py b/test/test_memory_db_sync_find_many.py
index 30bf065..8748a5b 100644
--- a/test/test_memory_db_sync_find_many.py
+++ b/test/test_memory_db_sync_find_many.py
@@ -489,7 +489,7 @@ def get_many(response: Response,
         if order_by_query_list:
             stmt = stmt.order_by(*order_by_query_list)
 
-    sql_executed_result_without_paginate = await session.execute(stmt)
+    sql_executed_result_without_paginate = session.execute(stmt)
     total = len(sql_executed_result_without_paginate.fetchall())
 
     if total < 1:
@@ -567,7 +567,7 @@ def get_many(response: Response,
         if order_by_query_list:
             stmt = stmt.order_by(*order_by_query_list)
 
-    sql_executed_result_without_paginate = await session.execute(stmt)
+    sql_executed_result_without_paginate = session.execute(stmt)
     total = len(sql_executed_result_without_paginate.fetchall())
 
     if total < 1:
diff --git a/test/test_postgresql_db_sync_find_many.py b/test/test_postgresql_db_sync_find_many.py
index f6a9448..a60a29b 100644
--- a/test/test_postgresql_db_sync_find_many.py
+++ b/test/test_postgresql_db_sync_find_many.py
@@ -523,7 +523,7 @@ def get_many(response: Response,
         if order_by_query_list:
             stmt = stmt.order_by(*order_by_query_list)
 
-    sql_executed_result_without_paginate = await session.execute(stmt)
+    sql_executed_result_without_paginate = session.execute(stmt)
     total = len(sql_executed_result_without_paginate.fetchall())
 
     if total < 1:
@@ -601,7 +601,7 @@ def get_many(response: Response,
         if order_by_query_list:
             stmt = stmt.order_by(*order_by_query_list)
 
-    sql_executed_result_without_paginate = await session.execute(stmt)
+    sql_executed_result_without_paginate = session.execute(stmt)
     total = len(sql_executed_result_without_paginate.fetchall())
 
     if total < 1: