aq icon indicating copy to clipboard operation
aq copied to clipboard

AttributeError: 'NoneType' object has no attribute 'split'

Open rainman-ph opened this issue 5 years ago • 0 comments

@lebinh ,

I just installed aq. I encountered several issues

  1. I have to downgrade prompt-toolkit to 1.x just to be able to install it locally for debugging

  2. I encountered an error while running a simple query: Then this one showed up:

 select count(*) from ec2_instances
Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/aq/__init__.py", line 69, in main
    res = execute_query(engine, formatter, parser, query)
  File "/usr/local/lib/python3.7/site-packages/aq/__init__.py", line 82, in execute_query
    columns, rows = engine.execute(parsed_query, metadata)
  File "/usr/local/lib/python3.7/site-packages/aq/engines.py", line 49, in execute
    self.load_tables(query, metadata)
  File "/usr/local/lib/python3.7/site-packages/aq/engines.py", line 64, in load_tables
    self.load_table(table)
  File "/usr/local/lib/python3.7/site-packages/aq/engines.py", line 75, in load_table
    resource_name, collection_name = table.table.split('_', 1)
AttributeError: 'NoneType' object has no attribute 'split'

When the debugging the following line:

File "/usr/local/lib/python3.7/site-packages/aq/__init__.py", line 82, in execute_query
    columns, rows = engine.execute(parsed_query, metadata)

I have these Local Variable:

query: 'SELECT count(*) FROM ec2_instances'
parsed_query: 'SELECT count(*) FROM ec2_instances'
metadata.tables[0]: TableId(database=None, table=None, alias=None)
metadata.tables[0]._fields: ('tables',)
metadata.tables[0][0]._fields: ('database', 'table', 'alias')
metadata.tables[0][0]._fields_defaults: {}

So then when table.table.split('_', 1) is called since table is empty then table.table.split is also null.

Has the parser.parse_query(query) changed and maybe spits out now empty metadata.tables?

Please advise and thanks.

rainman-ph avatar Mar 26 '19 11:03 rainman-ph