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

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

ds_provider_postgresql_py_lib-0.1.0.tar.gz (21.6 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

ds_provider_postgresql_py_lib-0.1.0-py3-none-any.whl (22.9 kB view details)

Uploaded Python 3

File details

Details for the file ds_provider_postgresql_py_lib-0.1.0.tar.gz.

File metadata

File hashes

Hashes for ds_provider_postgresql_py_lib-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0d1d029704d5afac9dd45fe116ac1b38124ddb941fae018e4f7cfe2a82e1c430
MD5 277e476c09d6af970c73e51ddc38a0b1
BLAKE2b-256 cc42f56434f280c8329f2f1a4f1cfe78f136ea6ddbb43507dd027d208bae4893

See more details on using hashes here.

File details

Details for the file ds_provider_postgresql_py_lib-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for ds_provider_postgresql_py_lib-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 4ef1ae6f678b0ccb1bd91db68b2d03800d11c3c35ec779584ed51d6d2bcb9f02
MD5 d6953e79b271837894c2a3c5450da5aa
BLAKE2b-256 f0398d3b82a96e4c28efae914d2ce0f46f47320d78a6abb28eb4b6361fce9837

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page