🐛 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 # We will check that all models are in the database
# and that the database is up to date with all columns # and that the database is up to date with all columns
sql_models = [models.Flow, models.User, models.ApiKey] sql_models = [models.Flow, models.User, models.ApiKey]
results = [] return [
for sql_model in sql_models: TableResults(sql_model.__tablename__, self.check_table(sql_model))
results.append( for sql_model in sql_models
TableResults(sql_model.__tablename__, self.check_table(sql_model)) ]
)
return results
def check_table(self, model): def check_table(self, model):
results = [] results = []

View file

@ -1,5 +1,5 @@
from langflow.services.schema import ServiceType 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 from loguru import logger
if TYPE_CHECKING: if TYPE_CHECKING: