in lib/constructs/data-set-enrollment.ts [103:160]
constructor(scope: Construct, id: string, props: FederatedDataSetProps) {
super(scope, id);
const databaseObj = require(props.databaseDescriptionPath);
const tablesObj = require(props.tablesDescriptionPath);
// import databaseObj from props.databaseDescriptionPath;
// import tablesObj from props.tablesDescriptionPath;
const databaseName = `${databaseObj['Database']['Name']}`
this.glueDatabase = new glue.CfnDatabase(this, databaseObj['Database']['Name'], {
catalogId: Aws.ACCOUNT_ID,
databaseInput: {
locationUri: `${databaseObj['Database']['LocationUri']}`,
name: databaseName,
}
});
for (let table of tablesObj['TableList']) {
var columnList = [];
for(let column of table['StorageDescriptor']['Columns']){
columnList.push({
name: column['Name'],
type: column['Type']
});
}
const freshTable = new glue.CfnTable(this, table["Name"], {
catalogId: Aws.ACCOUNT_ID,
databaseName: databaseName,
tableInput: {
name: table["Name"],
parameters: table['Parameters'],
storageDescriptor: {
columns: columnList,
inputFormat: table['StorageDescriptor']['InputFormat'],
outputFormat: table['StorageDescriptor']['OutputFormat'],
location: table['StorageDescriptor']['Location'],
parameters: table['StorageDescriptor']['Parameters'],
serdeInfo: {
parameters: table['StorageDescriptor']['SerdeInfo']['Parameters'],
serializationLibrary: table['StorageDescriptor']['SerdeInfo']['SerializationLibrary']
}
}
}
})
freshTable.addDependsOn(this.glueDatabase);
}
}