Changed database.get file. Added fetchall method calls to close session sooner
This commit is contained in:
parent
f299173e56
commit
bbc9650357
@ -35,8 +35,8 @@ def get_accounts(
|
||||
if to_sort:
|
||||
statement = statement.order_by(models.Account.name)
|
||||
with sqlmodel.Session(engine) as session:
|
||||
result = list(session.exec(statement))
|
||||
return result
|
||||
result = session.exec(statement).fetchall()
|
||||
return result
|
||||
|
||||
|
||||
def get_all_accounts(
|
||||
@ -52,16 +52,16 @@ def get_all_accounts(
|
||||
.order_by(models.Account.name)
|
||||
)
|
||||
with sqlmodel.Session(engine) as session:
|
||||
result = session.exec(statement)
|
||||
yield from (
|
||||
(
|
||||
account.name,
|
||||
account.salt,
|
||||
account.enc_login,
|
||||
account.enc_password,
|
||||
)
|
||||
for account in result
|
||||
result = session.exec(statement).fetchall()
|
||||
yield from (
|
||||
(
|
||||
account.name,
|
||||
account.salt,
|
||||
account.enc_login,
|
||||
account.enc_password,
|
||||
)
|
||||
for account in result
|
||||
)
|
||||
|
||||
|
||||
def get_account_info(
|
||||
|
Reference in New Issue
Block a user