0

I am trying to get metadata from AWS athena by running SQL query as:

SELECT table_catalog, table_schema, table_name FROM information_schema.tables
WHERE table_schema = 'information_schema'

when I am getting an error:

Database information_schema not found. Please check your query.

The query runs fine without the WHERE clause or some other condition there. Am I missing something?

Sameer Mahajan
  • 484
  • 1
  • 8
  • 27
  • Is there some reference you've found that suggests this should be possible, or that references `information_schema`? – John Rotenstein Jun 08 '18 at 10:36
  • @JohnRotenstein: As I said, I am able to run the query without the WHERE clause. When I run it, for metadata I see table_schema as 'information_schema'. I am not sure why its string value is confused to be a database in the where condition... – Sameer Mahajan Jun 08 '18 at 11:20
  • Similar to: [Athena Presto list empty tables](https://stackoverflow.com/q/49410867/174777) and [Apache superset: cannot read metadata from Athena](https://stackoverflow.com/q/48346345/174777) – John Rotenstein Jun 08 '18 at 11:32
  • 1
    This is an older question but I feel I should point out for anyone reading this later that the issue is that information_schema views contain metadata about tables and views, but do not contain any information about _themselves_, so `FROM information_schema.tables WHERE table_schema = 'information_schema'` is nonsensical. – Nathan Griffiths Apr 23 '19 at 03:26

0 Answers0