1. Packages
  2. PostgreSQL
  3. API Docs
  4. getTables
PostgreSQL v3.11.0 published on Sunday, Mar 3, 2024 by Pulumi

postgresql.getTables

Explore with Pulumi AI

postgresql logo
PostgreSQL v3.11.0 published on Sunday, Mar 3, 2024 by Pulumi

    The postgresql.getTables data source retrieves a list of table names from a specified PostgreSQL database.

    Usage

    import * as pulumi from "@pulumi/pulumi";
    import * as postgresql from "@pulumi/postgresql";
    
    const myTables = postgresql.getTables({
        database: "my_database",
    });
    
    import pulumi
    import pulumi_postgresql as postgresql
    
    my_tables = postgresql.get_tables(database="my_database")
    
    using System.Collections.Generic;
    using System.Linq;
    using Pulumi;
    using PostgreSql = Pulumi.PostgreSql;
    
    return await Deployment.RunAsync(() => 
    {
        var myTables = PostgreSql.GetTables.Invoke(new()
        {
            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.GetTables(ctx, &postgresql.GetTablesArgs{
    			Database: "my_database",
    		}, nil)
    		if err != nil {
    			return err
    		}
    		return nil
    	})
    }
    
    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.GetTablesArgs;
    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 myTables = PostgresqlFunctions.getTables(GetTablesArgs.builder()
                .database("my_database")
                .build());
    
        }
    }
    
    variables:
      myTables:
        fn::invoke:
          Function: postgresql:getTables
          Arguments:
            database: my_database
    

    Using getTables

    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 getTables(args: GetTablesArgs, opts?: InvokeOptions): Promise<GetTablesResult>
    function getTablesOutput(args: GetTablesOutputArgs, opts?: InvokeOptions): Output<GetTablesResult>
    def get_tables(database: Optional[str] = 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,
                   schemas: Optional[Sequence[str]] = None,
                   table_types: Optional[Sequence[str]] = None,
                   opts: Optional[InvokeOptions] = None) -> GetTablesResult
    def get_tables_output(database: Optional[pulumi.Input[str]] = 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,
                   schemas: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                   table_types: Optional[pulumi.Input[Sequence[pulumi.Input[str]]]] = None,
                   opts: Optional[InvokeOptions] = None) -> Output[GetTablesResult]
    func GetTables(ctx *Context, args *GetTablesArgs, opts ...InvokeOption) (*GetTablesResult, error)
    func GetTablesOutput(ctx *Context, args *GetTablesOutputArgs, opts ...InvokeOption) GetTablesResultOutput

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

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

    The following arguments are supported:

    Database string
    The PostgreSQL database which will be queried for table names.
    LikeAllPatterns List<string>
    List of expressions which will be pattern matched against table names in the query using the PostgreSQL LIKE ALL operators.
    LikeAnyPatterns List<string>
    List of expressions which will be pattern matched against table names in the query using the PostgreSQL LIKE ANY operators.
    NotLikeAllPatterns List<string>
    List of expressions which will be pattern matched against table names in the query using the PostgreSQL NOT LIKE ALL operators.
    RegexPattern string

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

    Note that all optional arguments can be used in conjunction.

    Schemas List<string>
    List of PostgreSQL schema(s) which will be queried for table names. Queries all schemas in the database by default.
    TableTypes List<string>
    List of PostgreSQL table types which will be queried for table names. Includes all table types by default (including views and temp tables). Use 'BASE TABLE' for normal tables only.
    Database string
    The PostgreSQL database which will be queried for table names.
    LikeAllPatterns []string
    List of expressions which will be pattern matched against table names in the query using the PostgreSQL LIKE ALL operators.
    LikeAnyPatterns []string
    List of expressions which will be pattern matched against table names in the query using the PostgreSQL LIKE ANY operators.
    NotLikeAllPatterns []string
    List of expressions which will be pattern matched against table names in the query using the PostgreSQL NOT LIKE ALL operators.
    RegexPattern string

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

    Note that all optional arguments can be used in conjunction.

    Schemas []string
    List of PostgreSQL schema(s) which will be queried for table names. Queries all schemas in the database by default.
    TableTypes []string
    List of PostgreSQL table types which will be queried for table names. Includes all table types by default (including views and temp tables). Use 'BASE TABLE' for normal tables only.
    database String
    The PostgreSQL database which will be queried for table names.
    likeAllPatterns List<String>
    List of expressions which will be pattern matched against table names in the query using the PostgreSQL LIKE ALL operators.
    likeAnyPatterns List<String>
    List of expressions which will be pattern matched against table names in the query using the PostgreSQL LIKE ANY operators.
    notLikeAllPatterns List<String>
    List of expressions which will be pattern matched against table names in the query using the PostgreSQL NOT LIKE ALL operators.
    regexPattern String

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

    Note that all optional arguments can be used in conjunction.

    schemas List<String>
    List of PostgreSQL schema(s) which will be queried for table names. Queries all schemas in the database by default.
    tableTypes List<String>
    List of PostgreSQL table types which will be queried for table names. Includes all table types by default (including views and temp tables). Use 'BASE TABLE' for normal tables only.
    database string
    The PostgreSQL database which will be queried for table names.
    likeAllPatterns string[]
    List of expressions which will be pattern matched against table names in the query using the PostgreSQL LIKE ALL operators.
    likeAnyPatterns string[]
    List of expressions which will be pattern matched against table names in the query using the PostgreSQL LIKE ANY operators.
    notLikeAllPatterns string[]
    List of expressions which will be pattern matched against table names in the query using the PostgreSQL NOT LIKE ALL operators.
    regexPattern string

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

    Note that all optional arguments can be used in conjunction.

    schemas string[]
    List of PostgreSQL schema(s) which will be queried for table names. Queries all schemas in the database by default.
    tableTypes string[]
    List of PostgreSQL table types which will be queried for table names. Includes all table types by default (including views and temp tables). Use 'BASE TABLE' for normal tables only.
    database str
    The PostgreSQL database which will be queried for table names.
    like_all_patterns Sequence[str]
    List of expressions which will be pattern matched against table names in the query using the PostgreSQL LIKE ALL operators.
    like_any_patterns Sequence[str]
    List of expressions which will be pattern matched against table names in the query using the PostgreSQL LIKE ANY operators.
    not_like_all_patterns Sequence[str]
    List of expressions which will be pattern matched against table names in the query using the PostgreSQL NOT LIKE ALL operators.
    regex_pattern str

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

    Note that all optional arguments can be used in conjunction.

    schemas Sequence[str]
    List of PostgreSQL schema(s) which will be queried for table names. Queries all schemas in the database by default.
    table_types Sequence[str]
    List of PostgreSQL table types which will be queried for table names. Includes all table types by default (including views and temp tables). Use 'BASE TABLE' for normal tables only.
    database String
    The PostgreSQL database which will be queried for table names.
    likeAllPatterns List<String>
    List of expressions which will be pattern matched against table names in the query using the PostgreSQL LIKE ALL operators.
    likeAnyPatterns List<String>
    List of expressions which will be pattern matched against table names in the query using the PostgreSQL LIKE ANY operators.
    notLikeAllPatterns List<String>
    List of expressions which will be pattern matched against table names in the query using the PostgreSQL NOT LIKE ALL operators.
    regexPattern String

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

    Note that all optional arguments can be used in conjunction.

    schemas List<String>
    List of PostgreSQL schema(s) which will be queried for table names. Queries all schemas in the database by default.
    tableTypes List<String>
    List of PostgreSQL table types which will be queried for table names. Includes all table types by default (including views and temp tables). Use 'BASE TABLE' for normal tables only.

    getTables Result

    The following output properties are available:

    Database string
    Id string
    The provider-assigned unique ID for this managed resource.
    Tables List<Pulumi.PostgreSql.Outputs.GetTablesTable>
    A list of PostgreSQL tables retrieved by this data source. Each table consists of the fields documented below.


    LikeAllPatterns List<string>
    LikeAnyPatterns List<string>
    NotLikeAllPatterns List<string>
    RegexPattern string
    Schemas List<string>
    TableTypes List<string>
    Database string
    Id string
    The provider-assigned unique ID for this managed resource.
    Tables []GetTablesTable
    A list of PostgreSQL tables retrieved by this data source. Each table consists of the fields documented below.


    LikeAllPatterns []string
    LikeAnyPatterns []string
    NotLikeAllPatterns []string
    RegexPattern string
    Schemas []string
    TableTypes []string
    database String
    id String
    The provider-assigned unique ID for this managed resource.
    tables List<GetTablesTable>
    A list of PostgreSQL tables retrieved by this data source. Each table consists of the fields documented below.


    likeAllPatterns List<String>
    likeAnyPatterns List<String>
    notLikeAllPatterns List<String>
    regexPattern String
    schemas List<String>
    tableTypes List<String>
    database string
    id string
    The provider-assigned unique ID for this managed resource.
    tables GetTablesTable[]
    A list of PostgreSQL tables retrieved by this data source. Each table consists of the fields documented below.


    likeAllPatterns string[]
    likeAnyPatterns string[]
    notLikeAllPatterns string[]
    regexPattern string
    schemas string[]
    tableTypes string[]
    database str
    id str
    The provider-assigned unique ID for this managed resource.
    tables Sequence[GetTablesTable]
    A list of PostgreSQL tables retrieved by this data source. Each table consists of the fields documented below.


    like_all_patterns Sequence[str]
    like_any_patterns Sequence[str]
    not_like_all_patterns Sequence[str]
    regex_pattern str
    schemas Sequence[str]
    table_types Sequence[str]
    database String
    id String
    The provider-assigned unique ID for this managed resource.
    tables List<Property Map>
    A list of PostgreSQL tables retrieved by this data source. Each table consists of the fields documented below.


    likeAllPatterns List<String>
    likeAnyPatterns List<String>
    notLikeAllPatterns List<String>
    regexPattern String
    schemas List<String>
    tableTypes List<String>

    Supporting Types

    GetTablesTable

    ObjectName string
    The table name.
    SchemaName string
    The parent schema.
    TableType string
    The table type as defined in information_schema.tables.
    ObjectName string
    The table name.
    SchemaName string
    The parent schema.
    TableType string
    The table type as defined in information_schema.tables.
    objectName String
    The table name.
    schemaName String
    The parent schema.
    tableType String
    The table type as defined in information_schema.tables.
    objectName string
    The table name.
    schemaName string
    The parent schema.
    tableType string
    The table type as defined in information_schema.tables.
    object_name str
    The table name.
    schema_name str
    The parent schema.
    table_type str
    The table type as defined in information_schema.tables.
    objectName String
    The table name.
    schemaName String
    The parent schema.
    tableType String
    The table type as defined in information_schema.tables.

    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.11.0 published on Sunday, Mar 3, 2024 by Pulumi