1616upsert = get_sql_dialect_import (dialect = get_val ("SQL_DIALECT" ))
1717
1818
19+ @logger .catch
1920async def get_result_from_query (query : SelectOfScalar , session : AsyncSession ):
2021 """
2122 Processes an SQLModel query object and returns a singular result from the
@@ -37,6 +38,7 @@ async def get_result_from_query(query: SelectOfScalar, session: AsyncSession):
3738 return results
3839
3940
41+ @logger .catch
4042async def get_one_or_create (
4143 session_inst : AsyncSession ,
4244 model : type [SQLModel ],
@@ -86,6 +88,7 @@ async def _get_entry(sqlmodel, **key_args):
8688 return created , False
8789
8890
91+ @logger .catch
8992async def write_row (data_row : Type [SQLModel ], session_inst : AsyncSession ):
9093 """
9194 Writes a new instance of an SQLModel ORM model to the database, with an
@@ -110,6 +113,7 @@ async def write_row(data_row: Type[SQLModel], session_inst: AsyncSession):
110113 return False , None
111114
112115
116+ @logger .catch
113117async def insert_data_rows (data_rows , session_inst : AsyncSession ):
114118 try :
115119 session_inst .add_all (data_rows )
@@ -145,6 +149,7 @@ async def insert_data_rows(data_rows, session_inst: AsyncSession):
145149 return status , {"success" : processed_rows , "failed" : failed_rows }
146150
147151
152+ @logger .catch
148153async def get_row (
149154 id_str : str or int ,
150155 session_inst : AsyncSession ,
@@ -172,6 +177,7 @@ async def get_row(
172177 return success , row
173178
174179
180+ @logger .catch
175181async def get_rows (
176182 session_inst : AsyncSession ,
177183 model : type [SQLModel ],
@@ -244,6 +250,7 @@ async def get_rows(
244250 return success , results
245251
246252
253+ @logger .catch
247254async def get_rows_within_id_list (
248255 id_str_list : list [str | int ],
249256 session_inst : AsyncSession ,
@@ -261,6 +268,7 @@ async def get_rows_within_id_list(
261268 return success , results
262269
263270
271+ @logger .catch
264272async def delete_row (
265273 id_str : str or int ,
266274 session_inst : AsyncSession ,
@@ -290,6 +298,7 @@ async def delete_row(
290298 return success
291299
292300
301+ @logger .catch
293302async def bulk_upsert_mappings (
294303 payload : list ,
295304 session_inst : AsyncSession ,
@@ -316,6 +325,7 @@ async def bulk_upsert_mappings(
316325 return False
317326
318327
328+ @logger .catch
319329async def update_row (
320330 id_str : int | str ,
321331 data : dict ,
0 commit comments