Try AWS Native preview for resources not in the classic version.
aws.athena.PreparedStatement
Explore with Pulumi AI
Try AWS Native preview for resources not in the classic version.
Resource for managing an Athena Prepared Statement.
Example Usage
import * as pulumi from "@pulumi/pulumi";
import * as aws from "@pulumi/aws";
const test = new aws.s3.BucketV2("test", {
bucket: "tf-test",
forceDestroy: true,
});
const testWorkgroup = new aws.athena.Workgroup("test", {name: "tf-test"});
const testDatabase = new aws.athena.Database("test", {
name: "example",
bucket: test.bucket,
});
const testPreparedStatement = new aws.athena.PreparedStatement("test", {
name: "tf_test",
queryStatement: pulumi.interpolate`SELECT * FROM ${testDatabase.name} WHERE x = ?`,
workgroup: testWorkgroup.name,
});
import pulumi
import pulumi_aws as aws
test = aws.s3.BucketV2("test",
bucket="tf-test",
force_destroy=True)
test_workgroup = aws.athena.Workgroup("test", name="tf-test")
test_database = aws.athena.Database("test",
name="example",
bucket=test.bucket)
test_prepared_statement = aws.athena.PreparedStatement("test",
name="tf_test",
query_statement=test_database.name.apply(lambda name: f"SELECT * FROM {name} WHERE x = ?"),
workgroup=test_workgroup.name)
package main
import (
"fmt"
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/athena"
"github.com/pulumi/pulumi-aws/sdk/v6/go/aws/s3"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
test, err := s3.NewBucketV2(ctx, "test", &s3.BucketV2Args{
Bucket: pulumi.String("tf-test"),
ForceDestroy: pulumi.Bool(true),
})
if err != nil {
return err
}
testWorkgroup, err := athena.NewWorkgroup(ctx, "test", &athena.WorkgroupArgs{
Name: pulumi.String("tf-test"),
})
if err != nil {
return err
}
testDatabase, err := athena.NewDatabase(ctx, "test", &athena.DatabaseArgs{
Name: pulumi.String("example"),
Bucket: test.Bucket,
})
if err != nil {
return err
}
_, err = athena.NewPreparedStatement(ctx, "test", &athena.PreparedStatementArgs{
Name: pulumi.String("tf_test"),
QueryStatement: testDatabase.Name.ApplyT(func(name string) (string, error) {
return fmt.Sprintf("SELECT * FROM %v WHERE x = ?", name), nil
}).(pulumi.StringOutput),
Workgroup: testWorkgroup.Name,
})
if err != nil {
return err
}
return nil
})
}
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var test = new Aws.S3.BucketV2("test", new()
{
Bucket = "tf-test",
ForceDestroy = true,
});
var testWorkgroup = new Aws.Athena.Workgroup("test", new()
{
Name = "tf-test",
});
var testDatabase = new Aws.Athena.Database("test", new()
{
Name = "example",
Bucket = test.Bucket,
});
var testPreparedStatement = new Aws.Athena.PreparedStatement("test", new()
{
Name = "tf_test",
QueryStatement = testDatabase.Name.Apply(name => $"SELECT * FROM {name} WHERE x = ?"),
Workgroup = testWorkgroup.Name,
});
});
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.s3.BucketV2;
import com.pulumi.aws.s3.BucketV2Args;
import com.pulumi.aws.athena.Workgroup;
import com.pulumi.aws.athena.WorkgroupArgs;
import com.pulumi.aws.athena.Database;
import com.pulumi.aws.athena.DatabaseArgs;
import com.pulumi.aws.athena.PreparedStatement;
import com.pulumi.aws.athena.PreparedStatementArgs;
import java.util.List;
import java.util.ArrayList;
import java.util.Map;
import java.io.File;
import java.nio.file.Files;
import java.nio.file.Paths;
public class App {
public static void main(String[] args) {
Pulumi.run(App::stack);
}
public static void stack(Context ctx) {
var test = new BucketV2("test", BucketV2Args.builder()
.bucket("tf-test")
.forceDestroy(true)
.build());
var testWorkgroup = new Workgroup("testWorkgroup", WorkgroupArgs.builder()
.name("tf-test")
.build());
var testDatabase = new Database("testDatabase", DatabaseArgs.builder()
.name("example")
.bucket(test.bucket())
.build());
var testPreparedStatement = new PreparedStatement("testPreparedStatement", PreparedStatementArgs.builder()
.name("tf_test")
.queryStatement(testDatabase.name().applyValue(name -> String.format("SELECT * FROM %s WHERE x = ?", name)))
.workgroup(testWorkgroup.name())
.build());
}
}
resources:
test:
type: aws:s3:BucketV2
properties:
bucket: tf-test
forceDestroy: true
testWorkgroup:
type: aws:athena:Workgroup
name: test
properties:
name: tf-test
testDatabase:
type: aws:athena:Database
name: test
properties:
name: example
bucket: ${test.bucket}
testPreparedStatement:
type: aws:athena:PreparedStatement
name: test
properties:
name: tf_test
queryStatement: SELECT * FROM ${testDatabase.name} WHERE x = ?
workgroup: ${testWorkgroup.name}
Create PreparedStatement Resource
Resources are created with functions called constructors. To learn more about declaring and configuring resources, see Resources.
Constructor syntax
new PreparedStatement(name: string, args: PreparedStatementArgs, opts?: CustomResourceOptions);
@overload
def PreparedStatement(resource_name: str,
args: PreparedStatementArgs,
opts: Optional[ResourceOptions] = None)
@overload
def PreparedStatement(resource_name: str,
opts: Optional[ResourceOptions] = None,
query_statement: Optional[str] = None,
workgroup: Optional[str] = None,
description: Optional[str] = None,
name: Optional[str] = None)
func NewPreparedStatement(ctx *Context, name string, args PreparedStatementArgs, opts ...ResourceOption) (*PreparedStatement, error)
public PreparedStatement(string name, PreparedStatementArgs args, CustomResourceOptions? opts = null)
public PreparedStatement(String name, PreparedStatementArgs args)
public PreparedStatement(String name, PreparedStatementArgs args, CustomResourceOptions options)
type: aws:athena:PreparedStatement
properties: # The arguments to resource properties.
options: # Bag of options to control resource's behavior.
Parameters
- name string
- The unique name of the resource.
- args PreparedStatementArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- resource_name str
- The unique name of the resource.
- args PreparedStatementArgs
- The arguments to resource properties.
- opts ResourceOptions
- Bag of options to control resource's behavior.
- ctx Context
- Context object for the current deployment.
- name string
- The unique name of the resource.
- args PreparedStatementArgs
- The arguments to resource properties.
- opts ResourceOption
- Bag of options to control resource's behavior.
- name string
- The unique name of the resource.
- args PreparedStatementArgs
- The arguments to resource properties.
- opts CustomResourceOptions
- Bag of options to control resource's behavior.
- name String
- The unique name of the resource.
- args PreparedStatementArgs
- The arguments to resource properties.
- options CustomResourceOptions
- Bag of options to control resource's behavior.
Constructor example
The following reference example uses placeholder values for all input properties.
var preparedStatementResource = new Aws.Athena.PreparedStatement("preparedStatementResource", new()
{
QueryStatement = "string",
Workgroup = "string",
Description = "string",
Name = "string",
});
example, err := athena.NewPreparedStatement(ctx, "preparedStatementResource", &athena.PreparedStatementArgs{
QueryStatement: pulumi.String("string"),
Workgroup: pulumi.String("string"),
Description: pulumi.String("string"),
Name: pulumi.String("string"),
})
var preparedStatementResource = new PreparedStatement("preparedStatementResource", PreparedStatementArgs.builder()
.queryStatement("string")
.workgroup("string")
.description("string")
.name("string")
.build());
prepared_statement_resource = aws.athena.PreparedStatement("preparedStatementResource",
query_statement="string",
workgroup="string",
description="string",
name="string")
const preparedStatementResource = new aws.athena.PreparedStatement("preparedStatementResource", {
queryStatement: "string",
workgroup: "string",
description: "string",
name: "string",
});
type: aws:athena:PreparedStatement
properties:
description: string
name: string
queryStatement: string
workgroup: string
PreparedStatement Resource Properties
To learn more about resource properties and how to use them, see Inputs and Outputs in the Architecture and Concepts docs.
Inputs
The PreparedStatement resource accepts the following input properties:
- Query
Statement string - The query string for the prepared statement.
- Workgroup string
- The name of the workgroup to which the prepared statement belongs.
- Description string
- Brief explanation of prepared statement. Maximum length of 1024.
- Name string
- The name of the prepared statement. Maximum length of 256.
- Query
Statement string - The query string for the prepared statement.
- Workgroup string
- The name of the workgroup to which the prepared statement belongs.
- Description string
- Brief explanation of prepared statement. Maximum length of 1024.
- Name string
- The name of the prepared statement. Maximum length of 256.
- query
Statement String - The query string for the prepared statement.
- workgroup String
- The name of the workgroup to which the prepared statement belongs.
- description String
- Brief explanation of prepared statement. Maximum length of 1024.
- name String
- The name of the prepared statement. Maximum length of 256.
- query
Statement string - The query string for the prepared statement.
- workgroup string
- The name of the workgroup to which the prepared statement belongs.
- description string
- Brief explanation of prepared statement. Maximum length of 1024.
- name string
- The name of the prepared statement. Maximum length of 256.
- query_
statement str - The query string for the prepared statement.
- workgroup str
- The name of the workgroup to which the prepared statement belongs.
- description str
- Brief explanation of prepared statement. Maximum length of 1024.
- name str
- The name of the prepared statement. Maximum length of 256.
- query
Statement String - The query string for the prepared statement.
- workgroup String
- The name of the workgroup to which the prepared statement belongs.
- description String
- Brief explanation of prepared statement. Maximum length of 1024.
- name String
- The name of the prepared statement. Maximum length of 256.
Outputs
All input properties are implicitly available as output properties. Additionally, the PreparedStatement resource produces the following output properties:
- Id string
- The provider-assigned unique ID for this managed resource.
- Id string
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
- id string
- The provider-assigned unique ID for this managed resource.
- id str
- The provider-assigned unique ID for this managed resource.
- id String
- The provider-assigned unique ID for this managed resource.
Look up Existing PreparedStatement Resource
Get an existing PreparedStatement resource’s state with the given name, ID, and optional extra properties used to qualify the lookup.
public static get(name: string, id: Input<ID>, state?: PreparedStatementState, opts?: CustomResourceOptions): PreparedStatement
@staticmethod
def get(resource_name: str,
id: str,
opts: Optional[ResourceOptions] = None,
description: Optional[str] = None,
name: Optional[str] = None,
query_statement: Optional[str] = None,
workgroup: Optional[str] = None) -> PreparedStatement
func GetPreparedStatement(ctx *Context, name string, id IDInput, state *PreparedStatementState, opts ...ResourceOption) (*PreparedStatement, error)
public static PreparedStatement Get(string name, Input<string> id, PreparedStatementState? state, CustomResourceOptions? opts = null)
public static PreparedStatement get(String name, Output<String> id, PreparedStatementState state, CustomResourceOptions options)
Resource lookup is not supported in YAML
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- resource_name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- name
- The unique name of the resulting resource.
- id
- The unique provider ID of the resource to lookup.
- state
- Any extra arguments used during the lookup.
- opts
- A bag of options that control this resource's behavior.
- Description string
- Brief explanation of prepared statement. Maximum length of 1024.
- Name string
- The name of the prepared statement. Maximum length of 256.
- Query
Statement string - The query string for the prepared statement.
- Workgroup string
- The name of the workgroup to which the prepared statement belongs.
- Description string
- Brief explanation of prepared statement. Maximum length of 1024.
- Name string
- The name of the prepared statement. Maximum length of 256.
- Query
Statement string - The query string for the prepared statement.
- Workgroup string
- The name of the workgroup to which the prepared statement belongs.
- description String
- Brief explanation of prepared statement. Maximum length of 1024.
- name String
- The name of the prepared statement. Maximum length of 256.
- query
Statement String - The query string for the prepared statement.
- workgroup String
- The name of the workgroup to which the prepared statement belongs.
- description string
- Brief explanation of prepared statement. Maximum length of 1024.
- name string
- The name of the prepared statement. Maximum length of 256.
- query
Statement string - The query string for the prepared statement.
- workgroup string
- The name of the workgroup to which the prepared statement belongs.
- description str
- Brief explanation of prepared statement. Maximum length of 1024.
- name str
- The name of the prepared statement. Maximum length of 256.
- query_
statement str - The query string for the prepared statement.
- workgroup str
- The name of the workgroup to which the prepared statement belongs.
- description String
- Brief explanation of prepared statement. Maximum length of 1024.
- name String
- The name of the prepared statement. Maximum length of 256.
- query
Statement String - The query string for the prepared statement.
- workgroup String
- The name of the workgroup to which the prepared statement belongs.
Import
Using pulumi import
, import Athena Prepared Statement using the WORKGROUP-NAME/STATEMENT-NAME
. For example:
$ pulumi import aws:athena/preparedStatement:PreparedStatement example 12345abcde/example
To learn more about importing existing cloud resources, see Importing resources.
Package Details
- Repository
- AWS Classic pulumi/pulumi-aws
- License
- Apache-2.0
- Notes
- This Pulumi package is based on the
aws
Terraform Provider.
Try AWS Native preview for resources not in the classic version.