6 min read
|
Saved February 14, 2026
|
Copied!
Do you care about this?
This article explains how to connect to a Postgres database using ShadowTraffic. It covers automatic table creation, manual control options, and how to issue various SQL statements like INSERT, UPDATE, and DELETE. Examples show configuration settings and JSON schemas for effective usage.
If you do, here's more
ShadowTraffic connects to a Postgres database, executing transactions every 20 milliseconds or for every 500 rows, whichever comes first. Users can adjust these limits with `batchConfigs`. For convenience, it automatically creates tables based on the generator structure, eliminating the need for manual setup. If the default table setup doesnβt meet requirements, modifications can be made using the `pgHint` function modifier. Users can also clear existing data in tables by setting the `tablePolicy` to `dropAndCreate`.
For those who prefer to manage their tables, ShadowTraffic allows a `manual` table policy, requiring users to ensure tables exist beforehand. By default, ShadowTraffic issues only `INSERT` statements but can also handle `UPDATE` and `DELETE` operations. This is controlled by the `op` key on the generator, which must include a `where` clause to specify which rows to modify.
Configuring the connection is straightforward, requiring essential details like host, port, username, and database name. Batch configurations can be customized for transaction frequency. ShadowTraffic also supports timestamp types, requiring timestamps to be serialized appropriately for compatibility with Postgres. Users can specify schemas for their tables, but these schemas must exist before executing any operations.
JSON schemas detail the required configurations for connections and generators, outlining the structure needed for successful integration. This structured approach ensures users can tailor their interactions with Postgres effectively, whether for data generation, updates, or deletion.
Questions about this article
No questions yet.