Skip to main content

A Python package from the DS library collection

Project description

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

Project details


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.0b1.tar.gz (21.1 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.0b1-py3-none-any.whl (22.4 kB view details)

Uploaded Python 3

File details

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

File metadata

File hashes

Hashes for ds_provider_postgresql_py_lib-0.1.0b1.tar.gz
Algorithm Hash digest
SHA256 33f062baeae9541e12a39f825537c6626c72f7a0c0d0623ed400ea58cfeb213e
MD5 8e67dd2926c3626b1d995d2d212dfd39
BLAKE2b-256 508dab111796f95d44ce527d188403bdca6371a3a1d7065e38e4a2784d57b08f

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for ds_provider_postgresql_py_lib-0.1.0b1-py3-none-any.whl
Algorithm Hash digest
SHA256 623d6bea055ecf5875907eaeadc7a17ccf7e4c81c88bc7d6a3d8b061a6086836
MD5 ab2174040daec55b5c36dc3395723b21
BLAKE2b-256 462100410f72aecc5b9943de84f3973890f2228d1d8f905892d1f980d792efa0

See more details on using hashes here.

Supported by

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