Hey there, this is less of an sst question and mor...
# help
d
Hey there, this is less of an sst question and more of a general cdk question. https://docs.aws.amazon.com/cdk/api/v2/docs/@aws-cdk_aws-glue-alpha.Table.html#methods This is the documentation of an aws-glue table cdk construct. The
bucket
property seems to be associated with table output. I can't quite identify how I can configure what S3 bucket the generated glue table is supposed to be looking through when using something like athena to run a query on the bucket.
f
Hey @David Garcia, are you looking to create a new S3 bucket for the glue table?
If so, u can try this:
Copy code
import * as glue from "@aws-cdk/aws-glue-alpha";
import * as sst from "@serverless-stack/resources";

const bucket = new sst.Bucket(this, "Bucket", {...});
const table = new glue.Table(this, "GlueTable", {
  bucket: bucket.s3Bucket,
});
d
Not necessarily, I'm declaring the bucket in another stack and passing it to the stack that sets up the glue table. I'd like that bucket to serve as the resource to search through when running an athena query
I was under the impression that you didn't need a glue crawler if you declared your table with a schema, but it seems like there's a difference in how the database table properties look if I use a crawler vs if I do it myself through the cdk (probably because I'm not correctly declaring the table with all the properties that a crawler adds when it crawls thru a bucket)
f
In this case, u can reference the bucket from the other stack directly. Here’s an example of sharing resources across stacks https://docs.serverless-stack.com/advanced/cross-stack-references#adding-a-reference
I see. I don’t know enough about Glue. But from reading the docs, if u want to pass in a bucket from another stack to the consturctor of the Glue table, the above link should help.