3

I am trying to access Athena from superset, the connection is successful and could see all the schema and tables in SQL editior(Enabled expose this db in SQL lab).

On SQL editor while loading the metadata it returns following error:

ERROR OCCURRED WHILE FETCHING TABLE METADATA

On Athena, it runs the following query

SELECT table_schema,
     table_name,
     column_name,
     data_type,
     is_nullable,
     column_default,
     ordinal_position,
     comment
FROM information_schema.columns

And this query return following error on athena.

HIVE_INVALID_METADATA: com.facebook.presto.hive.DataCatalogException: 
Error: : expected at the position 16 of 'struct<FULL_BEAM0.2000:struct<DiskHU:string,HUFlatness:double,PhantomHU:double,PhantomSNR:double,ResolutionLength:double,ResolutionMTF:string,dateTime:string,examID:string,jobID:string,version:string>,
FULL_BEAM-0.4000:struct<DiskHU:string,HUFlatness:double,PhantomHU:double,PhantomSNR:double,ResolutionLength:double,ResolutionMTF:string,dateTime:string,examID:string,jobID:string,version:string>>' 
but '-' is found. (Service: null; Status Code: 0; Error Code: null; Request ID: null)

Tried accessing show record under sources -> tables, List Columns tab is empty, so when I click on refresh metadata I receive 500 - Internal Server Error. The stacktrace for the error looks like the following:

  Traceback (most recent call last):
File "/home/ec2-user/.local/lib/python2.7/site-packages/flask/app.py", 
line 1982, in wsgi_app
response = self.full_dispatch_request()
File "/home/ec2-user/.local/lib/python2.7/site-packages/flask/app.py", line 1614, in full_dispatch_request
 rv = self.handle_user_exception(e)
File "/home/ec2-user/.local/lib/python2.7/site-packages/flask/app.py", line 1517, in handle_user_exception
reraise(exc_type, exc_value, tb)
File "/home/ec2-user/.local/lib/python2.7/site-packages/flask/app.py", line 1612, in full_dispatch_request
rv = self.dispatch_request()
File "/home/ec2-user/.local/lib/python2.7/site-packages/flask/app.py", line 1598, in dispatch_request
return self.view_functions[rule.endpoint](**req.view_args)
File "/home/ec2-user/.local/lib/python2.7/site-packages/flask_appbuilder/views.py", line 558, in action
return action.func(self.datamodel.get(pk))
File "/home/ec2-user/.local/lib/python2.7/site-packages/superset/connectors/sqla/views.py", line 282, in refresh
for t in tables:
TypeError: 'SqlaTable' object is not iterable

Anyone knows the solution to these errors?

TylerH
  • 20,799
  • 66
  • 75
  • 101
Ashutosh
  • 347
  • 4
  • 11

1 Answers1

1

Check PyAthena version. Superset docs tell PyAthena>1.2.0 while PyAthena PyPI page says PyAthena[SQLAlchemy]>=1.0.0, <2.0.0. In my case PyAthena[SQLAlchemy]>1.2.0, <2.0.0 (combining both constraints) solved an issue and the tables were present in dropdown list in SQL Lab (it was empty with PyAthena==2.5.1 (latest) version before).

Anton Bryzgalov
  • 1,065
  • 12
  • 23