1. Packages
  2. PostgreSQL
  3. API Docs
  4. getSchemas
PostgreSQL v3.12.0 published on Thursday, Sep 12, 2024 by Pulumi

postgresql.getSchemas

Explore with Pulumi AI

postgresql logo
PostgreSQL v3.12.0 published on Thursday, Sep 12, 2024 by Pulumi

    The postgresql.getSchemas data source retrieves a list of schema names from a specified PostgreSQL database.

    Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as postgresql from "@pulumi/postgresql";
    
    const mySchemas = postgresql.getSchemas({
        database: "my_database",
    });
    
    import pulumi
    import pulumi_postgresql as postgresql
    
    my_schemas = postgresql.get_schemas(database="my_database")
    
    package main
    
    import (
    	"github.com/pulumi/pulumi-postgresql/sdk/v3/go/postgresql"
    	"github.com/pulumi/pulumi/sdk/v3/go/pulumi"
    )
    
    func main() {
    	pulumi.Run(func(ctx *pulumi.Context) error {
    		_, err := postgresql.GetSchemas(ctx, &postgresql.GetSchemasArgs{
    			Database: "my_database",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using PostgreSql = Pulumi.PostgreSql;
    
    return await Deployment.RunAsync(() => 
    {
        var mySchemas = PostgreSql.GetSchemas.Invoke(new()
        {
            Database = "my_database",
        });
    
    });
    
    package generated_program;
    
    import com.pulumi.Context;
    import com.pulumi.Pulumi;
    import com.pulumi.core.Output;
    import com.pulumi.postgresql.PostgresqlFunctions;
    import com.pulumi.postgresql.inputs.GetSchemasArgs;
    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) {
            final var mySchemas = PostgresqlFunctions.getSchemas(GetSchemasArgs.builder()
                .database("my_database")
                .build());
    
        }
    }
    
    variables:
      mySchemas:
        fn::invoke:
          Function: postgresql:getSchemas
          Arguments:
            database: my_database
    

    Using getSchemas

    Two invocation forms are available. The direct form accepts plain arguments and either blocks until the result value is available, or returns a Promise-wrapped result. The output form accepts Input-wrapped arguments and returns an Output-wrapped result.

    function getSchemas(args: GetSchemasArgs, opts?: InvokeOptions): Promise<GetSchemasResult>
    function getSchemasOutput(args: GetSchemasOutputArgs, opts?: InvokeOptions): Output<GetSchemasResult>
    def get_schemas(database: Optional[str] = None,
                    include_system_schemas: Optional[bool] = None,
                    like_all_patterns: Optional[Sequence[str]] = None,
                    like_any_patterns: Optional[Sequence[str]] = None,
                    not_like_all_patterns: Optional[Sequence[str]] = None,
                    regex_pattern: Optional[str] = None,
                    opts: Optional[InvokeOptions] = None) -> GetSchemasResult
    def get_schemas_output(database: Optional[pulumi.Input[str]] = None,
                    include_system_schemas: Optional[pulumi.Input[bool]] = None,
                    like_all_patterns: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                    like_any_patterns: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                    not_like_all_patterns: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                    regex_pattern: Optional[pulumi.Input[str]] = None,
                    opts: Optional[InvokeOptions] = None) -> Output[GetSchemasResult]
    func GetSchemas(ctx *Context, args *GetSchemasArgs, opts ...InvokeOption) (*GetSchemasResult, error)
    func GetSchemasOutput(ctx *Context, args *GetSchemasOutputArgs, opts ...InvokeOption) GetSchemasResultOutput

    > Note: This function is named GetSchemas in the Go SDK.

    public static class GetSchemas 
    {
        public static Task<GetSchemasResult> InvokeAsync(GetSchemasArgs args, InvokeOptions? opts = null)
        public static Output<GetSchemasResult> Invoke(GetSchemasInvokeArgs args, InvokeOptions? opts = null)
    }
    public static CompletableFuture<GetSchemasResult> getSchemas(GetSchemasArgs args, InvokeOptions options)
    // Output-based functions aren't available in Java yet
    
    fn::invoke:
      function: postgresql:index/getSchemas:getSchemas
      arguments:
        # arguments dictionary

    The following arguments are supported:

    Database string
    The PostgreSQL database which will be queried for schema names.
    IncludeSystemSchemas bool
    Determines whether to include system schemas (pg_ prefix and information_schema). 'public' will always be included. Defaults to false.
    LikeAllPatterns List<string>
    List of expressions which will be pattern matched in the query using the PostgreSQL LIKE ALL operators.
    LikeAnyPatterns List<string>
    List of expressions which will be pattern matched in the query using the PostgreSQL LIKE ANY operators.
    NotLikeAllPatterns List<string>
    List of expressions which will be pattern matched in the query using the PostgreSQL NOT LIKE ALL operators.
    RegexPattern string

    Expression which will be pattern matched in the query using the PostgreSQL ~ (regular expression match) operator.

    Note that all optional arguments can be used in conjunction.

    Database string
    The PostgreSQL database which will be queried for schema names.
    IncludeSystemSchemas bool
    Determines whether to include system schemas (pg_ prefix and information_schema). 'public' will always be included. Defaults to false.
    LikeAllPatterns []string
    List of expressions which will be pattern matched in the query using the PostgreSQL LIKE ALL operators.
    LikeAnyPatterns []string
    List of expressions which will be pattern matched in the query using the PostgreSQL LIKE ANY operators.
    NotLikeAllPatterns []string
    List of expressions which will be pattern matched in the query using the PostgreSQL NOT LIKE ALL operators.
    RegexPattern string

    Expression which will be pattern matched in the query using the PostgreSQL ~ (regular expression match) operator.

    Note that all optional arguments can be used in conjunction.

    database String
    The PostgreSQL database which will be queried for schema names.
    includeSystemSchemas Boolean
    Determines whether to include system schemas (pg_ prefix and information_schema). 'public' will always be included. Defaults to false.
    likeAllPatterns List<String>
    List of expressions which will be pattern matched in the query using the PostgreSQL LIKE ALL operators.
    likeAnyPatterns List<String>
    List of expressions which will be pattern matched in the query using the PostgreSQL LIKE ANY operators.
    notLikeAllPatterns List<String>
    List of expressions which will be pattern matched in the query using the PostgreSQL NOT LIKE ALL operators.
    regexPattern String

    Expression which will be pattern matched in the query using the PostgreSQL ~ (regular expression match) operator.

    Note that all optional arguments can be used in conjunction.

    database string
    The PostgreSQL database which will be queried for schema names.
    includeSystemSchemas boolean
    Determines whether to include system schemas (pg_ prefix and information_schema). 'public' will always be included. Defaults to false.
    likeAllPatterns string[]
    List of expressions which will be pattern matched in the query using the PostgreSQL LIKE ALL operators.
    likeAnyPatterns string[]
    List of expressions which will be pattern matched in the query using the PostgreSQL LIKE ANY operators.
    notLikeAllPatterns string[]
    List of expressions which will be pattern matched in the query using the PostgreSQL NOT LIKE ALL operators.
    regexPattern string

    Expression which will be pattern matched in the query using the PostgreSQL ~ (regular expression match) operator.

    Note that all optional arguments can be used in conjunction.

    database str
    The PostgreSQL database which will be queried for schema names.
    include_system_schemas bool
    Determines whether to include system schemas (pg_ prefix and information_schema). 'public' will always be included. Defaults to false.
    like_all_patterns Sequence[str]
    List of expressions which will be pattern matched in the query using the PostgreSQL LIKE ALL operators.
    like_any_patterns Sequence[str]
    List of expressions which will be pattern matched in the query using the PostgreSQL LIKE ANY operators.
    not_like_all_patterns Sequence[str]
    List of expressions which will be pattern matched in the query using the PostgreSQL NOT LIKE ALL operators.
    regex_pattern str

    Expression which will be pattern matched in the query using the PostgreSQL ~ (regular expression match) operator.

    Note that all optional arguments can be used in conjunction.

    database String
    The PostgreSQL database which will be queried for schema names.
    includeSystemSchemas Boolean
    Determines whether to include system schemas (pg_ prefix and information_schema). 'public' will always be included. Defaults to false.
    likeAllPatterns List<String>
    List of expressions which will be pattern matched in the query using the PostgreSQL LIKE ALL operators.
    likeAnyPatterns List<String>
    List of expressions which will be pattern matched in the query using the PostgreSQL LIKE ANY operators.
    notLikeAllPatterns List<String>
    List of expressions which will be pattern matched in the query using the PostgreSQL NOT LIKE ALL operators.
    regexPattern String

    Expression which will be pattern matched in the query using the PostgreSQL ~ (regular expression match) operator.

    Note that all optional arguments can be used in conjunction.

    getSchemas Result

    The following output properties are available:

    Database string
    Id string
    The provider-assigned unique ID for this managed resource.
    Schemas List<string>
    A list of full names of found schemas.
    IncludeSystemSchemas bool
    LikeAllPatterns List<string>
    LikeAnyPatterns List<string>
    NotLikeAllPatterns List<string>
    RegexPattern string
    Database string
    Id string
    The provider-assigned unique ID for this managed resource.
    Schemas []string
    A list of full names of found schemas.
    IncludeSystemSchemas bool
    LikeAllPatterns []string
    LikeAnyPatterns []string
    NotLikeAllPatterns []string
    RegexPattern string
    database String
    id String
    The provider-assigned unique ID for this managed resource.
    schemas List<String>
    A list of full names of found schemas.
    includeSystemSchemas Boolean
    likeAllPatterns List<String>
    likeAnyPatterns List<String>
    notLikeAllPatterns List<String>
    regexPattern String
    database string
    id string
    The provider-assigned unique ID for this managed resource.
    schemas string[]
    A list of full names of found schemas.
    includeSystemSchemas boolean
    likeAllPatterns string[]
    likeAnyPatterns string[]
    notLikeAllPatterns string[]
    regexPattern string
    database str
    id str
    The provider-assigned unique ID for this managed resource.
    schemas Sequence[str]
    A list of full names of found schemas.
    include_system_schemas bool
    like_all_patterns Sequence[str]
    like_any_patterns Sequence[str]
    not_like_all_patterns Sequence[str]
    regex_pattern str
    database String
    id String
    The provider-assigned unique ID for this managed resource.
    schemas List<String>
    A list of full names of found schemas.
    includeSystemSchemas Boolean
    likeAllPatterns List<String>
    likeAnyPatterns List<String>
    notLikeAllPatterns List<String>
    regexPattern String

    Package Details

    Repository
    PostgreSQL pulumi/pulumi-postgresql
    License
    Apache-2.0
    Notes
    This Pulumi package is based on the postgresql Terraform Provider.
    postgresql logo
    PostgreSQL v3.12.0 published on Thursday, Sep 12, 2024 by Pulumi