Srinivas Maganti

08/24/2023, 12:28 PM
Hi guys. I am trying to convert tables columns names upper case to lower case . For that i am using below code. for table in table_list:     spark.sql(f'''ALTER TABLE {table}         SET TBLPROPERTIES (         'delta.columnMapping.mode' = 'name',         'delta.minReaderVersion' = '1',         'delta.minWriterVersion' = '2')''')     print(table)     col_list=spark.table(table).columns     if len(col_list) > 0 :         for col in col_list:             spark.sql(f'''ALTER TABLE {table} RENAME COLUMN {col} to {col+'_tmp'} ''')             spark.sql(f'''ALTER TABLE {table} RENAME COLUMN {col+'_tmp'} to {col.lower()} ''') I am getting below error in sometimes if i rerun its working fine. AnalysisException: org.apache.hadoop.hive.ql.metadata.HiveException: at least one column must be specified for the table Can anyone help me out here why i am getting above error. Thanks