diff --git a/butterfree/migrations/database_migration/cassandra_migration.py b/butterfree/migrations/database_migration/cassandra_migration.py index ff7042b6..5a4f755f 100644 --- a/butterfree/migrations/database_migration/cassandra_migration.py +++ b/butterfree/migrations/database_migration/cassandra_migration.py @@ -88,7 +88,9 @@ def _get_alter_column_type_query(self, column: Diff, table_name: str) -> str: """ parsed_columns = self._get_parsed_columns([column]) - return f"ALTER TABLE {table_name} ALTER {parsed_columns};" + return ( + f"ALTER TABLE {table_name} ALTER {parsed_columns.replace(' ', ' TYPE ')};" + ) @staticmethod def _get_create_table_query(columns: List[Dict[str, Any]], table_name: str) -> str: diff --git a/setup.py b/setup.py index a69c079c..4a138c7a 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,7 @@ from setuptools import find_packages, setup __package_name__ = "butterfree" -__version__ = "1.2.0.dev14" +__version__ = "1.2.0.dev15" __repository_url__ = "https://github.com/quintoandar/butterfree" with open("requirements.txt") as f: diff --git a/tests/unit/butterfree/migrations/database_migration/test_cassandra_migration.py b/tests/unit/butterfree/migrations/database_migration/test_cassandra_migration.py index 97f49958..5666cc47 100644 --- a/tests/unit/butterfree/migrations/database_migration/test_cassandra_migration.py +++ b/tests/unit/butterfree/migrations/database_migration/test_cassandra_migration.py @@ -8,7 +8,7 @@ def test_queries(self, fs_schema, db_schema): "ALTER TABLE table_name ADD (new_feature FloatType);", "ALTER TABLE table_name DROP (feature1__avg_over_2_days_rolling_windows);", "ALTER TABLE table_name ALTER " - "feature1__avg_over_1_week_rolling_windows FloatType;", + "feature1__avg_over_1_week_rolling_windows TYPE FloatType;", ] query = cassandra_migration.create_query(fs_schema, "table_name", db_schema) @@ -19,7 +19,7 @@ def test_queries_on_entity(self, fs_schema, db_schema): expected_query = [ "ALTER TABLE table_name ADD (new_feature FloatType);", "ALTER TABLE table_name ALTER " - "feature1__avg_over_1_week_rolling_windows FloatType;", + "feature1__avg_over_1_week_rolling_windows TYPE FloatType;", ] query = cassandra_migration.create_query( fs_schema, "table_name", db_schema, True