dbcli/athenacli

Table auto complete fails when a Glue table name has a "." in its name

nadavaviv opened this issue · 4 comments

Hi, I have a glue table named "example.example".
When I'm using the Database and try to select * from , the auto completion fails, and the following error message is displayed:

Traceback (most recent call last):
  File "/opt/conda/lib/python3.7/threading.py", line 926, in _bootstrap_inner
    self.run()
  File "/opt/conda/lib/python3.7/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/opt/conda/lib/python3.7/site-packages/athenacli/completion_refresher.py", line 71, in _bg_refresh
    refresher(completer, executor)
  File "/opt/conda/lib/python3.7/site-packages/athenacli/completion_refresher.py", line 113, in refresh_tables
    completer.extend_columns(executor.table_columns(), kind='tables')
  File "/opt/conda/lib/python3.7/site-packages/athenacli/completer.py", line 124, in extend_columns
    metadata[self.dbname][relname].append(column)
KeyError: '"example.example"'

Is this a known issue?

zzl0 commented

Thanks for the feedback. I'm sorry I am not sure how to reproduce it, could you share the schema of your example database? or provide us the steps to reproduce this issue?

Basically I've just created a table which has a . in its name.
Once I've edited the name and replaced the . with an _, everything worked just fine

Edit: Just noticed, the name of the Database isn't example, it's something else.
The name of the table itself is example.example.

zzl0 commented

I see, thanks for the explanation, I will take a look this on weekend.

zzl0 commented

Checked the Athena document, it's a known limitation of Athena.

Special characters other than underscore (_) are not supported. For more information, 
see the Apache Hive LanguageManual DDL documentation.

Important
Although you may succeed in creating table, view, database, or column names that contain
special characters other than underscore by enclosing them in backtick (`) characters,
subsequent DDL or DML queries that reference them can fail.

https://docs.aws.amazon.com/athena/latest/ug/tables-databases-columns-names.html