1
1
"""Migration entity."""
2
- import logging
3
2
from abc import ABC , abstractmethod
4
3
from dataclasses import dataclass
5
4
from enum import Enum , auto
@@ -141,12 +140,7 @@ def _get_queries(
141
140
)
142
141
queries .append (alter_table_add_query )
143
142
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 :
150
144
drop_columns_query = self ._get_alter_table_drop_query (
151
145
drop_items , table_name
152
146
)
@@ -158,7 +152,9 @@ def _get_queries(
158
152
)
159
153
queries .append (alter_column_types_query )
160
154
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
+ )
162
158
163
159
return queries
164
160
@@ -217,6 +213,11 @@ def _get_diff(
217
213
for db_item in db_schema :
218
214
if fs_item .get ("column_name" ) == db_item .get ("column_name" ):
219
215
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
+ )
220
221
alter_type_columns .update (
221
222
{fs_item .get ("column_name" ): fs_item .get ("type" )}
222
223
)
@@ -296,3 +297,6 @@ def apply_migration(
296
297
self ._client .sql (q )
297
298
298
299
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