- Newest
- Most votes
- Most comments
In your CDK code, you'll need to update the crawler configuration to include the schema change policy. You can do this by adding a schemaChangePolicy
property to your crawler definition. Here's an example of how you can modify your code:
const L2crawler = new glue.CfnCrawler(this, 'POSCrawler', { name: 'POS', role: glueRole.roleArn, databaseName: 'your_database_name', targets: { jdbcTargets: [ { // Your JDBC target configuration } ] }, schemaChangePolicy: { updateBehavior: 'LOG', deleteBehavior: 'LOG' } });
In this configuration:
updateBehavior: 'LOG'
tells the crawler to ignore schema changes and not update the table in the data catalog. Instead, it will log the changes.deleteBehavior: 'LOG'
instructs the crawler to ignore deleted objects in the data store and log the deletions instead of updating the catalog.
By setting both updateBehavior
and deleteBehavior
to 'LOG', you're effectively telling the crawler to ignore changes and deletions, which matches your requirement to not update the catalog when there are new columns added or deleted in the JDBC source data table.
Remember to import the necessary modules and ensure that your CDK version supports this configuration. If you're using a different construct or a lower-level API, the property names might vary slightly, but the concept remains the same.
After making these changes, deploy your CDK stack, and the crawler will be configured to ignore schema changes and deletions in the data store.
Sources
Preventing a crawler from changing an existing schema - AWS Glue
Configure a crawler to handle schema changes | AWS re:Post
CatalogSchemaChangePolicy - AWS Glue
Relevant content
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 4 months ago
- AWS OFFICIALUpdated 2 years ago
- AWS OFFICIALUpdated 3 years ago