seanharr11 / etlalchemy

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

ValueError: invalid literal for int() #18

Closed gauravdalvi63 closed 7 years ago

gauravdalvi63 commented 7 years ago

ETLAlchemySource (INFO) - Bases: ['NUMERIC', 'INTEGER'] Traceback (most recent call last): File "app.py", line 13, in <module> migrate() File "app.py", line 10, in migrate tgt.migrate(migrate_fks=False, migrate_indexes=True, migrate_data=False, migrate_schema=True) File "/usr/local/lib/python2.7/site-packages/etlalchemy/ETLAlchemyTarget.py", line 86, in migrate migrate_data=migrate_data) File "/usr/local/lib/python2.7/site-packages/etlalchemy/ETLAlchemySource.py", line 1019, in migrate column_copy = self.standardize_column_type(column, raw_rows) File "/usr/local/lib/python2.7/site-packages/etlalchemy/ETLAlchemySource.py", line 325, in standardize_column_type mantissa_max_value = max(int(mantissa_digits), ValueError: invalid literal for int() with base 10: '03545163113e+38'

gauravdalvi63 commented 7 years ago

I guess it should be mantissa_max_value = max(int(float(mantissa_digits)), mantissa_max_value)

seanharr11 commented 7 years ago

@gauravdalvi63 this has been addressed in commit 19a50779081d40ef2421e3b7fa7e186bd05f67f7 ... similar to your suggestion, I now cast the mantissa_digits as a float, and check if this is greater than 0 to determine if this column's data justify the Decimal column type.

Note that you'll have to install from github to get this fix. Will get these changes up to PyPi in due time.