mysql_plugin icon indicating copy to clipboard operation
mysql_plugin copied to clipboard

TypeError: tuple indices must be integers or slices, not str

Open jensenity opened this issue 6 years ago • 0 comments

[2018-06-19 11:44:18,462] {models.py:1595} ERROR - tuple indices must be integers or slices, not str Traceback (most recent call last): File "/usr/local/lib/python3.6/site-packages/airflow/models.py", line 1488, in _run_raw_task result = task_copy.execute(context=context) File "/usr/local/airflow/dags/productdata/ops/mysql_to_s3_operator.py", line 86, in execute self.get_schema(hook, self.mysql_table) File "/usr/local/airflow/dags/productdata/ops/mysql_to_s3_operator.py", line 94, in get_schema new_dict['name']=i['COLUMN_NAME'] TypeError: tuple indices must be integers or slices, not str

There's an error if the tuple is a str.

When I change it to [As-Is]

new_dict['name']=i['COLUMN_NAME']

new_dict['type']=i['COLUMN_TYPE']

[To-Be] new_dict['name']=i[0] # COLUMN_NAME new_dict['type']=i[1] # COLUMN_TYPE

No more error is shown.

jensenity avatar Jun 19 '18 11:06 jensenity