Skip to content

Add content database helper for Connect's per-content PostgreSQL feature #471

@posit-connect-projects

Description

@posit-connect-projects

Summary

Connect is testing a per-content PostgreSQL database proxy that gives each content item its own isolated database schema. Content processes receive a CONNECT_CONTENT_DATABASE_URL environment variable with a PostgreSQL connection string scoped to their content.

It would be useful for the Python SDK to provide a factory method that makes connecting to this content database ergonomic, rather than requiring publishers to manually parse the environment variable.

Suggested API

from posit.connect import Client

client = Client()
content = client.content.current
db = content.database

# Convenience accessors
db.url   # -> "postgresql://localhost:5433/abc-123"
db.host  # -> "localhost"
db.port  # -> 5433
db.name  # -> "abc-123"

# Or direct connection
conn = db.connect()  # returns a psycopg2/sqlalchemy connection

This would abstract the CONNECT_CONTENT_DATABASE_URL env var parsing and provide a clean interface for publishers building apps that use the content database feature.

Context

  • The content database feature is currently gated behind EarlyAccess.ContentDatabase in Connect.
  • The env var contains a standard PostgreSQL connection string (e.g., postgresql://user:pass@host:port/dbname).

Metadata

Metadata

Assignees

No one assigned

    Labels

    sdkUsed for automation

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions