Skip to content

Commit 1e20ac8

Browse files
moromimayralphrass
authored andcommitted
[MLOP-637] Implement diff method (#292)
1 parent aee441c commit 1e20ac8

File tree

4 files changed

+41
-108
lines changed

4 files changed

+41
-108
lines changed

butterfree/migrations/cassandra_migration.py

Lines changed: 0 additions & 23 deletions
This file was deleted.

butterfree/migrations/metastore_migration.py

Lines changed: 0 additions & 23 deletions
This file was deleted.

butterfree/migrations/migrate.py

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
"""Holds the Migrator Class."""
2+
3+
from typing import Callable, List, Tuple
4+
5+
from butterfree.pipelines import FeatureSetPipeline
6+
from butterfree.transform import FeatureSet
7+
8+
9+
class Migrate:
10+
"""Execute migration operations in a Database based on pipeline Writer.
11+
12+
Attributes:
13+
pipelines: list of Feature Set Pipelines to use to migration.
14+
15+
"""
16+
17+
def __init__(self, pipelines: List[FeatureSetPipeline]) -> None:
18+
self.pipelines = pipelines
19+
20+
def _parse_feature_set_pipeline(
21+
self, pipeline: FeatureSetPipeline
22+
) -> List[Tuple[Callable, FeatureSet]]:
23+
feature_set = pipeline.feature_set
24+
migrations = [
25+
writer.db_config._migration_class for writer in pipeline.sink.writers
26+
]
27+
28+
return [(migrate, feature_set) for migrate in migrations]
29+
30+
def _send_logs_to_s3(self) -> None:
31+
"""Send all migration logs to S3."""
32+
pass
33+
34+
def migration(self) -> None:
35+
"""Construct and apply the migrations."""
36+
migration_list = [
37+
self._parse_feature_set_pipeline(pipeline) for pipeline in self.pipelines
38+
]
39+
40+
for migration, fs in migration_list:
41+
migration.run(fs)

butterfree/migrations/migration.py

Lines changed: 0 additions & 62 deletions
This file was deleted.

0 commit comments

Comments
 (0)