PreparedStatement class
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.Bucket("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.Bucket("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)
using System.Collections.Generic;
using System.Linq;
using Pulumi;
using Aws = Pulumi.Aws;
return await Deployment.RunAsync(() =>
{
var test = new Aws.S3.Bucket("test", new()
{
BucketName = "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.BucketName,
});
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 main
import (
"fmt"
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/athena"
"github.com/pulumi/pulumi-aws/sdk/v7/go/aws/s3"
"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
)
func main() {
pulumi.Run(func(ctx *pulumi.Context) error {
test, err := s3.NewBucket(ctx, "test", &s3.BucketArgs{
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
})
}
pulumi {
required_providers {
aws = {
source = "pulumi/aws"
}
}
}
resource "aws_s3_bucket" "test" {
bucket = "tf-test"
force_destroy = true
}
resource "aws_athena_workgroup" "test" {
name = "tf-test"
}
resource "aws_athena_database" "test" {
name = "example"
bucket = aws_s3_bucket.test.bucket
}
resource "aws_athena_preparedstatement" "test" {
name = "tf_test"
query_statement ="SELECT * FROM ${aws_athena_database.test.name} WHERE x = ?"
workgroup = aws_athena_workgroup.test.name
}
package generated_program;
import com.pulumi.Context;
import com.pulumi.Pulumi;
import com.pulumi.core.Output;
import com.pulumi.aws.s3.Bucket;
import com.pulumi.aws.s3.BucketArgs;
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.ArrayList;
import java.util.Arrays;
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 Bucket("test", BucketArgs.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:Bucket
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}
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
Constructors
- PreparedStatement(String name, {PreparedStatementArgs? args, CustomResourceOptions? options})
-
Creates a new PreparedStatement.
nameThe Pulumi resource name.argsArguments used to configure this PreparedStatement. The set of arguments for PreparedStatement.optionsResource options controlling this resource's behavior. - PreparedStatement.reference(String urn)
- Creates a typed reference to an existing PreparedStatement resource.
Properties
-
childResources
→ Set<
Resource> -
finalinherited
-
completionSources
↔ Map<
String, IOutputCompletionSource> -
latefinalinherited
-
description
↔ Output<
String?> -
Brief explanation of prepared statement. Maximum length of 1024.
latefinal
- hashCode → int
-
The hash code for this object.
no setterinherited
-
id
↔ Output<
String> -
getter/setter pairinherited
- isCustom → bool
-
Returns whether this resource is provider-managed.
no setterinherited
- isProtected → bool
-
Returns whether this resource is protected from deletion.
no setterinherited
- isRemote → bool
-
Whether this resource is registered as remote.
no setterinherited
- isResourceReference → bool
-
Whether this instance represents a resource value returned over RPC.
finalinherited
-
name
↔ Output<
String> -
The name of the prepared statement. Maximum length of 256.
latefinal
-
queryStatement
↔ Output<
String> -
The query string for the prepared statement.
latefinal
-
region
↔ Output<
String> -
Region where this resource will be managed. Defaults to the Region set in the provider configuration.
latefinal
-
resourceTransforms
→ List<
ResourceTransform> -
Inherited/explicit async transforms.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
-
transformations
→ List<
ResourceTransformation> -
Inherited/explicit legacy transformations.
no setterinherited
-
urn
↔ Output<
String> -
latefinalinherited
-
workgroup
↔ Output<
String> -
The name of the workgroup to which the prepared statement belongs.
latefinal
Methods
-
failId(
Object error) → void -
Completes this resource ID with an error when registration fails.
inherited
-
failOutputs(
Object error) → void -
Completes all output properties with
error.inherited -
failUrn(
Object error) → void -
Completes this resource URN with an error when registration fails.
inherited
-
getProvider(
String moduleMember) → ProviderResource? -
Returns provider for
moduleMember's package, if configured.inherited -
getResourceName(
) → String -
Returns this resource's logical name.
inherited
-
getResourceType(
) → String -
Returns this resource's Pulumi type token.
inherited
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
registerOutput<
T> (String propertyName, {Object? decoder(Object?)?, bool isSecret = false}) → Output< T> -
Registers a dynamic output property for this resource.
inherited
-
resolveId(
String? value, {required bool isKnown}) → void -
Resolves the provider-assigned ID for this resource.
inherited
-
resolveOutputs(
Struct outputs) → void -
Resolves all output properties from a monitor response payload.
inherited
-
resolveUrn(
String value) → void -
Resolves this resource's URN once assigned by the engine.
inherited
-
serializeProperties(
Map< String, dynamic> properties) → Future<Struct> -
Serializes resource properties for RPC transmission.
inherited
-
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
get(
String name, Input< String> id, {PreparedStatementState? state, CustomResourceOptions? options}) → PreparedStatement -
Gets an existing PreparedStatement resource's state with the given
nameandid.