Client Libraries Quickstart¶
Connect a client, run a query, and watch a live subscription, in Python and in C++. It takes a few
minutes and assumes a server with a Center reachable, and a table to read (this example uses one
called QUOTES).
The port numbers below are the common convention. Only the JDBC port (3280) is a real default: set the Center port (shown as 3270) and Relay port (3289) to whatever your deployment uses. See Configuration → Ports.
1. Connect¶
You create one client, describe a cluster with the configs your program needs, and add it.
The third argument to the C++ DatabaseConfig ({}) is the failover-endpoints list; leave it empty
for a single server.
2. Run a query¶
A JDBC query returns a table. In Python it comes back as a column-oriented dict you can hand straight to
pandas; in C++ it comes back as a TableAccessor you iterate.
The equality operator is == and string literals use double quotes, this is the expression
syntax, not ANSI SQL. On error the dict has an "error" key; an INSERT/UPDATE returns
{"rows_affected": n}.
Results are capped at 10 000 rows by default
The default row limit is 10 000. A larger result is truncated; raise the limit on the JDBC config or narrow the query. See Configuration.
3. Watch a table live¶
Attach a listener and subscribe. The client calls on_update for every row change, an add for each
initial row, then update/delete as the table changes.
An update carries only the columns that changed. Merge it onto the row you already hold, keyed by
the numeric id (not object_id, which is empty on subscription updates); do not replace the whole
row or you blank the untouched fields. See Concepts → Merge on id.
Callbacks run on the client's threads
on_update runs on the client's own I/O thread. Copy anything you keep (the field data is valid
only during the callback), keep the callback fast and run blocking work (and any same-connection
call) on your own thread rather than in the callback, and guard shared state. See Concepts.
Where to go next¶
- Python client / C++ client, the full method reference, including publishing and bulk insert.
- Use case: market data to a live dashboard, publish quotes and watch them aggregate.
- Configuration, authentication, TLS, failover, sharding.
Verified live via the Python client (build 32437)
The Python round trip here, connect over mutual TLS, query, and subscribe, was reproduced against a live instance. The C++ snippets were not separately compiled and run.