Skip to content

Commit f1f5f9d

Browse files
committed
[MLOP-728] Improve logging messages (#324)
* Improve logs. * Revert debug-mode condition.
1 parent 9790edc commit f1f5f9d

File tree

1 file changed

+12
-8
lines changed

1 file changed

+12
-8
lines changed

butterfree/migrations/database_migration/database_migration.py

Lines changed: 12 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
"""Migration entity."""
2-
import logging
32
from abc import ABC, abstractmethod
43
from dataclasses import dataclass
54
from enum import Enum, auto
@@ -141,12 +140,7 @@ def _get_queries(
141140
)
142141
queries.append(alter_table_add_query)
143142
if drop_items:
144-
if write_on_entity:
145-
logging.info(
146-
"Features will not be dropped automatically "
147-
"when data is loaded to an entity table"
148-
)
149-
else:
143+
if not write_on_entity:
150144
drop_columns_query = self._get_alter_table_drop_query(
151145
drop_items, table_name
152146
)
@@ -158,7 +152,9 @@ def _get_queries(
158152
)
159153
queries.append(alter_column_types_query)
160154
if alter_key_items:
161-
logger.info("This operation is not supported by Spark.")
155+
logger.warning(
156+
"The 'change the primary key column' action is not supported by Spark."
157+
)
162158

163159
return queries
164160

@@ -217,6 +213,11 @@ def _get_diff(
217213
for db_item in db_schema:
218214
if fs_item.get("column_name") == db_item.get("column_name"):
219215
if fs_item.get("type") != db_item.get("type"):
216+
if fs_item.get("primary_key") is True:
217+
logger.warning(
218+
"Type changes are not applied to "
219+
"columns that are the primary key."
220+
)
220221
alter_type_columns.update(
221222
{fs_item.get("column_name"): fs_item.get("type")}
222223
)
@@ -296,3 +297,6 @@ def apply_migration(
296297
self._client.sql(q)
297298

298299
logger.info(f"Feature Set migration finished successfully.")
300+
301+
# inform in drone console which feature set was migrated
302+
print(f"The {feature_set.name} feature set was migrated.")

0 commit comments

Comments
 (0)