praval.storage.providers.postgresql๏ƒ

PostgreSQL storage provider for Praval framework

Provides relational database capabilities with SQL query support, transactions, and schema management.

Classes

PostgreSQLProvider(name,ย config)

PostgreSQL storage provider with async connection pooling.

class praval.storage.providers.postgresql.PostgreSQLProvider(name, config)[source]๏ƒ

Bases: BaseStorageProvider

PostgreSQL storage provider with async connection pooling.

Features: - Async connection pooling - SQL query execution - Transaction support - Schema management - JSON column support - Full-text search capabilities

Parameters:
async connect()[source]๏ƒ

Establish connection pool to PostgreSQL.

Return type:

bool

async disconnect()[source]๏ƒ

Close connection pool.

async store(resource, data, **kwargs)[source]๏ƒ

Store data in PostgreSQL table.

Parameters:
  • resource (str) โ€“ Table name

  • data (Any) โ€“ Data to store (dict or list of dicts)

  • **kwargs โ€“ Additional parameters (upsert, returning, etc.)

Return type:

StorageResult

Returns:

StorageResult with operation outcome

async retrieve(resource, **kwargs)[source]๏ƒ

Retrieve data from PostgreSQL table.

Parameters:
  • resource (str) โ€“ Table name

  • **kwargs โ€“ Query parameters (where, limit, offset, order_by, etc.)

Return type:

StorageResult

Returns:

StorageResult with retrieved data

async query(resource, query, **kwargs)[source]๏ƒ

Execute SQL query against PostgreSQL.

Parameters:
  • resource (str) โ€“ Table name (ignored for raw SQL)

  • query (Union[str, Dict]) โ€“ SQL query string or structured query dict

  • **kwargs โ€“ Query parameters

Return type:

StorageResult

Returns:

StorageResult with query results

async delete(resource, **kwargs)[source]๏ƒ

Delete data from PostgreSQL table.

Parameters:
  • resource (str) โ€“ Table name

  • **kwargs โ€“ Delete parameters (where clause required)

Return type:

StorageResult

Returns:

StorageResult with operation outcome

async list_resources(prefix='', **kwargs)[source]๏ƒ

List tables in the database.

Return type:

StorageResult

Parameters:

prefix (str)