Skip to main content

ds-provider-postgresql-py-lib

A PostgreSQL provider for the DS resource plugin ecosystem.

Installation

pip install ds-provider-postgresql-py-lib

Features

  • PostgreSQL linked service with connection pooling and health checks.
  • PostgreSQL dataset implementation with support for:
    • read()
    • create()
    • update()
    • upsert()
    • delete()
    • purge()
  • DS resource typing via:
    • ds.resource.linked_service.postgresql
    • ds.resource.dataset.postgresql

Usage

Public exports

from ds_provider_postgresql_py_lib import (
    PostgreSQLDataset,
    PostgreSQLDatasetSettings,
    PostgreSQLLinkedService,
    PostgreSQLLinkedServiceSettings,
    __version__,
)

Minimal linked service example

import os
import uuid

from ds_provider_postgresql_py_lib import (
    PostgreSQLLinkedService,
    PostgreSQLLinkedServiceSettings,
)

linked_service = PostgreSQLLinkedService(
    id=uuid.uuid4(),
    name="postgres-linked-service",
    version="1.0.0",
    settings=PostgreSQLLinkedServiceSettings(
        uri=os.getenv("DATABASE_URI", ""),
    ),
)

linked_service.connect()
ok, message = linked_service.test_connection()
print(ok, message)

Minimal dataset read example

import os
import uuid

from ds_provider_postgresql_py_lib import (
    PostgreSQLDataset,
    PostgreSQLDatasetSettings,
    PostgreSQLLinkedService,
    PostgreSQLLinkedServiceSettings,
)
from ds_provider_postgresql_py_lib.dataset.postgresql import ReadSettings

dataset = PostgreSQLDataset(
    id=uuid.uuid4(),
    name="postgres-dataset",
    version="1.0.0",
    linked_service=PostgreSQLLinkedService(
        id=uuid.uuid4(),
        name="postgres-linked-service",
        version="1.0.0",
        settings=PostgreSQLLinkedServiceSettings(
            uri=os.getenv("DATABASE_URI", ""),
        ),
    ),
    settings=PostgreSQLDatasetSettings(
        schema="public",
        table="test",
        read=ReadSettings(limit=10),
    ),
)

dataset.linked_service.connect()
dataset.read()
print(dataset.output)

Requirements

  • Python 3.11+
  • See pyproject.toml for the full dependency set.

Documentation

Development

git clone https://github.com/grasp-labs/ds-provider-postgresql-py-lib.git
cd ds-provider-postgresql-py-lib
uv sync --all-extras --dev
make test

License

Apache-2.0. See LICENSE-APACHE.

Support

Metadata

Release files for ds-provider-postgresql-py-lib 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ds-provider-postgresql-py-lib 0.1.0
File Size Uploaded
ds_provider_postgresql_py_lib-0.1.0.tar.gz 21.6 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ds-provider-postgresql-py-lib 0.1.0
File Interpreter ABI Platform
ds_provider_postgresql_py_lib-0.1.0-py3-none-any.whl Python 3 none any Details

Total release size: 44.5 kB

Release files / ds_provider_postgresql_py_lib-0.1.0.tar.gz

Download URL ds_provider_postgresql_py_lib-0.1.0.tar.gz
Size 21.6 kB
Tags Source
SHA-256 checksum
How to use checksums
0d1d029704d5afac9dd45fe116ac1b38124ddb941fae018e4f7cfe2a82e1c430
BLAKE2b-256 checksum
How to use checksums
cc42f56434f280c8329f2f1a4f1cfe78f136ea6ddbb43507dd027d208bae4893
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12

Release files / ds_provider_postgresql_py_lib-0.1.0-py3-none-any.whl

Download URL ds_provider_postgresql_py_lib-0.1.0-py3-none-any.whl
Size 22.9 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4ef1ae6f678b0ccb1bd91db68b2d03800d11c3c35ec779584ed51d6d2bcb9f02
BLAKE2b-256 checksum
How to use checksums
f0398d3b82a96e4c28efae914d2ce0f46f47320d78a6abb28eb4b6361fce9837
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.13.12
Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page