seanharr11 / etlalchemy

Extract, Transform, Load: Any SQL Database in 4 lines of Code.
MIT License
555 stars 83 forks source link

newTable vs new_table #22

Closed Xaraxia closed 5 years ago

Xaraxia commented 7 years ago

There is no newTable key in the schema_transformer class. I had to edit ETLAlchemySource to fix as follows to get it working:

--- a/ETLAlchemySource.py.bak
+++ b/ETLAlchemySource.py
@@ -1183,9 +1183,9 @@ class ETLAlchemySource():
                 .get(table_name)
             column_transformer = self.schema_transformer.column_transformations\
                 .get(table_name)
-            if table_transform and table_transform.newTable not in ["", None]:
+            if table_transform and table_transform.new_table not in ["", None]:
                 # Update the table_name
-                table_name = table_transform.newTable
+                table_name = table_transform.new_table
             this_idx_count = 0
             self.logger.info("Creating indexes for '" + table_name + "'...")
             for i in indexes:
@@ -1360,9 +1360,9 @@ class ETLAlchemySource():
             ####################################
             table_transform = self.schema_transformer.table_transformations.get(
                 table_name)
-            if table_transform and table_transform.newTable not in ["", None]:
+            if table_transform and table_transform.new_table not in ["", None]:
                 # Update the table_name
-                table_name = table_transform.newTable
+                table_name = table_transform.new_table
             self.logger.info(
                 "Adding FKs to table '{0}' (previously {1})".format(
                     table_name, pre_transformed_table_name))
@@ -1433,10 +1433,10 @@ class ETLAlchemySource():
                 ref_column_transformer = \
                     self.schema_transformer.column_transformations.get(
                                   ref_table)
-                if table_transform and table_transform.newTable not in [
+                if table_transform and table_transform.new_table not in [
                         "", None]:
                     # Update the table_name
-                    ref_table = table_transform.newTable
+                    ref_table = table_transform.new_table
                 T_ref = Table(ref_table, dst_meta)
                 ############################
                 # Check that referenced table
--- Want to back this issue? **[Post a bounty on it!](https://www.bountysource.com/issues/45471064-newtable-vs-new_table?utm_campaign=plugin&utm_content=tracker%2F41641218&utm_medium=issues&utm_source=github)** We accept bounties via [Bountysource](https://www.bountysource.com/?utm_campaign=plugin&utm_content=tracker%2F41641218&utm_medium=issues&utm_source=github).
seanharr11 commented 7 years ago

@Xaraxia nice find! Would you mind opening a Pull Request with this change?

seanharr11 commented 7 years ago

@Xaraxia could you include the above in a PR?