Created
August 10, 2021 16:17
-
-
Save rogerchi/385bd627ed0928218daf422325768e61 to your computer and use it in GitHub Desktop.
Create Athena View using CfnNamedQuery
This file contains 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
// CfnDatabase from @aws-cdk/aws-glue | |
const db = new CfnDatabase(this, 'DB', { | |
catalogId: this.account, | |
databaseInput: {}, | |
}); | |
const dbName = db.ref; | |
const createOrRelaceViewQuery = new CfnNamedQuery( | |
this, | |
'CreateOrReplaceView', | |
{ | |
database: dbName, | |
queryString: `CREATE OR REPLACE VIEW view_name AS | |
{...}; | |
`, | |
description: 'Create view', | |
}, | |
); | |
// Then pass the createOrReplaceViewQuery.attrNamedQueryId info to your lambda function to invoke |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment