Flow PHP

PostgreSql

Classes

EntryTypesMap
Maps between Flow ETL types and PostgreSQL types.
PostgreSqlCursorExtractor
PostgreSQL extractor using server-side cursors for memory-efficient extraction.
PostgreSqlEncoder
PostgreSqlKeySetExtractor
PostgreSqlLimitOffsetExtractor
PostgreSqlLoader
PostgreSQL loader for ETL pipelines.
ReadQuery
ResultSchema
SchemaConverter
Converts between a Flow {@see Schema} and a PostgreSQL {@see Table}.
TransactionalPostgreSqlLoader
Execute multiple loaders within PostgreSQL transactions.

Namespaces

Exception
LoaderOptions
Pagination
QueryBuilder
Schema
ValueConverter

Enums

Operation
PostgreSqlMetadata
Per-column metadata keys understood by {@see SchemaConverter} when converting a Flow Schema to a PostgreSQL table.

Functions

from_pgsql_cursor()

Create a PostgreSQL cursor extractor using server-side cursors for memory-efficient extraction.

from_pgsql_cursor(Client $client, Sql|string $query[, array<int, mixed> $parameters = [] ]) : PostgreSqlCursorExtractor

Uses DECLARE CURSOR + FETCH to stream data without loading entire result set into memory. This is the only way to achieve true low memory extraction with PHP's ext-pgsql.

Note: Requires a transaction context (auto-started if not in one).

Parameters
$client : Client

PostgreSQL client

$query : Sql|string

SQL query to execute (wrapped in DECLARE CURSOR)

$parameters : array<int, mixed> = []

Values bound by position to $1, $2, ... placeholders; wrap with typed() to force a specific PostgreSQL type

Return values
PostgreSqlCursorExtractor

from_pgsql_limit_offset()

Create a PostgreSQL extractor using LIMIT/OFFSET pagination.

from_pgsql_limit_offset(Client $client, Sql|string $query[, array<int, mixed> $parameters = [] ]) : PostgreSqlLimitOffsetExtractor

Suitable for smaller datasets. For large datasets, consider using keyset pagination (from_pgsql_key_set) which is more efficient.

Parameters
$client : Client

PostgreSQL client

$query : Sql|string

SQL query to execute (must have ORDER BY clause)

$parameters : array<int, mixed> = []

Values bound by position to $1, $2, ... placeholders; wrap with typed() to force a specific PostgreSQL type

Return values
PostgreSqlLimitOffsetExtractor

from_pgsql_key_set()

Create a PostgreSQL extractor using keyset (cursor-based) pagination.

from_pgsql_key_set(Client $client, Sql|string $query, KeySet $keySet[, array<int, mixed> $parameters = [] ]) : PostgreSqlKeySetExtractor

More efficient than LIMIT/OFFSET for large datasets - uses indexed WHERE conditions instead of skipping rows.

Parameters
$client : Client

PostgreSQL client

$query : Sql|string

SQL query to execute (must have ORDER BY matching keyset columns)

$keySet : KeySet

Columns to use for keyset pagination

$parameters : array<int, mixed> = []

Values bound by position to $1, $2, ... placeholders; wrap with typed() to force a specific PostgreSQL type

Return values
PostgreSqlKeySetExtractor

pgsql_pagination_key_asc()

pgsql_pagination_key_asc(string $column) : Key
Parameters
$column : string
Return values
Key

pgsql_pagination_key_desc()

pgsql_pagination_key_desc(string $column) : Key
Parameters
$column : string
Return values
Key

to_pgsql_transaction()

Execute multiple loaders within PostgreSQL transactions.

to_pgsql_transaction(Client $client, Loader ...$loaders) : TransactionalPostgreSqlLoader

Each batch of rows is loaded in its own transaction; rows a wrapped Transformation delivers when the loader is closed (blocking operations drain there) are committed in one final transaction. If any loader fails, the open transaction is rolled back. All wrapped loaders must use the same Client instance as the wrapper - a loader holding its own Client escapes the transaction.

Parameters
$client : Client
$loaders : Loader
Return values
TransactionalPostgreSqlLoader

pgsql_insert_options()

Create insert options for PostgreSQL loader.

pgsql_insert_options([bool $skipConflicts = false ][, array<int, string> $conflictColumns = [] ][, null|string $conflictConstraint = null ][, array<int, string> $updateColumns = [] ]) : InsertOptions
Parameters
$skipConflicts : bool = false

If true, use ON CONFLICT DO NOTHING

$conflictColumns : array<int, string> = []

Column names for ON CONFLICT (columns)

$conflictConstraint : null|string = null

Constraint name for ON CONFLICT ON CONSTRAINT

$updateColumns : array<int, string> = []

Columns to update on conflict (empty = all non-key columns)

Return values
InsertOptions

pgsql_update_options()

Create update options for PostgreSQL loader.

pgsql_update_options(array<int, string> $primaryKeys) : UpdateOptions
Parameters
$primaryKeys : array<int, string>

Columns to use in WHERE clause for matching rows

Return values
UpdateOptions

pgsql_delete_options()

Create delete options for PostgreSQL loader.

pgsql_delete_options(array<int, string> $primaryKeys) : DeleteOptions
Parameters
$primaryKeys : array<int, string>

Columns to use in WHERE clause for matching rows

Return values
DeleteOptions

to_pgsql_schema_table()

Convert a Flow Schema into a PostgreSQL table definition.

to_pgsql_schema_table(Schema $schema, string $tableName[, string $databaseSchema = 'public' ][, EntryTypesMap|null $typesMap = null ][, TableOptions|null $options = null ]) : Table
Parameters
$schema : Schema
$tableName : string
$databaseSchema : string = 'public'

PostgreSQL schema (namespace) the table belongs to

$typesMap : EntryTypesMap|null = null
$options : TableOptions|null = null

table-level options the Flow Schema cannot express (e.g. UNLOGGED)

Return values
Table

pgsql_table_to_flow_schema()

Convert a PostgreSQL table definition into a Flow Schema.

pgsql_table_to_flow_schema(Table $table[, EntryTypesMap|null $typesMap = null ]) : Schema
Parameters
$table : Table
$typesMap : EntryTypesMap|null = null
Return values
Schema
On this page

Search results