Skip to content

Commit

Permalink
Fix migration query add type key. (#319)
Browse files Browse the repository at this point in the history
  • Loading branch information
moromimay authored Apr 28, 2021
1 parent c46f171 commit bb124f5
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
@@ -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:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand All @@ -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
Expand Down

0 comments on commit bb124f5

Please sign in to comment.