Fixed an error with fetch_if

This commit is contained in:
Ege Emir Özkan
2020-08-03 05:45:30 +03:00
parent 9729c83247
commit a1cacb9372

View File

@@ -199,8 +199,8 @@ def fetch_if(class_: type, condition: str) -> tuple:
with sql.connect(getattr(class_, 'db_path')) as con:
cur: sql.Cursor = con.cursor()
cur.execute(f"SELECT * FROM {table_name} WHERE {condition};")
field_names: List[str] = _get_table_cols(cur, table_name)
records: list = cur.fetchall()
field_names: List[str] = _get_table_cols(cur, table_name)
return tuple(_convert_record_to_object(class_, record, field_names) for record in records)