public inbox for [email protected]  
help / color / mirror / Atom feed
From: Francisco Olarte <[email protected]>
To: H <[email protected]>
Cc: PostgreSQL Users Mailing List <[email protected]>
Subject: Re: Creating files with testdata
Date: Mon, 10 Mar 2025 20:22:41 +0100
Message-ID: <CA+bJJbyfE3NgyxBDb+Fp8ReZYQOZdit8jZF64PnE7ZVzzi=u0A@mail.gmail.com> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>

On Mon, 10 Mar 2025 at 19:17, H <[email protected]> wrote:
...
> After entering my test data into the markdown file for the given test scenario, I would then run an awk script or similar to create a SQL file with the various CTE INSERT statements. Howevever, it gets complex since I need to handle 1:N relationships between tables in the markdown file...
> I hope the above outline is understandable and am interested in comments and thoughts on my above approach.

I do not think MD would be a good source format. Being a developer I
would recommend taking your favorite scripting language ( perl /
python / lua / js , whatever ), build a big object ( which can be
easily helped by some mini-functions to build a little DSL ) and then
spit sql from it ( for developemewnt it is normally better then using
whatever db connection your language has, as it leaves an
understandable sql script ).

I have done this with perl for some projects, built a driver which
defined several helper functions, then dofile("xx.dat") which returned
a big hash and then a series of loops on the result to write the SQL
in whatever order was neccessary.

Francisco Olarte.






view thread (2+ messages)

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: [email protected]
  Cc: [email protected], [email protected], [email protected]
  Subject: Re: Creating files with testdata
  In-Reply-To: <CA+bJJbyfE3NgyxBDb+Fp8ReZYQOZdit8jZF64PnE7ZVzzi=u0A@mail.gmail.com>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox