要在AWS Glue爬虫中排除Oracle模式或表,可以使用爬虫的“excludePatterns”参数。下面是一个示例代码,演示如何使用Python SDK来创建一个排除Oracle模式和表的爬虫。
import boto3
def create_glue_crawler():
glue_client = boto3.client('glue', region_name='your_region')
response = glue_client.create_crawler(
Name='your_crawler_name',
Role='your_iam_role',
DatabaseName='your_database_name',
Targets={
'S3Targets': [
{
'Path': 's3://your_bucket/your_folder/'
},
]
},
SchemaChangePolicy={
'UpdateBehavior': 'UPDATE_IN_DATABASE',
'DeleteBehavior': 'DEPRECATE_IN_DATABASE'
},
TablePrefix='your_table_prefix',
Configuration='{"Version":1.0,"CrawlerOutput":{"Partitions":{"AddOrUpdateBehavior":"InheritFromTable"}}}',
ExcludePatterns=[
'your_oracle_schema_name.*',
'your_oracle_table_name'
]
)
create_glue_crawler()
在上述代码中,需要将以下参数替换为您自己的值:
以上代码会创建一个爬虫,并在爬取数据时排除指定的Oracle模式和表。您可以根据自己的需求修改代码中的参数和其他设置。