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:
|
if to_sort:
|
||||||
statement = statement.order_by(models.Account.name)
|
statement = statement.order_by(models.Account.name)
|
||||||
with sqlmodel.Session(engine) as session:
|
with sqlmodel.Session(engine) as session:
|
||||||
result = list(session.exec(statement))
|
result = session.exec(statement).fetchall()
|
||||||
return result
|
return result
|
||||||
|
|
||||||
|
|
||||||
def get_all_accounts(
|
def get_all_accounts(
|
||||||
@ -52,16 +52,16 @@ def get_all_accounts(
|
|||||||
.order_by(models.Account.name)
|
.order_by(models.Account.name)
|
||||||
)
|
)
|
||||||
with sqlmodel.Session(engine) as session:
|
with sqlmodel.Session(engine) as session:
|
||||||
result = session.exec(statement)
|
result = session.exec(statement).fetchall()
|
||||||
yield from (
|
yield from (
|
||||||
(
|
(
|
||||||
account.name,
|
account.name,
|
||||||
account.salt,
|
account.salt,
|
||||||
account.enc_login,
|
account.enc_login,
|
||||||
account.enc_password,
|
account.enc_password,
|
||||||
)
|
|
||||||
for account in result
|
|
||||||
)
|
)
|
||||||
|
for account in result
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
def get_account_info(
|
def get_account_info(
|
||||||
|
Reference in New Issue
Block a user