Skip to content

Commit

Permalink
bugfixes, doc
Browse files Browse the repository at this point in the history
  • Loading branch information
zzeppozz committed Oct 3, 2024
1 parent 8b558ed commit acbe263
Show file tree
Hide file tree
Showing 16 changed files with 423 additions and 724 deletions.
26 changes: 13 additions & 13 deletions _sphinx_config/pages/aws/roles.rst
Original file line number Diff line number Diff line change
Expand Up @@ -29,19 +29,19 @@ Attach to BISON namespace (Redshift)
* TODO: change to Redshift - Scheduler when automated

{
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"lambda:InvokeFunction"
],
"Resource": [
"arn:aws:lambda:us-east-1:321942852011:function:bison_s0_test_schedule:*",
"arn:aws:lambda:us-east-1:321942852011:function:bison_s0_test_schedule"
]
}
]
"Version": "2012-10-17",
"Statement": [
{
"Effect": "Allow",
"Action": [
"lambda:InvokeFunction"
],
"Resource": [
"arn:aws:lambda:us-east-1:321942852011:function:bison_s0_test_schedule:*",
"arn:aws:lambda:us-east-1:321942852011:function:bison_s0_test_schedule"
]
}
]
}
bison_redshift_lambda_role
Expand Down
4 changes: 0 additions & 4 deletions aws/events/bison_s0_resolve_riis_lambda.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
# Initialize Redshift client
config = Config(connect_timeout=timeout, read_timeout=timeout)
client_ec2 = session.client("ec2", config=config)
# ec2 = boto3.client('ec2', region_name=region)


# --------------------------------------------------------------------------------------
Expand All @@ -40,9 +39,6 @@ def lambda_handler(event, context):
Returns:
instance_id (number): ID of the EC2 instance started.
Raises:
Exception: on failure to start the EC2 instance
"""
instance = client_ec2.run_instances(
# ImageId=AMI,
Expand Down
8 changes: 3 additions & 5 deletions aws/events/bison_s5_aggregate_region_lambda.py
Original file line number Diff line number Diff line change
Expand Up @@ -113,26 +113,24 @@
state_aggregate_stmt = f"""
CREATE TABLE {pub_schema}.{state_aggregate_tbl} AS
SELECT DISTINCT {b_st_fld}, {b_ass_fld},
COUNT(*) AS {out_occcount_fld},
COUNT(*) AS {out_occcount_fld},
COUNT(DISTINCT {gbif_tx_fld}) AS {out_spcount_fld}
FROM {bison_tbl} WHERE {b_st_fld} IS NOT NULL
GROUP BY {b_st_fld}, {b_ass_fld};
"""
state_agg_export_stmt = f"""
"""
# Note: in county agggregate, include states bc county names are not unique
county_aggregate_stmt = f"""
CREATE TABLE public.{county_aggregate_tbl} AS
SELECT DISTINCT {b_stcty_fld}, {b_cty_fld}, {b_st_fld}, {b_ass_fld},
COUNT(*) AS {out_occcount_fld},
COUNT(*) AS {out_occcount_fld},
COUNT(DISTINCT {gbif_tx_fld}) AS {out_spcount_fld}
FROM {bison_tbl} WHERE {b_st_fld} IS NOT NULL
GROUP BY {b_stcty_fld}, {b_cty_fld}, {b_st_fld}, {b_ass_fld};
"""
aiannh_aggregate_stmt = f"""
CREATE TABLE {pub_schema}.{aiannh_aggregate_tbl} AS
SELECT DISTINCT {b_nm_fld}, {b_ass_fld},
COUNT(*) AS {out_occcount_fld},
COUNT(*) AS {out_occcount_fld},
COUNT(DISTINCT {gbif_tx_fld}) AS {out_spcount_fld}
FROM {bison_tbl} WHERE {b_nm_fld} IS NOT NULL
GROUP BY {b_nm_fld}, {b_ass_fld};
Expand Down
Loading

0 comments on commit acbe263

Please sign in to comment.