

# Filter by database, table, or document type

You can scope the data that a connection includes from its data source. Data sources support different data scope configurations.


| Data source | Supported data scope configurations | 
| --- | --- | 
|  AWS Glue | Catalogs and databases | 
| Amazon Redshift | Namespaces, databases, and schemas | 
| Aurora and RDS | Databases and schemas in a DB cluster or DB instance | 
| Amazon S3 Tables | Table buckets and namespaces | 
| Amazon DynamoDB | All of Amazon DynamoDB | 
| Snowflake and Databricks | One Snowflake database or one Unity Catalog catalog, with all of its schemas or the schemas that you select | 
| Amazon Bedrock Managed Knowledge Base | One knowledge base, with all of its data sources | 

**To set the data scope of a connection (console)**

1. Open the AWS Context console.

1. In the navigation pane, choose **Connections**.

1. Choose **Create connection**.

1. On the **Choose a data source** page, choose the data source, and then choose **Next**.

1. On the **Configure connection** page, under **Data scope**, if the page shows **Data source location**, choose **This AWS account**, or choose **Other AWS account** and enter the account ID.

1. Under **Available data**, select the data to include. For an Amazon Bedrock Managed Knowledge Base, choose the knowledge base instead.

1. Choose **Next**, and then complete the **Set permissions** and **Review and create** pages.

For a structured source, **Available data** lists the databases and tables that the AWS Glue Data Catalog already catalogs. For the steps for each data source, see [AWS native structured sources](aws-native-structured-sources.md), [Third-party catalogs](third-party-catalogs.md), and [Connect a managed knowledge base to AWS Context](unstructured-connect-kb.md).

When you add the connection to an Agent Context, you can narrow the data further in the connection’s configuration.

**To filter a connection’s data in an Agent Context (console)**

1. Open the AWS Context console.

1. In the navigation pane, choose **Agent context**.

1. Open the connection’s configuration:
   + For a new Agent Context, choose **Create agent context**. Under **Connections**, choose **Add connection**, select the connection, and then choose **Add connection**. In the **Connections** table, select the connection, and then choose **Configure**.
   + For an existing Agent Context, choose the Agent Context, and then choose the **Connections** tab. Select the connection, choose **Actions**, and then choose **Edit**.

1. (Optional) Under **Data filtering**, narrow the connection’s data for this Agent Context:
   + For a structured source, keep all databases and tables, or choose the specific ones to include. To ingest only the tables that were updated after a date, set **Updated after**.
   + For an Amazon Bedrock Managed Knowledge Base, choose **Add filter**, and then set the filter.

1. Choose **Save configuration**.

An Amazon Bedrock Managed Knowledge Base filter can use **Document types**, **Max document size**, **Created after**, and **Updated after**. An Agent Context has a limit of 20 across all of its connections. A connection that keeps all of its data counts as one. Each specific database or table that you choose also counts as one.