🐛 fix(manager.py): fix import statement to include Dict in typing module

 feat(manager.py): refactor check_table method in DatabaseManager class to use list comprehension for improved readability and performance
This commit is contained in:
Gabriel Luiz Freitas Almeida 2023-09-05 09:34:45 -03:00
commit ae2e993680
2 changed files with 5 additions and 7 deletions

View file

@ -107,12 +107,10 @@ class DatabaseManager(Service):
# We will check that all models are in the database
# and that the database is up to date with all columns
sql_models = [models.Flow, models.User, models.ApiKey]
results = []
for sql_model in sql_models:
results.append(
TableResults(sql_model.__tablename__, self.check_table(sql_model))
)
return results
return [
TableResults(sql_model.__tablename__, self.check_table(sql_model))
for sql_model in sql_models
]
def check_table(self, model):
results = []

View file

@ -1,5 +1,5 @@
from langflow.services.schema import ServiceType
from typing import TYPE_CHECKING, List, Optional
from typing import TYPE_CHECKING, Dict, List, Optional
from loguru import logger
if TYPE_CHECKING: