feat(02-use-cases): Text-to-SQL Data Analyst with Athena, Glue and AgentCore Memory#1170
Open
dmrubioaws wants to merge 4 commits intoawslabs:mainfrom
Open
feat(02-use-cases): Text-to-SQL Data Analyst with Athena, Glue and AgentCore Memory#1170dmrubioaws wants to merge 4 commits intoawslabs:mainfrom
dmrubioaws wants to merge 4 commits intoawslabs:mainfrom
Conversation
…entCore Memory Natural language to SQL assistant using Strands Agents SDK, Claude Sonnet 4, AWS Glue Data Catalog (semantic layer), and Amazon Athena. Features: - YAML-driven table configuration (config/tables.yaml) - Automatic schema discovery from Glue Data Catalog - 4-layer SQL security (Guardrails, prompt, PolicyValidator, Lake Formation) - Dual memory: STM (session) + LTM (learned patterns) - CDK infrastructure that reads tables.yaml dynamically - Dual engine support (Athena + Redshift) - Web frontend with schema visualization - Sample data generator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Natural language to SQL data analyst assistant built with Amazon Bedrock AgentCore, Strands Agents SDK, Claude Sonnet 4, AWS Glue Data Catalog, and Amazon Athena.
What does this use case demonstrate?
config/tables.yamland business context inconfig/system_prompt.yaml— no code changes needed to adapt to different domainstables.yamlto dynamically create Glue tables, S3 data lake, Athena, Lambda, API Gateway, CloudFront, and Bedrock GuardrailsAgentCore capabilities used
Architecture
Files added (22 files in
02-use-cases/text-to-sql-data-analyst/)agentcore_agent.py— AgentCore entry point with Strands SDKconfig/tables.yaml— YAML-driven table definitionsconfig/system_prompt.yaml— Business dictionary, few-shot examples, SQL guidelinessrc/policy_validator.py— SELECT-only SQL validation with auto-LIMITsrc/tools/discover_schema.py— Glue Data Catalog schema discoverysrc/tools/execute_query.py— Athena/Redshift query executioncdk/stack.py— CDK infrastructure (reads tables.yaml dynamically)frontend/— Web UI with schema visualizationscripts/init_demo_data.py— Sample data generatortests/test_policy_validator.py— Unit testsdocs/DEEP-DIVE.md— Technical deep diveTesting
Checklist