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)
// 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.
- Like
All List<string>Patterns - List of expressions which will be pattern matched against table names in the query using the PostgreSQL
LIKE ALL
operators. - Like
Any List<string>Patterns - List of expressions which will be pattern matched against table names in the query using the PostgreSQL
LIKE ANY
operators. - Not
Like List<string>All Patterns - List of expressions which will be pattern matched against table names in the query using the PostgreSQL
NOT LIKE ALL
operators. - Regex
Pattern 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.
- Table
Types 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.
- Like
All []stringPatterns - List of expressions which will be pattern matched against table names in the query using the PostgreSQL
LIKE ALL
operators. - Like
Any []stringPatterns - List of expressions which will be pattern matched against table names in the query using the PostgreSQL
LIKE ANY
operators. - Not
Like []stringAll Patterns - List of expressions which will be pattern matched against table names in the query using the PostgreSQL
NOT LIKE ALL
operators. - Regex
Pattern 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.
- Table
Types []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.
- like
All List<String>Patterns - List of expressions which will be pattern matched against table names in the query using the PostgreSQL
LIKE ALL
operators. - like
Any List<String>Patterns - List of expressions which will be pattern matched against table names in the query using the PostgreSQL
LIKE ANY
operators. - not
Like List<String>All Patterns - List of expressions which will be pattern matched against table names in the query using the PostgreSQL
NOT LIKE ALL
operators. - regex
Pattern 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.
- table
Types 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.
- like
All string[]Patterns - List of expressions which will be pattern matched against table names in the query using the PostgreSQL
LIKE ALL
operators. - like
Any string[]Patterns - List of expressions which will be pattern matched against table names in the query using the PostgreSQL
LIKE ANY
operators. - not
Like string[]All Patterns - List of expressions which will be pattern matched against table names in the query using the PostgreSQL
NOT LIKE ALL
operators. - regex
Pattern 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.
- table
Types 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 ALL
operators. - like_
any_ Sequence[str]patterns - List of expressions which will be pattern matched against table names in the query using the PostgreSQL
LIKE ANY
operators. - 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 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.
- like
All List<String>Patterns - List of expressions which will be pattern matched against table names in the query using the PostgreSQL
LIKE ALL
operators. - like
Any List<String>Patterns - List of expressions which will be pattern matched against table names in the query using the PostgreSQL
LIKE ANY
operators. - not
Like List<String>All Patterns - List of expressions which will be pattern matched against table names in the query using the PostgreSQL
NOT LIKE ALL
operators. - regex
Pattern 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.
- table
Types 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.
- Like
All List<string>Patterns - Like
Any List<string>Patterns - Not
Like List<string>All Patterns - Regex
Pattern string - Schemas List<string>
- Table
Types List<string>
- Database string
- Id string
- The provider-assigned unique ID for this managed resource.
- Tables
[]Get
Tables Table - A list of PostgreSQL tables retrieved by this data source. Each table consists of the fields documented below.
- Like
All []stringPatterns - Like
Any []stringPatterns - Not
Like []stringAll Patterns - Regex
Pattern string - Schemas []string
- Table
Types []string
- database String
- id String
- The provider-assigned unique ID for this managed resource.
- tables
List<Get
Tables Table> - A list of PostgreSQL tables retrieved by this data source. Each table consists of the fields documented below.
- like
All List<String>Patterns - like
Any List<String>Patterns - not
Like List<String>All Patterns - regex
Pattern String - schemas List<String>
- table
Types List<String>
- database string
- id string
- The provider-assigned unique ID for this managed resource.
- tables
Get
Tables Table[] - A list of PostgreSQL tables retrieved by this data source. Each table consists of the fields documented below.
- like
All string[]Patterns - like
Any string[]Patterns - not
Like string[]All Patterns - regex
Pattern string - schemas string[]
- table
Types string[]
- database str
- id str
- The provider-assigned unique ID for this managed resource.
- tables
Sequence[Get
Tables 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.
- like
All List<String>Patterns - like
Any List<String>Patterns - not
Like List<String>All Patterns - regex
Pattern String - schemas List<String>
- table
Types List<String>
Supporting Types
GetTablesTable
- Object
Name string - The table name.
- Schema
Name string - The parent schema.
- Table
Type string - The table type as defined in
information_schema.tables
.
- Object
Name string - The table name.
- Schema
Name string - The parent schema.
- Table
Type string - The table type as defined in
information_schema.tables
.
- object
Name String - The table name.
- schema
Name String - The parent schema.
- table
Type String - The table type as defined in
information_schema.tables
.
- object
Name string - The table name.
- schema
Name string - The parent schema.
- table
Type 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
.
- object
Name String - The table name.
- schema
Name String - The parent schema.
- table
Type 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.