Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Athena array(), map() or row() #236

Merged
merged 1 commit into from
Aug 31, 2017
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions redash/query_runner/athena.py
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ def __init__(self, configuration):
def get_schema(self, get_stats=False):
schema = {}
query = """
SELECT table_schema, table_name, column_name, data_type as column_type, extra_info
SELECT table_schema, table_name, column_name, data_type as column_type, comment as extra_info
FROM information_schema.columns
WHERE table_schema NOT IN ('information_schema')
"""
Expand All @@ -137,12 +137,12 @@ def get_schema(self, get_stats=False):
if table_name not in schema:
schema[table_name] = {'name': table_name, 'columns': []}

if row['extra_info'] == 'partition key':
if row['extra_info'] == 'Partition Key':
schema[table_name]['columns'].append('[P] ' + row['column_name'] + ' (' + row['column_type'] + ')')
elif row['column_type'] == 'integer' or row['column_type'] == 'varchar' or row['column_type'] == 'timestamp' or row['column_type'] == 'boolean' or row['column_type'] == 'bigint':
schema[table_name]['columns'].append(row['column_name'] + ' (' + row['column_type'] + ')')
elif row['column_type'][0:2] == 'row' and row['column_type'][0:2] == 'map':
schema[table_name]['columns'].append(row['column_name'] + ' (row or map)')
elif row['column_type'][0:2] == 'row' or row['column_type'][0:2] == 'map' or row['column_type'][0:2] == 'arr':
schema[table_name]['columns'].append(row['column_name'] + ' (row or map or array)')
else:
schema[table_name]['columns'].append(row['column_name'])

Expand Down