Python
New Python applications should connect to Kubling through the client gRPC transport. Choose the package according to the API your application needs.
SQLAlchemy and DB-API
Use kubling-sqlalchemy for SQLAlchemy or synchronous Python DB-API
applications. The driver communicates with Kubling through gRPC and does not
depend on PostgreSQL compatibility.
python -m pip install kubling-sqlalchemyfrom sqlalchemy import create_engine, text
engine = create_engine(
"kubling+grpc://sa:sa@localhost:50051/MyVDB"
"?vdb_version=1&insecure=true"
)
with engine.connect() as connection:
rows = connection.execute(text("SELECT * FROM inventory.products"))
for row in rows:
print(row)insecure=true is appropriate only for a local plaintext listener. TLS is the
default. The
Kubling SQLAlchemy repository
documents connection options, direct DB-API usage, type handling and catalog
reflection.
Direct gRPC client
Use kubling-grpc when the application should work directly with generated
messages and service stubs:
python -m pip install kubling-grpcimport grpc
from kubling.v1 import command_pb2, command_pb2_grpcThe gRPC client guide shows the complete login, capability-discovery and logout sequence. The Python package provides generated bindings rather than a DB-API abstraction.
Existing Python applications can still use a PostgreSQL driver against an
enabled pgProtocol listener. Keep that path only when PostgreSQL wire
compatibility is an application requirement; do not select it for a new
Kubling integration.