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:
  • name (str)

  • config (Dict[str, Any])

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)