Skip to content

Commit

Permalink
added lambda fn example
Browse files Browse the repository at this point in the history
  • Loading branch information
jeffreyaven committed Nov 9, 2023
1 parent 62c8f62 commit 0c0047d
Showing 1 changed file with 47 additions and 0 deletions.
47 changes: 47 additions & 0 deletions notebooks/aws/aws.ipynb
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,53 @@
"%%stackql\n",
"select PolicyName, Arn from aws.iam.policies where region = '$region'"
]
},
{
"cell_type": "code",
"execution_count": null,
"metadata": {},
"outputs": [],
"source": [
"import nest_asyncio, json\n",
"nest_asyncio.apply()\n",
"import pandas as pd\n",
"\n",
"regions= [\"us-east-1\",\"us-east-2\",\"us-west-1\",\"us-west-2\",\"ap-south-1\",\"ap-northeast-3\",\"ap-northeast-2\",\"ap-southeast-1\",\n",
" \"ap-southeast-2\",\"ap-northeast-1\",\"ca-central-1\",\"eu-central-1\",\"eu-west-1\",\"eu-west-2\",\"eu-west-3\",\"eu-north-1\",\n",
" \"sa-east-1\"]\n",
"\n",
"get_fns = [\n",
" f\"\"\"\n",
" SELECT *\n",
" FROM aws.lambda.functions\n",
" WHERE region = '{region}'\n",
" \"\"\"\n",
" for region in regions\n",
"]\n",
"\n",
"functions_df = await stackql.executeQueriesAsync(get_fns)\n",
"functions_list = functions_df.to_dict(orient='records')\n",
"\n",
"get_fns_details = [\n",
" f\"\"\"\n",
" SELECT \n",
" function_name,\n",
" region,\n",
" arn,\n",
" description,\n",
" architectures,\n",
" memory_size,\n",
" runtime\n",
" FROM aws.lambda.function\n",
" WHERE region = '{function['region']}'\n",
" AND data__Identifier = '{function['function_name']}'\n",
" \"\"\"\n",
" for function in functions_list\n",
"]\n",
"\n",
"function_details_df = await stackql.executeQueriesAsync(get_fns_details)\n",
"function_details_df"
]
}
],
"metadata": {
Expand Down

0 comments on commit 0c0047d

Please sign in to comment.