Received: from malur.postgresql.org ([217.196.149.56]) by arkaria.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lRVuL-0000D5-Ca for pgadmin-hackers@arkaria.postgresql.org; Wed, 31 Mar 2021 08:08:58 +0000 Received: from localhost ([127.0.0.1] helo=malur.postgresql.org) by malur.postgresql.org with esmtp (Exim 4.92) (envelope-from ) id 1lRVuK-0001Gx-5V for pgadmin-hackers@arkaria.postgresql.org; Wed, 31 Mar 2021 08:08:56 +0000 Received: from magus.postgresql.org ([2a02:c0:301:0:ffff::29]) by malur.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1lRVuJ-0001Gq-Hf for pgadmin-hackers@lists.postgresql.org; Wed, 31 Mar 2021 08:08:56 +0000 Received: from mail-ej1-x62c.google.com ([2a00:1450:4864:20::62c]) by magus.postgresql.org with esmtps (TLS1.3:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.92) (envelope-from ) id 1lRVuC-000861-6f for pgadmin-hackers@postgresql.org; Wed, 31 Mar 2021 08:08:54 +0000 Received: by mail-ej1-x62c.google.com with SMTP id u9so28678246ejj.7 for ; Wed, 31 Mar 2021 01:08:48 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=pgadmin.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=8SmgMVZAnjkmIS8Gt6doEgy93++Ix/+lrj0A1BtYVJk=; b=mHTqet19ARuUopiqyftQpef0T4sZjEXGrkkvNaLvYpmM76HWoeF4EcOenJQ0NEQ9W9 e/cocYtj6ID5N/nCzznpTcubKG5F7si2pOmtGnrTNTru6fa4ia2q4EXVkCA9t5t2UEt3 1hIHTMAY6E9qZcFl+dB5bhoIUeWZNttnyFFFVzhjEiM+H2E0/GOyNVaF+qkCke9iG/tu N/qoOQHl2MJjI7MhLo8OmJE0wowqCLCcZvKrmIzMz1SSEID1gyGN4HXl3Bt6D2r8yp12 ZrRjDSA1s3U6HtpoTd2OWgJ3pSgbdVhEoV2jxhIjw5Kvxnvciu4PYDg6JWO9LiuDFcvF aL4g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=8SmgMVZAnjkmIS8Gt6doEgy93++Ix/+lrj0A1BtYVJk=; b=oW91TuJAgaCmSlZ58DOo4LaYVL94kXyoGMH2q0HFikOMfk9ABKhnhyZrWjOHmUqngi U5aF9MsojiudvOjME1XqJqlStccHWrPzCO2+GsvGUarahgImszqtKAoWaJe3wXBtcWTO 762rOpn5kxEyLhLcxMWH/2ay1o8OLLFyf4ZTEzkNXb9yNn4D1dsyjMg+faiVx6JWkaNV h0/OJ1rpHulodcA+lAR2K+jjw9ddhA5mwn/yubx+1fjy/s2LsijculvzUEXeT860+t7V VMoeG2MCUnkw5VxWyTeVdcmUZiw2c49tYT7ntRbGUzlr79cuIlzJ740sGSQ4sCMYwmPi d7Ow== X-Gm-Message-State: AOAM531jcTg4k3j+fmVawdlYM/6CPYyYxIwzjHxlH3H/M0pevWHJZGp8 hHd02El3hP0jdI0v1LW5ZnFIQmf3OdrtQyluG8TNig== X-Google-Smtp-Source: ABdhPJwxkdu/UjCDE0yaldcQxLduPx3a6Nqumg8fIgCmz4Fi8Su5OiJK5+2xkUAMDmdOZ8D9EjTvM/5ejrhgBNMi5Eg= X-Received: by 2002:a17:906:1408:: with SMTP id p8mr2173459ejc.89.1617178127261; Wed, 31 Mar 2021 01:08:47 -0700 (PDT) MIME-Version: 1.0 References: In-Reply-To: From: Dave Page Date: Wed, 31 Mar 2021 08:08:36 +0000 Message-ID: Subject: Re: CLI for Schema Diff To: Steve Chavez Cc: pgadmin-hackers Content-Type: multipart/alternative; boundary="000000000000d0782005bed09f15" List-Id: List-Help: List-Subscribe: List-Post: List-Owner: List-Archive: Archived-At: Precedence: bulk --000000000000d0782005bed09f15 Content-Type: text/plain; charset="UTF-8" Hi On Tue, Mar 30, 2021 at 3:36 PM Steve Chavez wrote: > Hey all, > > In case anyone is interested, I've managed to enable a CLI mode for the > Schema Diff on this repo: > > https://github.com/steve-chavez/pgadmin4/blob/cli/web/cli.py > > It basically works by using a Flask test client that interacts with the > Schema Diff endpoints. > It's a single isolated file, I haven't patched any of the existing modules. > > For a quickstart, there's also a docker image that can be used like: > > docker run supabase/pgadmin-schema-diff \ > 'postgres://postgres@host/diff_source' \ > 'postgres://postgres@host/diff_target' \ > > diff.sql > ## the stderr output shows the same messages as the Schema Diff GUI: > > Starting schema diff... > Comparision started......0% > Comparing FTS Dictionaries ...35% > Comparing Functions ...50% > Comparing Trigger Functions ...60% > Comparing Sequences ...70% > Comparing Tables ...80% > Comparing Views ...90% > Done. > > That's an interesting approach! Obviously the code is just a proof of concept at the moment (redirecting stdout is masking errors for example), but is this something you'd be interested in working on to become a more fully featured and production quality CLI? -- Dave Page Blog: http://pgsnake.blogspot.com Twitter: @pgsnake EDB: http://www.enterprisedb.com --000000000000d0782005bed09f15 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable
Hi

On Tue, Mar 30, 2021 at 3:36 PM Steve Chavez <steve@supabase.io> wrote:
Hey all,

In case anyone is inte= rested, I've managed to enable a CLI mode for the Schema Diff on this r= epo:


It basically wor= ks by using a Flask test client that interacts with the Schema Diff endpoin= ts.
It's a single isolated file, I haven't patched any of= the existing modules.

For a quickstart, there'= ;s also a docker image that can be used like:

docker run supabase/pgadmin-schema-diff \
'postgres://postgres@host/diff_source' \
'postgres://postgres@host/diff_target' \
> diff.sql ## the= stderr output shows the same messages as the Schema Diff GUI:
Sta=
rting schema diff...
Comparision started...= ...0%
Comparing FTS Dictionaries ...35%
Comparing Functions ...50%
Comparing Trigger Functions ...60%
Comparing Sequences ...70%
Comparing T= ables ...80%
Comparing Views ...90%
Done.
That's an interesting approach! Obviously the code is just = a proof of concept at the moment (redirecting stdout is masking errors for = example), but is this something you'd be interested in working on to be= come a more fully featured and production quality CLI?=C2=A0

--
--000000000000d0782005bed09f15--