MrPowers / mack

Delta Lake helper methods in PySpark
https://mrpowers.github.io/mack/
MIT License
286 stars 42 forks source link

Refactor rename delta table #125

Open MrPowers opened 9 months ago

MrPowers commented 9 months ago

@danielbeach - I am getting this error:

>       spark.sql(f"ALTER TABLE {delta_table.name} RENAME TO {new_table_name}")
E       AttributeError: 'DeltaTable' object has no attribute 'name'

I'm not sure the current code works.

danielbeach commented 9 months ago

@danielbeach - I am getting this error:

>       spark.sql(f"ALTER TABLE {delta_table.name} RENAME TO {new_table_name}")
E       AttributeError: 'DeltaTable' object has no attribute 'name'

I'm not sure the current code works.

@MrPowers Your PR looks different from the original code that's been merged. Your PR adds things like deltatable.name which doesn't work. If you do something like deltaTable.detail() and then that has the table_name you could do something like that, but not deltatable.name

The current code is unit-tested and appears to work, do you think the unit test is inaccurate? UPDATE: I think I see the problem, let me make a PR into this one, I think that will work, https://github.com/MrPowers/mack/blob/main/tests/test_public_interface.py#1146

MrPowers commented 9 months ago

@danielbeach - I don't think the current code tests databricks=True.

danielbeach commented 8 months ago

@MrPowers I think the unit test was failing from another test failure, not the one concerned in this PR. I re-ran the tests locally and they passed, and re-ran the tests on this PR and they passed.

MrPowers commented 8 months ago

@danielbeach - thanks for the ping. I think you already fixed this, so closing this PR. Thanks!