Connect your data warehouses and databases to give your agent access to your data schemas.
Supported Databases
nao supports all major data warehouses and databases:
Snowflake
BigQuery
Databricks
PostgreSQL
Redshift
MySQL
SQL Server
And moreβ¦
Adding a Database
During Initialization
When you run nao init, you can add a database connection interactively:
Manual Configuration
Add database connections in your nao_config.yaml:
databases :
- name : production_warehouse
type : snowflake
host : account.snowflakecomputing.com
database : analytics
schema : public
user : ${SNOWFLAKE_USER}
password : ${SNOWFLAKE_PASSWORD}
warehouse : compute_wh
Database Setup
Snowflake
databases :
- name : snowflake_prod
type : snowflake
host : account.region.snowflakecomputing.com
database : analytics
schema : public
user : ${SNOWFLAKE_USER}
password : ${SNOWFLAKE_PASSWORD}
warehouse : compute_wh
role : analyst_role
BigQuery
databases :
- name : bigquery_prod
type : bigquery
project_id : my-project
dataset_id : analytics
credentials_path : /path/to/service-account.json
accessors :
- columns
- preview
- description
- profiling
include : []
exclude : []
sso : false
location : null
The service account should have BigQuery User role at minimum to read schemas and query tables.
Databricks
databases :
- name : databricks_prod
type : databricks
host : dbc-12345678-9abc.cloud.databricks.com
http_path : /sql/1.0/warehouses/abc123
token : ${DATABRICKS_TOKEN}
catalog : main
schema : analytics
PostgreSQL
databases :
- name : postgres_prod
type : postgresql
host : postgres.example.com
port : 5432
database : analytics
user : ${POSTGRES_USER}
password : ${POSTGRES_PASSWORD}
Accessors
Accessors define what information to extract from each table. Each accessor generates a specific context file:
columns β Column names, data types, and schema information
preview β Sample data rows (first N rows of the table)
description β Table descriptions and metadata
profiling β Data profiling statistics (null counts, unique values, min/max, etc.)
You can select which accessors to use based on your needs:
databases :
- name : my_database
type : bigquery
# ... connection details ...
accessors :
- columns # Always recommended
- preview # Useful for understanding data format
- description # Adds business context
- profiling # Helpful for data quality insights
Synchronization
Once configured, sync your database schemas:
This will:
Connect to your database
Extract schema information based on your accessors
Save it to context/databases/ as text files
Make it available to your agent
Context Files
After syncing, youβll see a hierarchical structure like:
context/
βββ databases/
βββ type=bigquery/database=nao-production/schema=prod_silver/
βββ table=dim_users/
β βββ columns.md # Column definitions and types
β βββ description.md # Table description
β βββ preview.md # Sample data preview
β βββ profiling.md # Data profiling information
βββ table=customers/
βββ columns.md
βββ description.md
βββ preview.md
βββ profiling.md
Each table has files corresponding to the accessors youβve configured.
Table Selection
Control which tables to sync using include and exclude patterns.
Pattern Syntax
Use glob patterns to match table names:
schema_name.table_name β Exact match
schema_name.* β All tables in a schema
*.table_name β Table name across all schemas
*_staging β Tables ending with _staging
test_* β Tables starting with test_
* β All tables
Include Patterns
Specify which tables to sync (if empty, all tables are included):
databases :
- name : production_warehouse
type : snowflake
# ... connection details ...
include :
- analytics.* # All tables in analytics schema
- marts.dim_* # All dimension tables in marts
- marts.fct_* # All fact tables in marts
Exclude Patterns
Specify which tables to exclude from syncing:
databases :
- name : production_warehouse
type : snowflake
# ... connection details ...
exclude :
- * .temp_* # Exclude all temp tables
- staging.* # Exclude entire staging schema
- * _test # Exclude tables ending with _test
- * _backup # Exclude backup tables
Combined Example
You can use both include and exclude together:
databases :
- name : production_warehouse
type : snowflake
# ... connection details ...
include :
- analytics.* # Start with all analytics tables
- marts.* # And all marts tables
exclude :
- * .temp_* # But exclude temp tables
- * _staging # And staging tables
- * _backup # And backup tables
When both include and exclude are specified, include is applied first, then exclude is applied to filter out unwanted tables from the included set.
Best Practices
When selecting tables to include in your context, aim for the optimal balance:
Include enough tables to answer your usersβ questions without exploratory queries
Exclude irrelevant tables to reduce token costs and improve focus
Start small with core business tables, then expand based on usage
Context Engineering Principles Learn how to find the optimal balance between comprehensiveness and efficiency