Skip to content

Commit

Permalink
Remove accidentally hard-coded athena.table from config; Add AWS_ATHE…
Browse files Browse the repository at this point in the history
…NA_PREPARE_STATEMENT env variable to hold the athena query name hedyorg#665 (hedyorg#1669)

Co-authored-by: Felienne <[email protected]>
  • Loading branch information
boryanagoncharenko and Felienne authored Jan 13, 2022
1 parent e103838 commit cec9053
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 6 deletions.
4 changes: 2 additions & 2 deletions config.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

app_name = os.getenv('HEROKU_APP_NAME', socket.gethostname())
dyno = os.getenv('DYNO')
athena_query = os.getenv('AWS_ATHENA_PREPARE_STATEMENT')

config = {
'port': os.getenv ('PORT') or 8080,
Expand Down Expand Up @@ -37,8 +38,7 @@
'athena': {
'region': 'eu-west-1',
'database': 'hedy-logs',
'table': 'hedy-alpha',
'prepare_statement': 'query',
'prepare_statement': athena_query,
's3_output': 's3://hedy-query-outputs/',
'max_results': 50
},
Expand Down
6 changes: 2 additions & 4 deletions website/log_fetcher.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,14 @@ def from_env():
if os.getenv('AWS_ACCESS_KEY_ID'):
db = boto3.client('athena', region_name=config['athena']['region'])
database = config['athena']['database']
table = config['athena']['table']
s3_output = config['athena']['s3_output']
return AwsAthenaClient(db, database, table, s3_output)
return AwsAthenaClient(db, database, s3_output)
logging.warning('Unable to initialize Athena client (missing AWS_ACCESS_KEY_ID or AWS_SECRET_ACCESS_KEY)')
return None

def __init__(self, client, database, table, s3_output):
def __init__(self, client, database, s3_output):
self.client = client
self.database = database
self.table = table
self.s3_output = s3_output

@retry(stop_max_attempt_number=5, wait_exponential_multiplier=1000, wait_exponential_max=10 * 1000)
Expand Down

0 comments on commit cec9053

Please sign in to comment.