postgresql.getTables
Explore with Pulumi AI
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")
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
	})
}
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 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)
public static Output<GetTablesResult> getTables(GetTablesArgs args, InvokeOptions options)
fn::invoke:
  function: postgresql:index/getTables:getTables
  arguments:
    # arguments dictionaryThe following arguments are supported:
- Database string
- The PostgreSQL database which will be queried for table names.
- LikeAll List<string>Patterns 
- List of expressions which will be pattern matched against table names in the query using the PostgreSQL LIKE ALLoperators.
- LikeAny List<string>Patterns 
- List of expressions which will be pattern matched against table names in the query using the PostgreSQL LIKE ANYoperators.
- NotLike List<string>All Patterns 
- List of expressions which will be pattern matched against table names in the query using the PostgreSQL NOT LIKE ALLoperators.
- 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.
- LikeAll []stringPatterns 
- List of expressions which will be pattern matched against table names in the query using the PostgreSQL LIKE ALLoperators.
- LikeAny []stringPatterns 
- List of expressions which will be pattern matched against table names in the query using the PostgreSQL LIKE ANYoperators.
- NotLike []stringAll Patterns 
- List of expressions which will be pattern matched against table names in the query using the PostgreSQL NOT LIKE ALLoperators.
- 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.
- likeAll List<String>Patterns 
- List of expressions which will be pattern matched against table names in the query using the PostgreSQL LIKE ALLoperators.
- likeAny List<String>Patterns 
- List of expressions which will be pattern matched against table names in the query using the PostgreSQL LIKE ANYoperators.
- notLike List<String>All Patterns 
- List of expressions which will be pattern matched against table names in the query using the PostgreSQL NOT LIKE ALLoperators.
- 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.
- likeAll string[]Patterns 
- List of expressions which will be pattern matched against table names in the query using the PostgreSQL LIKE ALLoperators.
- likeAny string[]Patterns 
- List of expressions which will be pattern matched against table names in the query using the PostgreSQL LIKE ANYoperators.
- notLike string[]All Patterns 
- List of expressions which will be pattern matched against table names in the query using the PostgreSQL NOT LIKE ALLoperators.
- 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_ Sequence[str]patterns 
- List of expressions which will be pattern matched against table names in the query using the PostgreSQL LIKE ALLoperators.
- like_any_ Sequence[str]patterns 
- List of expressions which will be pattern matched against table names in the query using the PostgreSQL LIKE ANYoperators.
- not_like_ Sequence[str]all_ patterns 
- List of expressions which will be pattern matched against table names in the query using the PostgreSQL NOT LIKE ALLoperators.
- 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.
- likeAll List<String>Patterns 
- List of expressions which will be pattern matched against table names in the query using the PostgreSQL LIKE ALLoperators.
- likeAny List<String>Patterns 
- List of expressions which will be pattern matched against table names in the query using the PostgreSQL LIKE ANYoperators.
- notLike List<String>All Patterns 
- List of expressions which will be pattern matched against table names in the query using the PostgreSQL NOT LIKE ALLoperators.
- 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.Postgre Sql. Outputs. Get Tables Table> 
- A list of PostgreSQL tables retrieved by this data source. Each table consists of the fields documented below.
- LikeAll List<string>Patterns 
- LikeAny List<string>Patterns 
- NotLike List<string>All Patterns 
- RegexPattern string
- Schemas List<string>
- TableTypes List<string>
- Database string
- Id string
- The provider-assigned unique ID for this managed resource.
- Tables
[]GetTables Table 
- A list of PostgreSQL tables retrieved by this data source. Each table consists of the fields documented below.
- LikeAll []stringPatterns 
- LikeAny []stringPatterns 
- NotLike []stringAll Patterns 
- RegexPattern string
- Schemas []string
- TableTypes []string
- database String
- id String
- The provider-assigned unique ID for this managed resource.
- tables
List<GetTables Table> 
- A list of PostgreSQL tables retrieved by this data source. Each table consists of the fields documented below.
- likeAll List<String>Patterns 
- likeAny List<String>Patterns 
- notLike List<String>All Patterns 
- regexPattern String
- schemas List<String>
- tableTypes List<String>
- database string
- id string
- The provider-assigned unique ID for this managed resource.
- tables
GetTables Table[] 
- A list of PostgreSQL tables retrieved by this data source. Each table consists of the fields documented below.
- likeAll string[]Patterns 
- likeAny string[]Patterns 
- notLike string[]All Patterns 
- regexPattern string
- schemas string[]
- tableTypes string[]
- database str
- id str
- The provider-assigned unique ID for this managed resource.
- tables
Sequence[GetTables Table] 
- A list of PostgreSQL tables retrieved by this data source. Each table consists of the fields documented below.
- like_all_ Sequence[str]patterns 
- like_any_ Sequence[str]patterns 
- not_like_ Sequence[str]all_ patterns 
- 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.
- likeAll List<String>Patterns 
- likeAny List<String>Patterns 
- notLike List<String>All Patterns 
- 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 postgresqlTerraform Provider.