Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20 changes: 12 additions & 8 deletions butterfree/migrations/database_migration/database_migration.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
"""Migration entity."""
import logging
from abc import ABC, abstractmethod
from dataclasses import dataclass
from enum import Enum, auto
Expand Down Expand Up @@ -141,12 +140,7 @@ def _get_queries(
)
queries.append(alter_table_add_query)
if drop_items:
if write_on_entity:
logging.info(
"Features will not be dropped automatically "
"when data is loaded to an entity table"
)
else:
if not write_on_entity:
drop_columns_query = self._get_alter_table_drop_query(
drop_items, table_name
)
Expand All @@ -158,7 +152,9 @@ def _get_queries(
)
queries.append(alter_column_types_query)
if alter_key_items:
logger.info("This operation is not supported by Spark.")
logger.warning(
"The 'change the primary key column' action is not supported by Spark."
)

return queries

Expand Down Expand Up @@ -217,6 +213,11 @@ def _get_diff(
for db_item in db_schema:
if fs_item.get("column_name") == db_item.get("column_name"):
if fs_item.get("type") != db_item.get("type"):
if fs_item.get("primary_key") is True:
logger.warning(
"Type changes are not applied to "
"columns that are the primary key."
)
alter_type_columns.update(
{fs_item.get("column_name"): fs_item.get("type")}
)
Expand Down Expand Up @@ -296,3 +297,6 @@ def apply_migration(
self._client.sql(q)

logger.info(f"Feature Set migration finished successfully.")

# inform in drone console which feature set was migrated
print(f"The {feature_set.name} feature set was migrated.")